<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/Target/DirectX/DXILShaderFlags.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[HLSL] Add Load overload with status (#166449)</title>
<updated>2025-11-21T18:11:38+00:00</updated>
<author>
<name>Joshua Batista</name>
<email>jbatista@microsoft.com</email>
</author>
<published>2025-11-21T18:11:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=fea070b610e0dc08447be60db7f13c150b2892d5'/>
<id>fea070b610e0dc08447be60db7f13c150b2892d5</id>
<content type='text'>
This PR adds a Load method for resources, which takes an additional
parameter by reference, status. It fills the status parameter with a 1
or 0, depending on whether or not the resource access was mapped.
CheckAccessFullyMapped is also added as an intrinsic, and called in the
production of this status bit.
Only addresses DXIL for the below issue:
https://github.com/llvm/llvm-project/issues/138910
Also only addresses the DXIL variant for the below issue:
https://github.com/llvm/llvm-project/issues/99204</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR adds a Load method for resources, which takes an additional
parameter by reference, status. It fills the status parameter with a 1
or 0, depending on whether or not the resource access was mapped.
CheckAccessFullyMapped is also added as an intrinsic, and called in the
production of this status bit.
Only addresses DXIL for the below issue:
https://github.com/llvm/llvm-project/issues/138910
Also only addresses the DXIL variant for the below issue:
https://github.com/llvm/llvm-project/issues/99204</pre>
</div>
</content>
</entry>
<entry>
<title>[HLSL][DXIL][SPRIV] Added WaveActiveMin intrinsic (#164385)</title>
<updated>2025-10-28T18:01:13+00:00</updated>
<author>
<name>Sietze Riemersma</name>
<email>43845930+KungFuDonkey@users.noreply.github.com</email>
</author>
<published>2025-10-28T18:01:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=bfd4935fa3b47f552a0032d3e47c104924d1e107'/>
<id>bfd4935fa3b47f552a0032d3e47c104924d1e107</id>
<content type='text'>
Adds the WaveActiveMin intrinsic from #99169. I think I did all of the
required things on the checklist:
- [x]  Implement `WaveActiveMin` clang builtin,
- [x]  Link `WaveActiveMin` clang builtin with `hlsl_intrinsics.h`
- [x] Add sema checks for `WaveActiveMin` to
`CheckHLSLBuiltinFunctionCall` in `SemaChecking.cpp`
- [x] Add codegen for `WaveActiveMin` to `EmitHLSLBuiltinExpr` in
`CGBuiltin.cpp`
- [x] Add codegen tests to
`clang/test/CodeGenHLSL/builtins/WaveActiveMin.hlsl`
- [x] Add sema tests to
`clang/test/SemaHLSL/BuiltIns/WaveActiveMin-errors.hlsl`
- [x] Create the `int_dx_WaveActiveMin` intrinsic in
`IntrinsicsDirectX.td`
- [x] Create the `DXILOpMapping` of `int_dx_WaveActiveMin` to `119` in
`DXIL.td`
- [x] Create the `WaveActiveMin.ll` and `WaveActiveMin_errors.ll` tests
in `llvm/test/CodeGen/DirectX/`
- [x] Create the `int_spv_WaveActiveMin` intrinsic in
`IntrinsicsSPIRV.td`
- [x] In SPIRVInstructionSelector.cpp create the `WaveActiveMin`
lowering and map it to `int_spv_WaveActiveMin` in
`SPIRVInstructionSelector::selectIntrinsic`.
- [x] Create SPIR-V backend test case in
`llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveActiveMin.ll

But as some of the code has changed and was moved around (E.G.
`CGBuiltin.cpp` -&gt; `CGHLSLBuiltins.cpp`) I mostly followed how
`WaveActiveMax()` is implemented.

I have not been able to run the tests myself as I am unsure which
project runs the correct test. Any guidance on how I can test myself
would be helpful.

Also added some tests to the offload-test-suite
https://github.com/llvm/offload-test-suite/pull/478</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Adds the WaveActiveMin intrinsic from #99169. I think I did all of the
required things on the checklist:
- [x]  Implement `WaveActiveMin` clang builtin,
- [x]  Link `WaveActiveMin` clang builtin with `hlsl_intrinsics.h`
- [x] Add sema checks for `WaveActiveMin` to
`CheckHLSLBuiltinFunctionCall` in `SemaChecking.cpp`
- [x] Add codegen for `WaveActiveMin` to `EmitHLSLBuiltinExpr` in
`CGBuiltin.cpp`
- [x] Add codegen tests to
`clang/test/CodeGenHLSL/builtins/WaveActiveMin.hlsl`
- [x] Add sema tests to
`clang/test/SemaHLSL/BuiltIns/WaveActiveMin-errors.hlsl`
- [x] Create the `int_dx_WaveActiveMin` intrinsic in
`IntrinsicsDirectX.td`
- [x] Create the `DXILOpMapping` of `int_dx_WaveActiveMin` to `119` in
`DXIL.td`
- [x] Create the `WaveActiveMin.ll` and `WaveActiveMin_errors.ll` tests
in `llvm/test/CodeGen/DirectX/`
- [x] Create the `int_spv_WaveActiveMin` intrinsic in
`IntrinsicsSPIRV.td`
- [x] In SPIRVInstructionSelector.cpp create the `WaveActiveMin`
lowering and map it to `int_spv_WaveActiveMin` in
`SPIRVInstructionSelector::selectIntrinsic`.
- [x] Create SPIR-V backend test case in
`llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveActiveMin.ll

But as some of the code has changed and was moved around (E.G.
`CGBuiltin.cpp` -&gt; `CGHLSLBuiltins.cpp`) I mostly followed how
`WaveActiveMax()` is implemented.

I have not been able to run the tests myself as I am unsure which
project runs the correct test. Any guidance on how I can test myself
would be helpful.

Also added some tests to the offload-test-suite
https://github.com/llvm/offload-test-suite/pull/478</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] Add support for vector type checking in DXIL Shader Flag Analysis (#150532)</title>
<updated>2025-07-25T00:09:34+00:00</updated>
<author>
<name>Deric C.</name>
<email>cheung.deric@gmail.com</email>
</author>
<published>2025-07-25T00:09:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4ae26783724a8cb29b448920f5b4066ebbbf3a95'/>
<id>4ae26783724a8cb29b448920f5b4066ebbbf3a95</id>
<content type='text'>
Fixes #150482 by replacing all `Instruction.getType()` in
DXILShaderFlags.cpp with `Instruction.getType()-&gt;getScalarType()` to
account for vectors types as suggested by @bogner</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #150482 by replacing all `Instruction.getType()` in
DXILShaderFlags.cpp with `Instruction.getType()-&gt;getScalarType()` to
account for vectors types as suggested by @bogner</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] Legalize `llvm.lifetime.*` intrinsics in EmbedDXILPass (#150100)</title>
<updated>2025-07-23T00:08:05+00:00</updated>
<author>
<name>Deric C.</name>
<email>cheung.deric@gmail.com</email>
</author>
<published>2025-07-23T00:08:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c3c72c1de9aece0b98a6f1c62d3883dde1a50fcd'/>
<id>c3c72c1de9aece0b98a6f1c62d3883dde1a50fcd</id>
<content type='text'>
Fixes #147395

This PR:
- Excludes lifetime intrinsics from the Int64Ops shader flags analysis
to match DXC behavior and pass DXIL validation.
- Performs legalization of `llvm.lifetime.*` intrinsics in the
EmbedDXILPass just before invoking the DXILBitcodeWriter.
- After invoking the DXILBitcodeWriter, all lifetime intrinsics and
associated bitcasts are removed from the module to keep the Module
Verifier happy. This is fine since lifetime intrinsics are not needed by
any passes after the EmbedDXILPass.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #147395

This PR:
- Excludes lifetime intrinsics from the Int64Ops shader flags analysis
to match DXC behavior and pass DXIL validation.
- Performs legalization of `llvm.lifetime.*` intrinsics in the
EmbedDXILPass just before invoking the DXILBitcodeWriter.
- After invoking the DXILBitcodeWriter, all lifetime intrinsics and
associated bitcasts are removed from the module to keep the Module
Verifier happy. This is fine since lifetime intrinsics are not needed by
any passes after the EmbedDXILPass.</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[DirectX] Legalize lifetime intrinsics for DXIL" (#149883)</title>
<updated>2025-07-21T19:34:50+00:00</updated>
<author>
<name>Deric C.</name>
<email>cheung.deric@gmail.com</email>
</author>
<published>2025-07-21T19:34:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8f9ed788740fd00836195b30061ad161b2055d8c'/>
<id>8f9ed788740fd00836195b30061ad161b2055d8c</id>
<content type='text'>
Reverts llvm/llvm-project#148003 to fix a DirectX backend build breakage
due to #149310</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reverts llvm/llvm-project#148003 to fix a DirectX backend build breakage
due to #149310</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] Legalize lifetime intrinsics for DXIL (#148003)</title>
<updated>2025-07-11T19:26:53+00:00</updated>
<author>
<name>Deric C.</name>
<email>cheung.deric@gmail.com</email>
</author>
<published>2025-07-11T19:26:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=fee27b33373c126c2205f49c8fc9b8c9fd2f3dca'/>
<id>fee27b33373c126c2205f49c8fc9b8c9fd2f3dca</id>
<content type='text'>
Fixes #147395

This PR legalizes lifetime intrinsics for DXIL by
- Adding a bitcast for the lifetime intrinsics' pointer operand in
dxil-prepare to ensure it gets cast to an `i8*` when written to DXIL
- Removing the memory attribute from lifetime intrinsics in dxil-prepare
to match DXIL
- Making the DXIL bitcode writer write the base/demangled name of
lifetime intrinsics to the symbol table
- Making lifetime intrinsics an exception to Int64Ops shader flag
analysis (otherwise we get `error: Flags must match usage.` from the
validator)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #147395

This PR legalizes lifetime intrinsics for DXIL by
- Adding a bitcast for the lifetime intrinsics' pointer operand in
dxil-prepare to ensure it gets cast to an `i8*` when written to DXIL
- Removing the memory attribute from lifetime intrinsics in dxil-prepare
to match DXIL
- Making the DXIL bitcode writer write the base/demangled name of
lifetime intrinsics to the symbol table
- Making lifetime intrinsics an exception to Int64Ops shader flag
analysis (otherwise we get `error: Flags must match usage.` from the
validator)</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] Set whole-module flags prior to evaluating per-function flags (#139967)</title>
<updated>2025-05-15T20:43:29+00:00</updated>
<author>
<name>Deric C.</name>
<email>cheung.deric@gmail.com</email>
</author>
<published>2025-05-15T20:43:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=acdba28e148ac1e94d6c041f9911230e1e90e9cd'/>
<id>acdba28e148ac1e94d6c041f9911230e1e90e9cd</id>
<content type='text'>
Fixes #139024 and #139954

- Refactor DXILShaderFlags to compute the flags that apply to a whole
module before computing flags that apply individually to each function
- Make DXILResourceMap const, since it is not modified in
DXILShaderFlags
- Per-function shader flag analysis now initially starts with the set of
flags that apply to the whole module instead of starting from no flags.
This change fixes the above linked issues
- Fix shader flag tests affected by the above change</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #139024 and #139954

- Refactor DXILShaderFlags to compute the flags that apply to a whole
module before computing flags that apply individually to each function
- Make DXILResourceMap const, since it is not modified in
DXILShaderFlags
- Per-function shader flag analysis now initially starts with the set of
flags that apply to the whole module instead of starting from no flags.
This change fixes the above linked issues
- Fix shader flag tests affected by the above change</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] Set shader feature flags MinimumPrecision and NativeLowPrecision, and refactor the logic for setting low-precision-related flags (#139623)</title>
<updated>2025-05-14T17:37:27+00:00</updated>
<author>
<name>Deric C.</name>
<email>cheung.deric@gmail.com</email>
</author>
<published>2025-05-14T17:37:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=80fa6214821582511c687d00a484929530df1661'/>
<id>80fa6214821582511c687d00a484929530df1661</id>
<content type='text'>
Fixes #138997 and does refactoring for low-precision-related flags.

The shader feature flags MinimumPrecision and NativeLowPrecision were
not being set, leading to validation errors.
This PR sets these shader feature flags [as in
DXC](https://github.com/microsoft/DirectXShaderCompiler/blob/377c4ca6d82adb83bf2eaf978a7040443848d6fd/lib/DXIL/DxilShaderFlags.cpp#L58-L63)
and adds tests for them.

This PR also performs some refactoring of low-precision-related flags to
make it less confusing.
- The `UseNativeLowPrecision` DXIL module flag has been renamed to
`NativeLowPrecisionMode` to imply that it is setting some execution
state which the module should be interpreted with
- The LLVM module flag `dx.nativelowprec` is now read only once and sets
a bool to be used by `updateFunctionFlags()` and for setting the DXIL
module flag `NativeLowPrecisionMode`
- The `MinimumPrecision`, `NativeLowPrecision`, and
`LowPrecisionPresent` shader feature flags are all set together under
`updateFunctionFlags()`
- Moved the logic for setting DXIL module flags `NativeLowPrecisionMode`
and `ResMayNotAlias` out of the per-function loop and placed it
alongside the logic for setting other DXIL module flags
(`DisableOptimizations`, `Max64UAVs`, and `UAVsAtEveryStage` flags)

---------

Co-authored-by: Justin Bogner &lt;mail@justinbogner.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #138997 and does refactoring for low-precision-related flags.

The shader feature flags MinimumPrecision and NativeLowPrecision were
not being set, leading to validation errors.
This PR sets these shader feature flags [as in
DXC](https://github.com/microsoft/DirectXShaderCompiler/blob/377c4ca6d82adb83bf2eaf978a7040443848d6fd/lib/DXIL/DxilShaderFlags.cpp#L58-L63)
and adds tests for them.

This PR also performs some refactoring of low-precision-related flags to
make it less confusing.
- The `UseNativeLowPrecision` DXIL module flag has been renamed to
`NativeLowPrecisionMode` to imply that it is setting some execution
state which the module should be interpreted with
- The LLVM module flag `dx.nativelowprec` is now read only once and sets
a bool to be used by `updateFunctionFlags()` and for setting the DXIL
module flag `NativeLowPrecisionMode`
- The `MinimumPrecision`, `NativeLowPrecision`, and
`LowPrecisionPresent` shader feature flags are all set together under
`updateFunctionFlags()`
- Moved the logic for setting DXIL module flags `NativeLowPrecisionMode`
and `ResMayNotAlias` out of the per-function loop and placed it
alongside the logic for setting other DXIL module flags
(`DisableOptimizations`, `Max64UAVs`, and `UAVsAtEveryStage` flags)

---------

Co-authored-by: Justin Bogner &lt;mail@justinbogner.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] Implement Shader Flag Analysis for `UAVsAtEveryStage`  (#137085)</title>
<updated>2025-04-29T18:56:21+00:00</updated>
<author>
<name>Deric C.</name>
<email>cheung.deric@gmail.com</email>
</author>
<published>2025-04-29T18:56:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e33b7a1d6388007183b7657958a0d32626caea46'/>
<id>e33b7a1d6388007183b7657958a0d32626caea46</id>
<content type='text'>
Fixes #112272

In addition to the implementation of the UAVsAtEveryStage shader flag
analysis, several unrelated tests have had the `dx.valver` module
metadata defined to avoid setting the UAVsAtEveryStage shader flag in
them.
Example:
```
!dx.valver = !{!0}
!0 = !{i32 1, i32 8}
```

---------

Co-authored-by: Justin Bogner &lt;mail@justinbogner.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #112272

In addition to the implementation of the UAVsAtEveryStage shader flag
analysis, several unrelated tests have had the `dx.valver` module
metadata defined to avoid setting the UAVsAtEveryStage shader flag in
them.
Example:
```
!dx.valver = !{!0}
!0 = !{i32 1, i32 8}
```

---------

Co-authored-by: Justin Bogner &lt;mail@justinbogner.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[HLSL][NFC] Rename getBindingMap to getResourceMap and update pass name (#137256)</title>
<updated>2025-04-25T21:30:33+00:00</updated>
<author>
<name>Helena Kotas</name>
<email>hekotas@microsoft.com</email>
</author>
<published>2025-04-25T21:30:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a1decfef3f75286398699573ddf801ec3805e1ee'/>
<id>a1decfef3f75286398699573ddf801ec3805e1ee</id>
<content type='text'>
The DXILResourceMap stores more information about resource instances
than just their binding.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The DXILResourceMap stores more information about resource instances
than just their binding.</pre>
</div>
</content>
</entry>
</feed>
