[llvm] ad66e54 - [DirectX] Revise descriptions of DXIL module flags (#133543)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 29 09:08:16 PDT 2025


Author: Deric C.
Date: 2025-04-29T09:08:12-07:00
New Revision: ad66e5495d598c9f64cfafba92ba48f2a24b8278

URL: https://github.com/llvm/llvm-project/commit/ad66e5495d598c9f64cfafba92ba48f2a24b8278
DIFF: https://github.com/llvm/llvm-project/commit/ad66e5495d598c9f64cfafba92ba48f2a24b8278.diff

LOG: [DirectX] Revise descriptions of DXIL module flags (#133543)

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.

Added: 
    

Modified: 
    llvm/include/llvm/BinaryFormat/DXContainerConstants.def
    llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-cs.ll
    llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-lib.ll
    llvm/test/CodeGen/DirectX/ShaderFlags/low-precision.ll
    llvm/test/CodeGen/DirectX/ShaderFlags/raw-and-structured-buffers.ll
    llvm/test/CodeGen/DirectX/ShaderFlags/res-may-alias-0.ll
    llvm/test/CodeGen/DirectX/ShaderFlags/res-may-alias-1.ll
    llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-sm6.6.ll
    llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-sm6.7.ll
    llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-valver1.8.ll
    llvm/test/CodeGen/DirectX/ShaderFlags/use-native-low-precision-0.ll
    llvm/test/CodeGen/DirectX/ShaderFlags/use-native-low-precision-1.ll
    llvm/test/ObjectYAML/DXContainer/DomainMaskVectors.yaml
    llvm/test/ObjectYAML/DXContainer/GeometryMaskVectors.yaml
    llvm/test/ObjectYAML/DXContainer/HullMaskVectors.yaml
    llvm/test/tools/obj2yaml/DXContainer/ShaderFlags.yaml
    llvm/test/tools/obj2yaml/DXContainer/ShaderFlagsEmpty.yaml

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
index 590ded5e8c899..a00c13ca1cb5f 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
+++ b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
@@ -17,7 +17,7 @@ CONTAINER_PART(PSG1)
 // SHADER_FEATURE_FLAG(bit offset for the shader info flag, bit offset for DXIL module flag, name, description.
 
 SHADER_FEATURE_FLAG(0,   2, Doubles, "Double-precision floating point")
-SHADER_FEATURE_FLAG(1,  17, ComputeShadersPlusRawAndStructuredBuffers, "Raw and Structured buffers")
+SHADER_FEATURE_FLAG(1,  17, ComputeShadersPlusRawAndStructuredBuffers, "CS4 raw and structured buffers")
 SHADER_FEATURE_FLAG(2,  16, UAVsAtEveryStage, "UAVs at every shader stage")
 SHADER_FEATURE_FLAG(3,  15, Max64UAVs, "64 UAV slots")
 SHADER_FEATURE_FLAG(4,  -1, MinimumPrecision, "Minimum-precision data types")
@@ -43,12 +43,14 @@ SHADER_FEATURE_FLAG(23, 28, AtomicInt64OnGroupShared, "64-bit Atomics on Group S
 SHADER_FEATURE_FLAG(24, 29, DerivativesInMeshAndAmpShaders, "Derivatives in mesh and amplification shaders")
 SHADER_FEATURE_FLAG(25, 30, ResourceDescriptorHeapIndexing, "Resource descriptor heap indexing")
 SHADER_FEATURE_FLAG(26, 31, SamplerDescriptorHeapIndexing, "Sampler descriptor heap indexing")
-SHADER_FEATURE_FLAG(27, 63, RESERVED, "<RESERVED>")
+SHADER_FEATURE_FLAG(27, 36, RESERVED, "<RESERVED>")
 SHADER_FEATURE_FLAG(28, 32, AtomicInt64OnHeapResource, "64-bit Atomics on Heap Resources")
 SHADER_FEATURE_FLAG(29, 34, AdvancedTextureOps, "Advanced Texture Ops")
 SHADER_FEATURE_FLAG(30, 35, WriteableMSAATextures, "Writeable MSAA Textures")
+SHADER_FEATURE_FLAG(31, 37, SampleCmpWithGradientOrBias, "SampleCmp with gradient or bias")
+SHADER_FEATURE_FLAG(32, 38, ExtendedCommandInfo, "Extended command information")
 
-SHADER_FEATURE_FLAG(31, 36, NextUnusedBit, "Next reserved shader flag bit (not a flag)")
+SHADER_FEATURE_FLAG(33, 39, NextUnusedBit, "Next reserved shader flag bit (not a flag)")
 
 #undef SHADER_FEATURE_FLAG
 #endif // SHADER_FEATURE_FLAG
@@ -94,13 +96,13 @@ SHADER_VISIBILITY(7, Mesh)
 #ifdef DXIL_MODULE_FLAG
 
 // Only save DXIL module flags which not map to feature flags here.
-DXIL_MODULE_FLAG( 0,  DisableOptimizations,   "D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION")
-DXIL_MODULE_FLAG( 1,  DisableMathRefactoring, "D3D10_SB_GLOBAL_FLAG_REFACTORING_ALLOWED")
-DXIL_MODULE_FLAG( 3,  ForceEarlyDepthStencil, "D3D11_SB_GLOBAL_FLAG_FORCE_EARLY_DEPTH_STENCIL")
-DXIL_MODULE_FLAG( 4,  EnableRawAndStructuredBuffers, "Raw and Structured buffers")
-DXIL_MODULE_FLAG( 5,  LowPrecisionPresent, "D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION")
-DXIL_MODULE_FLAG( 8,  AllResourcesBound, "D3D12_SB_GLOBAL_FLAG_ALL_RESOURCES_BOUND")
-DXIL_MODULE_FLAG(23,  UseNativeLowPrecision, "Native 16bit types enabled")
+DXIL_MODULE_FLAG( 0,  DisableOptimizations,   "Disable shader optimizations")
+DXIL_MODULE_FLAG( 1,  DisableMathRefactoring, "Disable math refactoring")
+DXIL_MODULE_FLAG( 3,  ForceEarlyDepthStencil, "Force early depth-stencil test")
+DXIL_MODULE_FLAG( 4,  EnableRawAndStructuredBuffers, "Raw and structured buffers")
+DXIL_MODULE_FLAG( 5,  LowPrecisionPresent, "Low-precision data types")
+DXIL_MODULE_FLAG( 8,  AllResourcesBound, "All resources bound for the duration of shader execution")
+DXIL_MODULE_FLAG(23,  UseNativeLowPrecision, "Use native low precision")
 DXIL_MODULE_FLAG(33,  ResMayNotAlias, "Any UAV may not alias any other UAV")
 
 #undef DXIL_MODULE_FLAG

diff  --git a/llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-cs.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-cs.ll
index 421c8b67350c2..8bf242fdbec67 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-cs.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-cs.ll
@@ -5,7 +5,7 @@
 ; CHECK-NEXT: ; Shader Flags Value: 0x00000001
 
 ; CHECK: ; Note: extra DXIL module flags:
-; CHECK-NEXT: ;       D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION
+; CHECK-NEXT: ;       Disable shader optimizations
 
 ; CHECK: ; Shader Flags for Module Functions
 ; CHECK: ; Function main : 0x00000000

diff  --git a/llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-lib.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-lib.ll
index 240bd314cd1b2..3bf582cc2e255 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-lib.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-lib.ll
@@ -5,7 +5,7 @@
 ; CHECK-NEXT: ; Shader Flags Value: 0x00000001
 
 ; CHECK: ; Note: extra DXIL module flags:
-; CHECK-NEXT: ;       D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION
+; CHECK-NEXT: ;       Disable shader optimizations
 
 ; CHECK: ; Shader Flags for Module Functions
 ; CHECK: ; Function main : 0x00000000

diff  --git a/llvm/test/CodeGen/DirectX/ShaderFlags/low-precision.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/low-precision.ll
index 52e00b107bb82..561e09bb1e9dc 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/low-precision.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/low-precision.ll
@@ -7,7 +7,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
 ;CHECK-NEXT: ;
 ;CHECK-NEXT: ; Note: shader requires additional functionality:
 ;CHECK-NEXT: ; Note: extra DXIL module flags:
-;CHECK-NEXT: ;       D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION
+;CHECK-NEXT: ;       Low-precision data types
 ;CHECK-NEXT: ;
 ;CHECK-NEXT: ; Shader Flags for Module Functions
 

diff  --git a/llvm/test/CodeGen/DirectX/ShaderFlags/raw-and-structured-buffers.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/raw-and-structured-buffers.ll
index 9cb83c4e992ba..03112b60c8811 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/raw-and-structured-buffers.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/raw-and-structured-buffers.ll
@@ -9,7 +9,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
 ; CHECK-NEXT: Shader Flags Value: 0x00000010
 
 ; CHECK: Note: shader requires additional functionality:
-; CHECK:       Raw and Structured buffers
+; CHECK:       Raw and structured buffers
 
 ; CHECK: Function rawbuf : 0x00000010
 define float @rawbuf() "hlsl.export" {

diff  --git a/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-alias-0.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-alias-0.ll
index 77d80470d6501..c934af62f4c9b 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-alias-0.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-alias-0.ll
@@ -10,7 +10,7 @@ target triple = "dxil-pc-shadermodel6.8-library"
 ; CHECK-NEXT: Shader Flags Value: 0x200000010
 
 ; CHECK: Note: extra DXIL module flags:
-; CHECK:       Raw and Structured buffers
+; CHECK:       Raw and structured buffers
 ; CHECK:       Any UAV may not alias any other UAV
 ;
 

diff  --git a/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-alias-1.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-alias-1.ll
index edd3250a2db0d..4c75c7886e776 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-alias-1.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-alias-1.ll
@@ -10,7 +10,7 @@ target triple = "dxil-pc-shadermodel6.8-library"
 ; CHECK-NEXT: Shader Flags Value: 0x00000010
 
 ; CHECK: Note: extra DXIL module flags:
-; CHECK:       Raw and Structured buffers
+; CHECK:       Raw and structured buffers
 ; CHECK-NOT:   Any UAV may not alias any other UAV
 ;
 

diff  --git a/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-sm6.6.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-sm6.6.ll
index e7828c6569912..9dba2b7f98c3b 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-sm6.6.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-sm6.6.ll
@@ -10,7 +10,7 @@ target triple = "dxil-pc-shadermodel6.6-library"
 ; CHECK-NEXT: Shader Flags Value: 0x00000010
 
 ; CHECK: Note: extra DXIL module flags:
-; CHECK:       Raw and Structured buffers
+; CHECK:       Raw and structured buffers
 ; CHECK-NOT:   Any UAV may not alias any other UAV
 ;
 

diff  --git a/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-sm6.7.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-sm6.7.ll
index da75a3dfc7cd5..ce4b4d499da72 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-sm6.7.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-sm6.7.ll
@@ -11,7 +11,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
 ; CHECK-NEXT: Shader Flags Value: 0x200000010
 
 ; CHECK: Note: extra DXIL module flags:
-; CHECK:       Raw and Structured buffers
+; CHECK:       Raw and structured buffers
 ; CHECK:       Any UAV may not alias any other UAV
 ;
 

diff  --git a/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-valver1.8.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-valver1.8.ll
index a5be9f5bc69a9..4ba74a1a9ff28 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-valver1.8.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-valver1.8.ll
@@ -11,7 +11,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
 ; CHECK-NEXT: Shader Flags Value: 0x200000010
 
 ; CHECK: Note: extra DXIL module flags:
-; CHECK:       Raw and Structured buffers
+; CHECK:       Raw and structured buffers
 ; CHECK:       Any UAV may not alias any other UAV
 ;
 

diff  --git a/llvm/test/CodeGen/DirectX/ShaderFlags/use-native-low-precision-0.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/use-native-low-precision-0.ll
index 4c9040706189d..c537a01482f39 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/use-native-low-precision-0.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/use-native-low-precision-0.ll
@@ -10,7 +10,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
 ;CHECK-NEXT: ;
 ;CHECK-NEXT: ; Note: shader requires additional functionality:
 ;CHECK-NEXT: ; Note: extra DXIL module flags:
-;CHECK-NEXT: ;       D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION
+;CHECK-NEXT: ;       Low-precision data types
 ;CHECK-NOT:  ;       Native 16bit types enabled
 ;CHECK-NEXT: ;
 ;CHECK-NEXT: ; Shader Flags for Module Functions

diff  --git a/llvm/test/CodeGen/DirectX/ShaderFlags/use-native-low-precision-1.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/use-native-low-precision-1.ll
index 98e9a5fa7b241..07c4b9064d666 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/use-native-low-precision-1.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/use-native-low-precision-1.ll
@@ -7,8 +7,8 @@ target triple = "dxil-pc-shadermodel6.7-library"
 ;CHECK-NEXT: ;
 ;CHECK-NEXT: ; Note: shader requires additional functionality:
 ;CHECK-NEXT: ; Note: extra DXIL module flags:
-;CHECK-NEXT: ;       D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION
-;CHECK-NEXT: ;       Native 16bit types enabled
+;CHECK-NEXT: ;       Low-precision data types
+;CHECK-NEXT: ;       Use native low precision
 ;CHECK-NEXT: ;
 ;CHECK-NEXT: ; Shader Flags for Module Functions
 

diff  --git a/llvm/test/ObjectYAML/DXContainer/DomainMaskVectors.yaml b/llvm/test/ObjectYAML/DXContainer/DomainMaskVectors.yaml
index 1a2f341f03ef7..18eeb8a03cfb0 100644
--- a/llvm/test/ObjectYAML/DXContainer/DomainMaskVectors.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/DomainMaskVectors.yaml
@@ -44,6 +44,8 @@ Parts:
       AtomicInt64OnHeapResource: false
       AdvancedTextureOps: false
       WriteableMSAATextures: false
+      SampleCmpWithGradientOrBias: false
+      ExtendedCommandInfo: false
       NextUnusedBit:   false
   - Name:            ISG1
     Size:            52

diff  --git a/llvm/test/ObjectYAML/DXContainer/GeometryMaskVectors.yaml b/llvm/test/ObjectYAML/DXContainer/GeometryMaskVectors.yaml
index bf29d0866b362..ffbc375ce7529 100644
--- a/llvm/test/ObjectYAML/DXContainer/GeometryMaskVectors.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/GeometryMaskVectors.yaml
@@ -44,6 +44,8 @@ Parts:
       AtomicInt64OnHeapResource: false
       AdvancedTextureOps: false
       WriteableMSAATextures: false
+      SampleCmpWithGradientOrBias: false
+      ExtendedCommandInfo: false
       NextUnusedBit:   false
   - Name:            ISG1
     Size:            120

diff  --git a/llvm/test/ObjectYAML/DXContainer/HullMaskVectors.yaml b/llvm/test/ObjectYAML/DXContainer/HullMaskVectors.yaml
index 0eaa2f8e97fb9..4885d70b47b64 100644
--- a/llvm/test/ObjectYAML/DXContainer/HullMaskVectors.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/HullMaskVectors.yaml
@@ -44,6 +44,8 @@ Parts:
       AtomicInt64OnHeapResource: false
       AdvancedTextureOps: false
       WriteableMSAATextures: false
+      SampleCmpWithGradientOrBias: false
+      ExtendedCommandInfo: false
       NextUnusedBit:   false
   - Name:            ISG1
     Size:            60

diff  --git a/llvm/test/tools/obj2yaml/DXContainer/ShaderFlags.yaml b/llvm/test/tools/obj2yaml/DXContainer/ShaderFlags.yaml
index 165b397c14577..0ed21dfca31df 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/ShaderFlags.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/ShaderFlags.yaml
@@ -44,6 +44,8 @@ Parts:
       AtomicInt64OnHeapResource: false
       AdvancedTextureOps: true
       WriteableMSAATextures: false
+      SampleCmpWithGradientOrBias: false
+      ExtendedCommandInfo: false
       NextUnusedBit:   true
   - Name:            FKE0
     Size:            8
@@ -84,4 +86,6 @@ Parts:
 # CHECK-NEXT:       AtomicInt64OnHeapResource: false
 # CHECK-NEXT:       AdvancedTextureOps: true
 # CHECK-NEXT:       WriteableMSAATextures: false
+# CHECK-NEXT:       SampleCmpWithGradientOrBias: false
+# CHECK-NEXT:       ExtendedCommandInfo: false
 # CHECK-NEXT:       NextUnusedBit:   true

diff  --git a/llvm/test/tools/obj2yaml/DXContainer/ShaderFlagsEmpty.yaml b/llvm/test/tools/obj2yaml/DXContainer/ShaderFlagsEmpty.yaml
index 086c7e90dcd5f..a8bd5aaa6be59 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/ShaderFlagsEmpty.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/ShaderFlagsEmpty.yaml
@@ -43,6 +43,8 @@ Parts:
       AtomicInt64OnHeapResource: false
       AdvancedTextureOps: false
       WriteableMSAATextures: false
+      SampleCmpWithGradientOrBias: false
+      ExtendedCommandInfo: false
       NextUnusedBit:   false
   - Name:            FKE0
     Size:            8


        


More information about the llvm-commits mailing list