<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/test/CodeGen/DirectX/ShaderFlags, branch users/nico/python-2</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] Diagnose overlapping resource bindings (#140982)</title>
<updated>2025-05-30T20:22:25+00:00</updated>
<author>
<name>Helena Kotas</name>
<email>hekotas@microsoft.com</email>
</author>
<published>2025-05-30T20:22:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8eadbea8e3aac52608880f0e0ae64e8403f2609f'/>
<id>8eadbea8e3aac52608880f0e0ae64e8403f2609f</id>
<content type='text'>
Adds reporting of overlapping binding errors to `DXILPostOptimizationValidation` pass. Only runs when `DXILResourceBindingAnalysis` detects that there is a resource binding that overlaps while it is building up a map of available register spaces.

Fixes #110723</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Adds reporting of overlapping binding errors to `DXILPostOptimizationValidation` pass. Only runs when `DXILResourceBindingAnalysis` detects that there is a resource binding that overlaps while it is building up a map of available register spaces.

Fixes #110723</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] Add resource name argument to llvm.dx.handlefrom[implicit]binding intrinsics (#139991)</title>
<updated>2025-05-28T05:57:01+00:00</updated>
<author>
<name>Helena Kotas</name>
<email>hekotas@microsoft.com</email>
</author>
<published>2025-05-28T05:57:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=27675ccdd6315b560f5f90db34f6a4520fa26b6b'/>
<id>27675ccdd6315b560f5f90db34f6a4520fa26b6b</id>
<content type='text'>
Adds resource name argument to `llvm.dx.handlefrombinding` and `llvm.dx.handlefromimplicitbinding` intrinsics.
SPIR-V currently does not seem to need the resource names so this change only affects DirectX binding intrinsics.

Part 2/4 of https://github.com/llvm/llvm-project/issues/105059</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Adds resource name argument to `llvm.dx.handlefrombinding` and `llvm.dx.handlefromimplicitbinding` intrinsics.
SPIR-V currently does not seem to need the resource names so this change only affects DirectX binding intrinsics.

Part 2/4 of https://github.com/llvm/llvm-project/issues/105059</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>[DirectX] Revise descriptions of DXIL module flags (#133543)</title>
<updated>2025-04-29T16:08:12+00:00</updated>
<author>
<name>Deric C.</name>
<email>cheung.deric@gmail.com</email>
</author>
<published>2025-04-29T16:08:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=ad66e5495d598c9f64cfafba92ba48f2a24b8278'/>
<id>ad66e5495d598c9f64cfafba92ba48f2a24b8278</id>
<content type='text'>
This PR revises the descriptions of DXIL module flags.

Descriptions such as `D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION` are
referring to Global Flags in DXBC.
DXBC is not a supported backend target, so references to DXBC should not
be present.

There is also confusion with regards to the description of the
`LowPrecisionPresent` DXIL module flag, which currently reads
`D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION` and implies the use of
minimum-precision to handle 16-bit types.
However this is not true, because both the flags `LowPrecisionPresent`
and `UseNativeLowPrecision` can simultaneously be set in the same DXIL
module, and minimum precision mode is mutually exclusive with native low
precision.
This PR revises the description of the `LowPrecisionPresent` flag to
accurately describe what it represents.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR revises the descriptions of DXIL module flags.

Descriptions such as `D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION` are
referring to Global Flags in DXBC.
DXBC is not a supported backend target, so references to DXBC should not
be present.

There is also confusion with regards to the description of the
`LowPrecisionPresent` DXIL module flag, which currently reads
`D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION` and implies the use of
minimum-precision to handle 16-bit types.
However this is not true, because both the flags `LowPrecisionPresent`
and `UseNativeLowPrecision` can simultaneously be set in the same DXIL
module, and minimum precision mode is mutually exclusive with native low
precision.
This PR revises the description of the `LowPrecisionPresent` flag to
accurately describe what it represents.</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] Fix shader flag version-checking logic to match DXC (#136787)</title>
<updated>2025-04-25T18:21:28+00:00</updated>
<author>
<name>Deric C.</name>
<email>cheung.deric@gmail.com</email>
</author>
<published>2025-04-25T18:21:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=3e4e365fac0503d9fcd9bb34ee1c27bf17d95e3a'/>
<id>3e4e365fac0503d9fcd9bb34ee1c27bf17d95e3a</id>
<content type='text'>
This PR primarily fixes the version-checking logic of the shader flags
`ResMayNotAlias` and `Max64UAVs` to correctly match DXC's behavior.

Primary changes:

- The logic for determining the presence of UAVs for the
`ResMayNotAlias` shader flag checked against the DXIL Version when it
should have been checking against the DXIL Validator Version. (See DXC:
[DxilShaderFlags.cpp#L484](https://github.com/microsoft/DirectXShaderCompiler/blob/f19b5da54170210e3cbc7f080be3f080abc52505/lib/DXIL/DxilShaderFlags.cpp#L484))

- The logic for counting UAVs for the `Max64UAVs` shader flag checked
against the DXIL Version when it should have been checking against the
DXIL Validator Version. (See DXC:
[DxilModule.cpp#L327](https://github.com/microsoft/DirectXShaderCompiler/blob/f19b5da54170210e3cbc7f080be3f080abc52505/lib/DXIL/DxilModule.cpp#L327))

- Tests have been modified to test the corrected behaviors for these two
flags

Additional changes included for consistency:

- The logic for setting `UseNativeLowPrecision` now checks against
Shader Model version instead of DXIL version to be consistent with the
code comments from DXC
([DxilShaderFlags.h#L280](https://github.com/microsoft/DirectXShaderCompiler/blob/f19b5da54170210e3cbc7f080be3f080abc52505/include/dxc/DXIL/DxilShaderFlags.h#L280)).

- An additional test has been added to ensure that the module flag
"dx.nativelowprec" set to 0 does not apply the `UseNativeLowPrecision`
shader flag

- Related shader flag tests were renamed to be more consistent, and some
comments were edited for clarification

- Add obj2yaml tests for the `Max64UAVs` shader flag</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR primarily fixes the version-checking logic of the shader flags
`ResMayNotAlias` and `Max64UAVs` to correctly match DXC's behavior.

Primary changes:

- The logic for determining the presence of UAVs for the
`ResMayNotAlias` shader flag checked against the DXIL Version when it
should have been checking against the DXIL Validator Version. (See DXC:
[DxilShaderFlags.cpp#L484](https://github.com/microsoft/DirectXShaderCompiler/blob/f19b5da54170210e3cbc7f080be3f080abc52505/lib/DXIL/DxilShaderFlags.cpp#L484))

- The logic for counting UAVs for the `Max64UAVs` shader flag checked
against the DXIL Version when it should have been checking against the
DXIL Validator Version. (See DXC:
[DxilModule.cpp#L327](https://github.com/microsoft/DirectXShaderCompiler/blob/f19b5da54170210e3cbc7f080be3f080abc52505/lib/DXIL/DxilModule.cpp#L327))

- Tests have been modified to test the corrected behaviors for these two
flags

Additional changes included for consistency:

- The logic for setting `UseNativeLowPrecision` now checks against
Shader Model version instead of DXIL version to be consistent with the
code comments from DXC
([DxilShaderFlags.h#L280](https://github.com/microsoft/DirectXShaderCompiler/blob/f19b5da54170210e3cbc7f080be3f080abc52505/include/dxc/DXIL/DxilShaderFlags.h#L280)).

- An additional test has been added to ensure that the module flag
"dx.nativelowprec" set to 0 does not apply the `UseNativeLowPrecision`
shader flag

- Related shader flag tests were renamed to be more consistent, and some
comments were edited for clarification

- Add obj2yaml tests for the `Max64UAVs` shader flag</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] Implement Max64UAVs shader flag analysis (#136229)</title>
<updated>2025-04-22T16:35:34+00:00</updated>
<author>
<name>Deric C.</name>
<email>cheung.deric@gmail.com</email>
</author>
<published>2025-04-22T16:35:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0eba8cbef6a196d5373de17d8844487daf27656a'/>
<id>0eba8cbef6a196d5373de17d8844487daf27656a</id>
<content type='text'>
Fixes [#114553](https://github.com/llvm/llvm-project/issues/114553)

This implementation replicates the behavior of DXC in setting the
`m_b64UAVs` flag: the `Max64UAVs` DXIL module flag is set in the
presence of more than 8 UAVs in a DXIL module.

The behavior of how UAV (resource) arrays are counted differs based on
Shader Model version:
- If Shader Model &lt; 6.6, then a UAV array counts as a single UAV
regardless of its range size
- if Shader Model &gt;= 6.6, then a UAV array contributes its range size to
the total number of UAVs

I initially thought the complete implementation of this analysis may be
blocked by the resource arrays implementation, but it seems that it is
not the case, as the `@llvm.dx.resource.handle*` already includes a
range size argument.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes [#114553](https://github.com/llvm/llvm-project/issues/114553)

This implementation replicates the behavior of DXC in setting the
`m_b64UAVs` flag: the `Max64UAVs` DXIL module flag is set in the
presence of more than 8 UAVs in a DXIL module.

The behavior of how UAV (resource) arrays are counted differs based on
Shader Model version:
- If Shader Model &lt; 6.6, then a UAV array counts as a single UAV
regardless of its range size
- if Shader Model &gt;= 6.6, then a UAV array contributes its range size to
the total number of UAVs

I initially thought the complete implementation of this analysis may be
blocked by the resource arrays implementation, but it seems that it is
not the case, as the `@llvm.dx.resource.handle*` already includes a
range size argument.</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] Implement Shader Flags Analysis for ResMayNotAlias (#131070)</title>
<updated>2025-04-10T23:06:48+00:00</updated>
<author>
<name>Deric C.</name>
<email>cheung.deric@gmail.com</email>
</author>
<published>2025-04-10T23:06:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=727f3921e7af7a4b0f1e59635ebb99a52bd173c3'/>
<id>727f3921e7af7a4b0f1e59635ebb99a52bd173c3</id>
<content type='text'>
Fixes #112270

Completed ACs:
- `-res-may-alias` clang-dxc command-line option added
  - It inserts and sets a module metadata flag `dx.resmayalias` to 1
- Shader flag set appropriately:
- The flag IS NOT set if DXIL Version &lt;= 1.6 OR the command-line option
`-res-may-alias` is specified
  - Otherwise the flag IS set when:
    - DXIL Version &gt; 1.7 AND function uses UAVs, OR
    - DXIL Version &lt;= 1.7 AND UAVs present globally
- Add tests 
- Tests for Shader Models 6.6, 6.7, and 6.8 corresponding to DXIL
Versions 1.6, 1.7, and 1.8
- Tests (`res-may-alias-0.ll`/`res-may-alias-1.ll`) for when the module
metadata flag `dx.resmayalias` is set to 0 or 1 respectively
- A frontend test (`res-may-alias.hlsl`) for testing that that the
command-line option `-res-may-alias` inserts `dx.resmayalias` module
metadata correctly</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #112270

Completed ACs:
- `-res-may-alias` clang-dxc command-line option added
  - It inserts and sets a module metadata flag `dx.resmayalias` to 1
- Shader flag set appropriately:
- The flag IS NOT set if DXIL Version &lt;= 1.6 OR the command-line option
`-res-may-alias` is specified
  - Otherwise the flag IS set when:
    - DXIL Version &gt; 1.7 AND function uses UAVs, OR
    - DXIL Version &lt;= 1.7 AND UAVs present globally
- Add tests 
- Tests for Shader Models 6.6, 6.7, and 6.8 corresponding to DXIL
Versions 1.6, 1.7, and 1.8
- Tests (`res-may-alias-0.ll`/`res-may-alias-1.ll`) for when the module
metadata flag `dx.resmayalias` is set to 0 or 1 respectively
- A frontend test (`res-may-alias.hlsl`) for testing that that the
command-line option `-res-may-alias` inserts `dx.resmayalias` module
metadata correctly</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] Implement UseNativeLowPrecision shader flag analysis (#134288)</title>
<updated>2025-04-10T01:14:23+00:00</updated>
<author>
<name>Deric C.</name>
<email>cheung.deric@gmail.com</email>
</author>
<published>2025-04-10T01:14:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=747d4a952bf7ed4adec72ddf3c9038aeff4fe8ee'/>
<id>747d4a952bf7ed4adec72ddf3c9038aeff4fe8ee</id>
<content type='text'>
Fixes #112267 

Implement the shader flag analysis to set the UseNativeLowPrecision DXIL
module flag.

The flag is only able to be set when the command-line flag
`-enable-16bit-types` is passed to clang-dxc, or equivalently
`-fnative-half-type` is passed to clang.
When the command-line flag is passed, a module metadata flag called
"dx.nativelowprec" is set to 1.
The DXILShaderFlags shader flags analysis checks that the module
metadata flag "dx.nativelowprec" is set to 1 and the DXIL Version is 1.2
or greater before setting the UseNativeLowPrecision DXIL module flag.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #112267 

Implement the shader flag analysis to set the UseNativeLowPrecision DXIL
module flag.

The flag is only able to be set when the command-line flag
`-enable-16bit-types` is passed to clang-dxc, or equivalently
`-fnative-half-type` is passed to clang.
When the command-line flag is passed, a module metadata flag called
"dx.nativelowprec" is set to 1.
The DXILShaderFlags shader flags analysis checks that the module
metadata flag "dx.nativelowprec" is set to 1 and the DXIL Version is 1.2
or greater before setting the UseNativeLowPrecision DXIL module flag.</pre>
</div>
</content>
</entry>
</feed>
