Skip to content

[DirectX] Revise descriptions of DXIL module flags #133543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions llvm/include/llvm/BinaryFormat/DXContainerConstants.def
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does CS4 mean/denote? We are also not currently checking for it in the FileCheck

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A Compute Shader in Shader Model 4.x.

Clang isn't going to support SM 4.x (AFAIK), so there shouldn't be a need to test for it.

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")
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-cs.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-lib.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/ShaderFlags/low-precision.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/ShaderFlags/res-may-alias-0.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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
;

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/ShaderFlags/res-may-alias-1.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions llvm/test/ObjectYAML/DXContainer/DomainMaskVectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Parts:
AtomicInt64OnHeapResource: false
AdvancedTextureOps: false
WriteableMSAATextures: false
SampleCmpWithGradientOrBias: false
ExtendedCommandInfo: false
NextUnusedBit: false
- Name: ISG1
Size: 52
Expand Down
2 changes: 2 additions & 0 deletions llvm/test/ObjectYAML/DXContainer/GeometryMaskVectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Parts:
AtomicInt64OnHeapResource: false
AdvancedTextureOps: false
WriteableMSAATextures: false
SampleCmpWithGradientOrBias: false
ExtendedCommandInfo: false
NextUnusedBit: false
- Name: ISG1
Size: 120
Expand Down
2 changes: 2 additions & 0 deletions llvm/test/ObjectYAML/DXContainer/HullMaskVectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Parts:
AtomicInt64OnHeapResource: false
AdvancedTextureOps: false
WriteableMSAATextures: false
SampleCmpWithGradientOrBias: false
ExtendedCommandInfo: false
NextUnusedBit: false
- Name: ISG1
Size: 60
Expand Down
4 changes: 4 additions & 0 deletions llvm/test/tools/obj2yaml/DXContainer/ShaderFlags.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Parts:
AtomicInt64OnHeapResource: false
AdvancedTextureOps: true
WriteableMSAATextures: false
SampleCmpWithGradientOrBias: false
ExtendedCommandInfo: false
NextUnusedBit: true
- Name: FKE0
Size: 8
Expand Down Expand Up @@ -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
2 changes: 2 additions & 0 deletions llvm/test/tools/obj2yaml/DXContainer/ShaderFlagsEmpty.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Parts:
AtomicInt64OnHeapResource: false
AdvancedTextureOps: false
WriteableMSAATextures: false
SampleCmpWithGradientOrBias: false
ExtendedCommandInfo: false
NextUnusedBit: false
- Name: FKE0
Size: 8
Expand Down
Loading