Revision tags: llvmorg-21-init |
|
#
d92bac8a |
| 25-Jan-2025 |
Helena Kotas <hekotas@microsoft.com> |
[HLSL] Introduce address space `hlsl_constant(2)` for constant buffer declarations (#123411)
Introduces a new address space `hlsl_constant(2)` for constant buffer
declarations.
This address spac
[HLSL] Introduce address space `hlsl_constant(2)` for constant buffer declarations (#123411)
Introduces a new address space `hlsl_constant(2)` for constant buffer
declarations.
This address space is applied to declarations inside `cbuffer` block.
Later on, it will also be applied to `ConstantBuffer<T>` syntax and the
default `$Globals` constant buffer.
Clang codegen translates constant buffer declarations to global
variables and loads from `hlsl_constant(2)` address space. More work
coming soon will include addition of metadata that will map these
globals to individual constant buffers and enable their transformation
to appropriate constant buffer load intrinsics later on in an LLVM pass.
Fixes #123406
show more ...
|
#
719f0d92 |
| 22-Jan-2025 |
Helena Kotas <hekotas@microsoft.com> |
[HLSL] Fix global resource initialization (#123394)
Create separate resource initialization function for each resource and
add them to CodeGenModule's `CXXGlobalInits` list.
Fixes #120636 and addr
[HLSL] Fix global resource initialization (#123394)
Create separate resource initialization function for each resource and
add them to CodeGenModule's `CXXGlobalInits` list.
Fixes #120636 and addresses this [comment
](https://github.com/llvm/llvm-project/pull/119755/files#r1894093603).
show more ...
|
Revision tags: llvmorg-19.1.7 |
|
#
7a761100 |
| 04-Jan-2025 |
Zhengxing li <zhengxingli@microsoft.com> |
[HLSL][SPIR-V] implement SV_GroupID semantic lowering (#121521)
The HLSL SV_GroupID semantic attribute is lowered into
@llvm.spv.group.id intrinsic in LLVM IR for SPIR-V target.
In the SPIR-V ba
[HLSL][SPIR-V] implement SV_GroupID semantic lowering (#121521)
The HLSL SV_GroupID semantic attribute is lowered into
@llvm.spv.group.id intrinsic in LLVM IR for SPIR-V target.
In the SPIR-V backend, this is now translated to a `WorkgroupId` builtin
variable.
Fixes #118700 which's a follow-up work to #70120
show more ...
|
#
52b07d97 |
| 17-Dec-2024 |
Nathan Gauër <brioche@google.com> |
[HLSL] Fix call convention mismatch for ctor/dtor (#118651)
Before this patch, there was a calling-convention mismatch between the
constructors and the actual call emitted for the entrypoint wrappe
[HLSL] Fix call convention mismatch for ctor/dtor (#118651)
Before this patch, there was a calling-convention mismatch between the
constructors and the actual call emitted for the entrypoint wrapper.
Such mismatch causes the InstCombine pass to replace this call with an
`unreachable`, breaking the whole function.
Signed-off-by: Nathan Gauër <brioche@google.com>
show more ...
|
Revision tags: llvmorg-19.1.6 |
|
#
951a284f |
| 10-Dec-2024 |
Zhengxing li <zhengxingli@microsoft.com> |
[HLSL] Implement SV_GroupThreadId semantic (#117781)
Support HLSL SV_GroupThreadId attribute.
For `directx` target, translate it into `dx.thread.id.in.group` in clang
codeGen and lower `dx.threa
[HLSL] Implement SV_GroupThreadId semantic (#117781)
Support HLSL SV_GroupThreadId attribute.
For `directx` target, translate it into `dx.thread.id.in.group` in clang
codeGen and lower `dx.thread.id.in.group` to `dx.op.threadIdInGroup` in
LLVM DirectX backend.
For `spir-v` target, translate it into `spv.thread.id.in.group` in clang
codeGen and lower `spv.thread.id.in.group` to a `LocalInvocationId`
builtin variable in LLVM SPIR-V backend.
Fixes: #70122
show more ...
|
Revision tags: llvmorg-19.1.5 |
|
#
5fd4f32f |
| 26-Nov-2024 |
Zhengxing li <zhengxingli@microsoft.com> |
[HLSL] Implement SV_GroupID semantic (#115911)
Support SV_GroupID attribute.
Translate it into dx.group.id in clang codeGen.
Fixes: #70120
|
Revision tags: llvmorg-19.1.4 |
|
#
74d8f395 |
| 30-Oct-2024 |
Helena Kotas <hekotas@microsoft.com> |
[HLSL] Remove old resource annotations for UAVs and SRVs (#114139)
UAVs and SRVs have already been converted to use LLVM target types and
we can disable generating of the !hlsl.uavs and !hlsl.srvs!
[HLSL] Remove old resource annotations for UAVs and SRVs (#114139)
UAVs and SRVs have already been converted to use LLVM target types and
we can disable generating of the !hlsl.uavs and !hlsl.srvs! annotations.
This will enable adding tests for structured buffers with user defined
types that this old resource annotations code does not handle (it
crashes).
Part 1 of #114126
show more ...
|
Revision tags: llvmorg-19.1.3 |
|
#
98e3075d |
| 28-Oct-2024 |
Steven Perron <stevenperron@google.com> |
[HLSL][SPIRV] Add convergence tokens to entry point wrapper (#112757)
Inlining currently assumes that either all function use controled
convergence or none of them do. This is why we need to have t
[HLSL][SPIRV] Add convergence tokens to entry point wrapper (#112757)
Inlining currently assumes that either all function use controled
convergence or none of them do. This is why we need to have the entry
point wrapper use controled convergence.
https://github.com/llvm/llvm-project/blob/c85611e8583e6392d56075ebdfa60893b6284813/llvm/lib/Transforms/Utils/InlineFunction.cpp#L2431-L2439
show more ...
|
#
7dbfa7b9 |
| 18-Oct-2024 |
Helena Kotas <hekotas@microsoft.com> |
[HLSL] Add handle initialization for simple resource declarations (#111207)
Adds `@_init_resource_bindings()` function to module initialization that
includes `handle.fromBinding` intrinsic calls fo
[HLSL] Add handle initialization for simple resource declarations (#111207)
Adds `@_init_resource_bindings()` function to module initialization that
includes `handle.fromBinding` intrinsic calls for simple resource
declarations. Arrays of resources or resources inside user defined types
are not supported yet.
While this unblocks our progress on [Compile a runnable shader from
clang](https://github.com/llvm/wg-hlsl/issues/7) milestone, this is
probably not the way we would like to handle resource binding
initialization going forward. Ideally, it should be done via the
resource class constructors in order to support dynamic resource binding
or unbounded arrays if resources.
Depends on PRs #110327 and #111203.
Part 1 of #105076
show more ...
|
Revision tags: llvmorg-19.1.2 |
|
#
be6b4f69 |
| 01-Oct-2024 |
Steven Perron <stevenperron@google.com> |
[HLSL][SPIRV] Fix calling convention for call in entry function. (#110542)
Fix the calling convention used for the call in the entry point
wrapper. No calling convention is currently set. It can ea
[HLSL][SPIRV] Fix calling convention for call in entry function. (#110542)
Fix the calling convention used for the call in the entry point
wrapper. No calling convention is currently set. It can easily use the
calling convention of the function that is being called.
Without this, there is a mismatch in the calling convention between the
call site and the callee. This is undefined behaviour.
show more ...
|
Revision tags: llvmorg-19.1.1 |
|
#
0f77bdd2 |
| 18-Sep-2024 |
Xiang Li <python3kgae@outlook.com> |
[HLSL] generate hlsl.wavesize attribute (#107176)
Generate function attribute hlsl.wavesize from [WaveSize].
For #70118
|
#
b89bb777 |
| 17-Sep-2024 |
Thurston Dang <thurston@google.com> |
Reapply "[HLSL] set alwaysinline on HLSL functions (#106588)"
This reverts commit 4a63f4d301c0e044073e1b1f8f110015ec1778a1.
It was reverted because of a buildbot breakage, but the fix-forward has l
Reapply "[HLSL] set alwaysinline on HLSL functions (#106588)"
This reverts commit 4a63f4d301c0e044073e1b1f8f110015ec1778a1.
It was reverted because of a buildbot breakage, but the fix-forward has landed (https://github.com/llvm/llvm-project/pull/109023).
show more ...
|
#
4a63f4d3 |
| 17-Sep-2024 |
Thurston Dang <thurston@google.com> |
Revert "[HLSL] set alwaysinline on HLSL functions (#106588)"
This reverts commit a729e706de3fc6ebee49ede3c50afb47f2e29191.
Reason:bBuildbot failure (https://lab.llvm.org/buildbot/#/builders/25/buil
Revert "[HLSL] set alwaysinline on HLSL functions (#106588)"
This reverts commit a729e706de3fc6ebee49ede3c50afb47f2e29191.
Reason:bBuildbot failure (https://lab.llvm.org/buildbot/#/builders/25/builds/2541): 'Clang :: CodeGenHLSL/builtins/StructuredBuffer-subscript.hlsl' failed
show more ...
|
#
a729e706 |
| 17-Sep-2024 |
Greg Roth <grroth@microsoft.com> |
[HLSL] set alwaysinline on HLSL functions (#106588)
HLSL inlines all its functions by default. This uses the alwaysinline
attribute to make the alwaysinliner pass inline any function not
explicitl
[HLSL] set alwaysinline on HLSL functions (#106588)
HLSL inlines all its functions by default. This uses the alwaysinline
attribute to make the alwaysinliner pass inline any function not
explicitly marked noinline by the user or autogeneration. The
alwayslinline marking takes place in `SetLLVMFunctionAttributesForDefinitions`
where all other inlining interactions are determined.
The outermost entry function is marked noinline because there's no
reason to inline it. Any user calls to an entry function will instead call
the internal mangled version of the entry function.
Adds tests for function and constructor inlining and augments some
existing tests to verify correct inlining of implicitly created
functions as well.
Incidentally restore RUN line that I believe was mistakenly removed as
part of #88918
Fixes #89282
show more ...
|
Revision tags: llvmorg-19.1.0 |
|
#
8e35c869 |
| 06-Sep-2024 |
Helena Kotas <hekotas@microsoft.com> |
[HLSL] Apply resource attributes to the resource type rather than the handle member (#107160)
Converts existing resource attributes `[[hlsl::resource_class(..)]]` and
`[[is_rov]]` from declaration
[HLSL] Apply resource attributes to the resource type rather than the handle member (#107160)
Converts existing resource attributes `[[hlsl::resource_class(..)]]` and
`[[is_rov]]` from declaration attributes to type attributes.
During type attribute processing all HLSL resource type attributes are
validated and collected by `SemaHLSL`
(`SemaHLSL::handleResourceTypeAttr`). At the end of the declaration they
are be combined into a single `HLSLAttributedResourceType` instance
(`SemaHLSL::ProcessResourceTypeAttributes`) that wraps the original type
and stores all of the necessary information about the resource.
`SemaHLSL` will also need to short-term-store the `TypeLoc` information
for the newly created type that will be grabbed by `TypeSpecLocFiller`
soon after it is created.
Updates all places that expected resource attributes on declarations
like resource binding diagnostic, builtin types in
HLSLExternalSemaSource, or codegen.
Also includes implementation of
`TreeTransform<Derived>::TransformHLSLAttributedResourceType` that
enables the use of attributed resource types inside templates.
Fixes #104861
Part 2/2
show more ...
|
Revision tags: llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3 |
|
#
eae1d65f |
| 14-Aug-2024 |
Joshua Batista <jbatista@microsoft.com> |
[HLSL] Split out the ROV attribute from the resource attribute, make it a new spellable attribute. (#102414)
Much like #98193, this PR takes some more data out of the resource
attribute, specifical
[HLSL] Split out the ROV attribute from the resource attribute, make it a new spellable attribute. (#102414)
Much like #98193, this PR takes some more data out of the resource
attribute, specifically the ROV data.
This PR introduces a new attribute called HLSLROVAttr, which contains
data on whether or not the decl the attribute applies to is an ROV.
Tests were added to ensure the attribute is found on the AST.
This attribute may take any boolean condition as an argument. If the
condition is true, then the object the attribute applies to "is" an ROV.
Fixes #https://github.com/llvm/llvm-project/issues/102392
show more ...
|
#
2c8bd4a7 |
| 13-Aug-2024 |
Helena Kotas <hekotas@microsoft.com> |
[HLSL] Mark exported functions with "hlsl.export" attribute (#102275)
Marks exported functions with `"hlsl.export"` attribute. This
information will be later used by DXILFinalizeLinkage pass (comin
[HLSL] Mark exported functions with "hlsl.export" attribute (#102275)
Marks exported functions with `"hlsl.export"` attribute. This
information will be later used by DXILFinalizeLinkage pass (coming soon)
to determine which functions should have internal linkage in the final
DXIL code.
Related to #llvm/llvm-project#92071
show more ...
|
#
52956b0f |
| 05-Aug-2024 |
Helena Kotas <hekotas@microsoft.com> |
[HLSL] Implement intangible AST type (#97362)
HLSL has a set of intangible types which are described in in the
[draft HLSL Specification
(**[Basic.types]**)](https://microsoft.github.io/hlsl-specs
[HLSL] Implement intangible AST type (#97362)
HLSL has a set of intangible types which are described in in the
[draft HLSL Specification
(**[Basic.types]**)](https://microsoft.github.io/hlsl-specs/specs/hlsl.pdf):
There are special implementation-defined types such as handle types,
which fall into a category of standard intangible types. Intangible
types are types that have no defined object representation or value
representation, as such the size is unknown at compile time.
A class type T is an intangible class type if it contains an base
classes or members of intangible class type, standard intangible type,
or arrays of such types. Standard intangible types and intangible class
types are collectively called intangible
types([9](https://microsoft.github.io/hlsl-specs/specs/hlsl.html#Intangible)).
This PR implements one standard intangible type `__hlsl_resource_t`
and sets up the infrastructure that will make it easier to add more
in the future, such as samplers or raytracing payload handles. The
HLSL intangible types are declared in
`clang/include/clang/Basic/HLSLIntangibleTypes.def` and this file is
included with related macro definition in most places that require edits
when a new type is added.
The new types are added as keywords and not typedefs to make sure they
cannot be redeclared, and they can only be declared in builtin implicit
headers. The `__hlsl_resource_t` type represents a handle to a memory
resource and it is going to be used in builtin HLSL buffer types like this:
template <typename T>
class RWBuffer {
[[hlsl::contained_type(T)]]
[[hlsl::is_rov(false)]]
[[hlsl::resource_class(uav)]]
__hlsl_resource_t Handle;
};
Part 1/3 of llvm/llvm-project#90631.
---------
Co-authored-by: Justin Bogner <mail@justinbogner.com>
show more ...
|
Revision tags: llvmorg-19.1.0-rc2 |
|
#
ac319a8d |
| 03-Aug-2024 |
Joshua Batista <jbatista@microsoft.com> |
Attach resource attributes to handle within record, instead of record (#101433)
This PR attaches the resource attributes, `HLSLResourceAttr` and
`HLSLResourceClassAttr`, to the handle contained wit
Attach resource attributes to handle within record, instead of record (#101433)
This PR attaches the resource attributes, `HLSLResourceAttr` and
`HLSLResourceClassAttr`, to the handle contained within such resource
classes like `RWBuffer`. CodeGen will now search for fields within HLSL
resource decls, and emit previous data based on attributes on the handle
member. An AST-dump test was added to verify that the resource attribute
is attached to the handle within the resource record decl.
Fixes #98556
---------
Co-authored-by: Justin Bogner <mail@justinbogner.com>
show more ...
|
Revision tags: llvmorg-19.1.0-rc1, llvmorg-20-init |
|
#
5dc371e2 |
| 12-Jul-2024 |
Joshua Batista <jbatista@microsoft.com> |
[HLSL] Split out resource class data from resource attribute (#98419)
The ability to spell out and specify the resource class is necessary for
testing various resource binding behaviors. Though it
[HLSL] Split out resource class data from resource attribute (#98419)
The ability to spell out and specify the resource class is necessary for
testing various resource binding behaviors. Though it is not intended
for users to use this in customized HLSL source code, the ability to
specify the resource class via an attribute is immensely helpful for
writing thorough tests.
This PR introduces a new attribute, hlsl::resource_attribute, that can
only be applied on structs. This attribute only has 1 required argument,
and must be one of:
```
SRV
UAV
CBuffer
Sampler
```
By applying this attribute to a struct, the struct will have the
`HLSLResourceClassAttr` attribute attached to it in the AST
representation, which provides information on the type of resource class
the struct is meant to be.
The resource class data that was originally contained within the
`HLSLResourceAttr` attribute has been removed in favor of this new
attribute, and so certain ast-dump tests need to be modified so that the
same information can be represented via 2 attributes instead of one.
Fixes #98193
---------
Co-authored-by: Damyan Pepper <damyanp@microsoft.com>
show more ...
|
#
d75f9dd1 |
| 24-Jun-2024 |
Stephen Tozer <stephen.tozer@sony.com> |
Revert "[IR][NFC] Update IRBuilder to use InsertPosition (#96497)"
Reverts the above commit, as it updates a common header function and did not update all callsites:
https://lab.llvm.org/buildbot
Revert "[IR][NFC] Update IRBuilder to use InsertPosition (#96497)"
Reverts the above commit, as it updates a common header function and did not update all callsites:
https://lab.llvm.org/buildbot/#/builders/29/builds/382
This reverts commit 6481dc57612671ebe77fe9c34214fba94e1b3b27.
show more ...
|
#
6481dc57 |
| 24-Jun-2024 |
Stephen Tozer <stephen.tozer@sony.com> |
[IR][NFC] Update IRBuilder to use InsertPosition (#96497)
Uses the new InsertPosition class (added in #94226) to simplify some of
the IRBuilder interface, and removes the need to pass a BasicBlock
[IR][NFC] Update IRBuilder to use InsertPosition (#96497)
Uses the new InsertPosition class (added in #94226) to simplify some of
the IRBuilder interface, and removes the need to pass a BasicBlock
alongside a BasicBlock::iterator, using the fact that we can now get the
parent basic block from the iterator even if it points to the sentinel.
This patch removes the BasicBlock argument from each constructor or call
to setInsertPoint.
This has no functional effect, but later on as we look to remove the
`Instruction *InsertBefore` argument from instruction-creation
(discussed
[here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)),
this will simplify the process by allowing us to deprecate the
InsertPosition constructor directly and catch all the cases where we use
instructions rather than iterators.
show more ...
|
Revision tags: llvmorg-18.1.8 |
|
#
5d87ba1c |
| 08-Jun-2024 |
Helena Kotas <hekotas@microsoft.com> |
[HLSL] Use llvm::Triple::EnvironmentType instead of HLSLShaderAttr::ShaderType (#93847)
`HLSLShaderAttr::ShaderType` enum is a subset of
`llvm::Triple::EnvironmentType`. We can use
`llvm::Triple::
[HLSL] Use llvm::Triple::EnvironmentType instead of HLSLShaderAttr::ShaderType (#93847)
`HLSLShaderAttr::ShaderType` enum is a subset of
`llvm::Triple::EnvironmentType`. We can use
`llvm::Triple::EnvironmentType` directly and avoid converting one enum
to another.
show more ...
|
Revision tags: llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4 |
|
#
1cb64d75 |
| 05-Apr-2024 |
Farzon Lotfi <1802579+farzonl@users.noreply.github.com> |
[HLSL][DXIL][SPIRV] Implementation of an abstraction for intrinsic selection of HLSL backends (#87171)
Start of #83882
- `Builtins.td` - add the `hlsl` `all` elementwise builtin.
- `CGBuiltin.cpp
[HLSL][DXIL][SPIRV] Implementation of an abstraction for intrinsic selection of HLSL backends (#87171)
Start of #83882
- `Builtins.td` - add the `hlsl` `all` elementwise builtin.
- `CGBuiltin.cpp` - Show a use case for CGHLSLUtils via an `all`
intrinsic codegen.
- `CGHLSLRuntime.cpp` - move `thread_id` to use CGHLSLUtils.
- `CGHLSLRuntime.h` - Create a macro to help pick the right intrinsic
for the backend.
- `hlsl_intrinsics.h` - Add the `all` api.
- `SemaChecking.cpp` - Add `all` builtin type checking
- `IntrinsicsDirectX.td` - Add the `all` `dx` intrinsic
- `IntrinsicsSPIRV.td` - Add the `all` `spv` intrinsic
Work still needed:
- `SPIRVInstructionSelector.cpp` - Add an implementation of `OpAll` for
`spv_all` intrinsic
show more ...
|
Revision tags: llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1 |
|
#
6325dd57 |
| 04-Mar-2024 |
Natalie Chouinard <sudonatalie@google.com> |
[HLSL][SPIR-V] Add SV_DispatchThreadID semantic support (#82536)
Add SPIR-V backend support for the HLSL SV_DispatchThreadID semantic
attribute, which is lowered to a @llvm.dx.thread.id intrinsic i
[HLSL][SPIR-V] Add SV_DispatchThreadID semantic support (#82536)
Add SPIR-V backend support for the HLSL SV_DispatchThreadID semantic
attribute, which is lowered to a @llvm.dx.thread.id intrinsic in LLVM
IR. In the SPIR-V backend, this is now correctly translated to a
`GlobalInvocationId` builtin variable.
Fixes #82534
show more ...
|