[llvm] [DirectX] [NFC] Revise descriptions of DXIL module flags (PR #133543)
Deric C. via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 2 10:49:44 PDT 2025
https://github.com/Icohedron updated https://github.com/llvm/llvm-project/pull/133543
>From bc1bd787251114ff4b5cd755ffa066617ba32667 Mon Sep 17 00:00:00 2001
From: Icohedron <cheung.deric at gmail.com>
Date: Fri, 28 Mar 2025 21:27:19 +0000
Subject: [PATCH 1/4] [NFC] Revise descriptions of DXIL module flags
---
.../llvm/BinaryFormat/DXContainerConstants.def | 16 ++++++++--------
.../DirectX/ShaderFlags/disable-opt-cs.ll | 2 +-
.../DirectX/ShaderFlags/disable-opt-lib.ll | 2 +-
.../CodeGen/DirectX/ShaderFlags/low-precision.ll | 2 +-
.../ShaderFlags/raw-and-structured-buffers.ll | 2 +-
5 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
index 6d44ea14df444..8bf7048df1b56 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")
@@ -76,13 +76,13 @@ ROOT_ELEMENT_FLAG(11, SamplerHeapDirectlyIndexed)
#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")
+DXIL_MODULE_FLAG(23, UseNativeLowPrecision, "Native 16-bit types enabled")
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 fd25a165bfe8d..73f1d5d2456af 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/low-precision.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/low-precision.ll
@@ -8,7 +8,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" {
>From 86d19701f27e28cb7e6602efa26f9b46e0523abd Mon Sep 17 00:00:00 2001
From: Icohedron <cheung.deric at gmail.com>
Date: Wed, 2 Apr 2025 00:44:48 +0000
Subject: [PATCH 2/4] Update flags to match documentation in DXC
---
.../BinaryFormat/DXContainerConstants.def | 44 ++++++++++---------
llvm/lib/Target/DirectX/DXILShaderFlags.cpp | 4 +-
.../ShaderFlags/double-extensions-obj-test.ll | 2 +-
.../DirectX/ShaderFlags/double-extensions.ll | 4 +-
.../CodeGen/DirectX/ShaderFlags/int64ops.ll | 2 +-
.../propagate-function-flags-test.ll | 4 +-
.../typed-uav-load-additional-formats.ll | 2 +-
.../CodeGen/DirectX/ShaderFlags/wave-ops.ll | 2 +-
8 files changed, 33 insertions(+), 31 deletions(-)
diff --git a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
index 8bf7048df1b56..9d1dea546f99c 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
+++ b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
@@ -21,34 +21,36 @@ SHADER_FEATURE_FLAG(1, 17, ComputeShadersPlusRawAndStructuredBuffers, "CS4 raw
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")
-SHADER_FEATURE_FLAG(5, 6, DX11_1_DoubleExtensions, "Double-precision extensions for 11.1")
-SHADER_FEATURE_FLAG(6, 7, DX11_1_ShaderExtensions, "Shader extensions for 11.1")
+SHADER_FEATURE_FLAG(5, 6, DoubleExtensions, "Double-precision extensions")
+SHADER_FEATURE_FLAG(6, 7, EnableMSAD, "Masked sum of absolute differences")
SHADER_FEATURE_FLAG(7, 14, LEVEL9ComparisonFiltering, "Comparison filtering for feature level 9")
SHADER_FEATURE_FLAG(8, 12, TiledResources, "Tiled resources")
-SHADER_FEATURE_FLAG(9, 11, StencilRef, "PS Output Stencil Ref")
-SHADER_FEATURE_FLAG(10, 10, InnerCoverage, "PS Inner Coverage")
-SHADER_FEATURE_FLAG(11, 13, TypedUAVLoadAdditionalFormats, "Typed UAV Load Additional Formats")
-SHADER_FEATURE_FLAG(12, 18, ROVs, "Raster Ordered UAVs")
-SHADER_FEATURE_FLAG(13, 9, ViewportAndRTArrayIndexFromAnyShaderFeedingRasterizer, "SV_RenderTargetArrayIndex or SV_ViewportArrayIndex from any shader feeding rasterizer")
-SHADER_FEATURE_FLAG(14, 19, WaveOps, "Wave level operations")
-SHADER_FEATURE_FLAG(15, 20, Int64Ops, "64-Bit integer")
-SHADER_FEATURE_FLAG(16, 21, ViewID, "View Instancing")
+SHADER_FEATURE_FLAG(9, 11, StencilRef, "Stencil reference value")
+SHADER_FEATURE_FLAG(10, 10, InnerCoverage, "Inner coverage")
+SHADER_FEATURE_FLAG(11, 13, TypedUAVLoadAdditionalFormats, "Typed UAV load additional formats")
+SHADER_FEATURE_FLAG(12, 18, ROVs, "Rasterizer order views")
+SHADER_FEATURE_FLAG(13, 9, ViewportAndRTArrayIndexFromAnyShaderFeedingRasterizer, "View port or render target array index from any shader feeding rasterizer")
+SHADER_FEATURE_FLAG(14, 19, WaveOps, "Wave-level operations")
+SHADER_FEATURE_FLAG(15, 20, Int64Ops, "64-bit integers")
+SHADER_FEATURE_FLAG(16, 21, ViewID, "View instancing")
SHADER_FEATURE_FLAG(17, 22, Barycentrics, "Barycentrics")
-SHADER_FEATURE_FLAG(18, -1, NativeLowPrecision, "Use native low precision")
-SHADER_FEATURE_FLAG(19, 24, ShadingRate, "Shading Rate")
+SHADER_FEATURE_FLAG(18, -1, NativeLowPrecision, "Use native low-precision data types")
+SHADER_FEATURE_FLAG(19, 24, ShadingRate, "Variable-rate shading")
SHADER_FEATURE_FLAG(20, 25, Raytracing_Tier_1_1, "Raytracing tier 1.1 features")
SHADER_FEATURE_FLAG(21, 26, SamplerFeedback, "Sampler feedback")
-SHADER_FEATURE_FLAG(22, 27, AtomicInt64OnTypedResource, "64-bit Atomics on Typed Resources")
-SHADER_FEATURE_FLAG(23, 28, AtomicInt64OnGroupShared, "64-bit Atomics on Group Shared")
+SHADER_FEATURE_FLAG(22, 27, AtomicInt64OnTypedResource, "64-bit integer atomics on typed resources")
+SHADER_FEATURE_FLAG(23, 28, AtomicInt64OnGroupShared, "64-bit integer atomics on group shared")
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(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(27, 36, RESERVED, "<RESERVED>")
+SHADER_FEATURE_FLAG(28, 32, AtomicInt64OnHeapResource, "64-bit integer atomics on descriptor heap resources")
+SHADER_FEATURE_FLAG(29, 34, AdvancedTextureOps, "Advanced texture operations")
+SHADER_FEATURE_FLAG(30, 35, WriteableMSAATextures, "Writeable MSAA textures")
+SHADER_FEATURE_FLAG(31, 37, ExtendedComparisonSampling, "Expanded comparison sampling")
+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
@@ -81,8 +83,8 @@ 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")
-DXIL_MODULE_FLAG(23, UseNativeLowPrecision, "Native 16-bit types enabled")
+DXIL_MODULE_FLAG( 8, AllResourcesBound, "All resources bound for the duration of shader execution")
+DXIL_MODULE_FLAG(23, UseNativeLowPrecision, "Use native low-precision data types")
DXIL_MODULE_FLAG(33, ResMayNotAlias, "Any UAV may not alias any other UAV")
#undef DXIL_MODULE_FLAG
diff --git a/llvm/lib/Target/DirectX/DXILShaderFlags.cpp b/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
index babf495220393..36e1fa309b61c 100644
--- a/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
+++ b/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
@@ -94,7 +94,7 @@ void ModuleShaderFlags::updateFunctionFlags(ComputedShaderFlags &CSF,
case Instruction::SIToFP:
case Instruction::FPToUI:
case Instruction::FPToSI:
- CSF.DX11_1_DoubleExtensions = true;
+ CSF.DoubleExtensions = true;
break;
}
}
@@ -154,7 +154,7 @@ void ModuleShaderFlags::updateFunctionFlags(ComputedShaderFlags &CSF,
if (FunctionFlags.contains(CF))
CSF.merge(FunctionFlags[CF]);
- // TODO: Set DX11_1_DoubleExtensions if I is a call to DXIL intrinsic
+ // TODO: Set DoubleExtensions if I is a call to DXIL intrinsic
// DXIL::Opcode::Fma https://github.com/llvm/llvm-project/issues/114554
CSF.WaveOps |= checkWaveOps(CI->getIntrinsicID());
diff --git a/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions-obj-test.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions-obj-test.ll
index 02a4c2090499a..6cfc72f94452f 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions-obj-test.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions-obj-test.ll
@@ -12,5 +12,5 @@ attributes #0 = { convergent norecurse nounwind "hlsl.export"}
; CHECK-NEXT: Size: 8
; CHECK-NEXT: Flags:
; CHECK: Doubles: true
-; CHECK: DX11_1_DoubleExtensions: true
+; CHECK: DoubleExtensions: true
diff --git a/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll
index dd8ea5f5b1aec..250ab534c39e3 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll
@@ -7,8 +7,8 @@ target triple = "dxil-pc-shadermodel6.7-library"
; CHECK: ; Note: shader requires additional functionality:
; CHECK-NEXT: ; Double-precision floating point
-; CHECK-NEXT: ; Double-precision extensions for 11.1
-; CHECK-NEXT: ; 64-Bit integer
+; CHECK-NEXT: ; Double-precision extensions
+; CHECK-NEXT: ; 64-bit integer
; CHECK-NEXT: ; Note: extra DXIL module flags:
; CHECK-NEXT: ;
; CHECK-NEXT: ; Shader Flags for Module Functions
diff --git a/llvm/test/CodeGen/DirectX/ShaderFlags/int64ops.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/int64ops.ll
index 320c775e7130e..e142a609fe8a8 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/int64ops.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/int64ops.ll
@@ -7,7 +7,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
;CHECK-NEXT: ; Shader Flags Value: 0x00100000
;CHECK-NEXT: ;
;CHECK-NEXT: ; Note: shader requires additional functionality:
-;CHECK-NEXT: ; 64-Bit integer
+;CHECK-NEXT: ; 64-bit integer
;CHECK-NEXT: ; Note: extra DXIL module flags:
;CHECK-NEXT: ;
;CHECK-NEXT: ; Shader Flags for Module Functions
diff --git a/llvm/test/CodeGen/DirectX/ShaderFlags/propagate-function-flags-test.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/propagate-function-flags-test.ll
index 8dee842e85e44..e90e5bcb8cdb7 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/propagate-function-flags-test.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/propagate-function-flags-test.ll
@@ -7,8 +7,8 @@ target triple = "dxil-pc-shadermodel6.7-library"
; CHECK-NEXT: ;
; CHECK-NEXT: ; Note: shader requires additional functionality:
; CHECK-NEXT: ; Double-precision floating point
-; CHECK-NEXT: ; Double-precision extensions for 11.1
-; CHECK-NEXT: ; 64-Bit integer
+; CHECK-NEXT: ; Double-precision extensions
+; CHECK-NEXT: ; 64-bit integer
; CHECK-NEXT: ; Note: extra DXIL module flags:
; CHECK-NEXT: ;
; CHECK-NEXT: ; Shader Flags for Module Functions
diff --git a/llvm/test/CodeGen/DirectX/ShaderFlags/typed-uav-load-additional-formats.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/typed-uav-load-additional-formats.ll
index 060d54f961c70..ac931cea4fad0 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/typed-uav-load-additional-formats.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/typed-uav-load-additional-formats.ll
@@ -11,7 +11,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
; CHECK-NEXT: Shader Flags Value: 0x00002000
; CHECK: Note: shader requires additional functionality:
-; CHECK: Typed UAV Load Additional Formats
+; CHECK: Typed UAV load additional formats
; CHECK: Function multicomponent : 0x00002000
define <4 x float> @multicomponent() #0 {
diff --git a/llvm/test/CodeGen/DirectX/ShaderFlags/wave-ops.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/wave-ops.ll
index 7a876f67615cd..e78718e212993 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/wave-ops.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/wave-ops.ll
@@ -5,7 +5,7 @@
;
; CHECK: ; Shader Flags Value: [[WAVE_FLAG:0x00080000]]
; CHECK: ; Note: shader requires additional functionality:
-; CHECK-NEXT: ; Wave level operations
+; CHECK-NEXT: ; Wave-level operations
; CHECK-NEXT: ; Note: extra DXIL module flags:
target triple = "dxil-pc-shadermodel6.7-library"
>From a6aed2bdc1ce6373f9c59163dafc5198cf0c0169 Mon Sep 17 00:00:00 2001
From: Icohedron <cheung.deric at gmail.com>
Date: Wed, 2 Apr 2025 17:43:46 +0000
Subject: [PATCH 3/4] Revert "Update flags to match documentation in DXC"
This reverts commit 86d19701f27e28cb7e6602efa26f9b46e0523abd.
---
.../BinaryFormat/DXContainerConstants.def | 44 +++++++++----------
llvm/lib/Target/DirectX/DXILShaderFlags.cpp | 4 +-
.../ShaderFlags/double-extensions-obj-test.ll | 2 +-
.../DirectX/ShaderFlags/double-extensions.ll | 4 +-
.../CodeGen/DirectX/ShaderFlags/int64ops.ll | 2 +-
.../propagate-function-flags-test.ll | 4 +-
.../typed-uav-load-additional-formats.ll | 2 +-
.../CodeGen/DirectX/ShaderFlags/wave-ops.ll | 2 +-
8 files changed, 31 insertions(+), 33 deletions(-)
diff --git a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
index 9d1dea546f99c..8bf7048df1b56 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
+++ b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
@@ -21,36 +21,34 @@ SHADER_FEATURE_FLAG(1, 17, ComputeShadersPlusRawAndStructuredBuffers, "CS4 raw
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")
-SHADER_FEATURE_FLAG(5, 6, DoubleExtensions, "Double-precision extensions")
-SHADER_FEATURE_FLAG(6, 7, EnableMSAD, "Masked sum of absolute differences")
+SHADER_FEATURE_FLAG(5, 6, DX11_1_DoubleExtensions, "Double-precision extensions for 11.1")
+SHADER_FEATURE_FLAG(6, 7, DX11_1_ShaderExtensions, "Shader extensions for 11.1")
SHADER_FEATURE_FLAG(7, 14, LEVEL9ComparisonFiltering, "Comparison filtering for feature level 9")
SHADER_FEATURE_FLAG(8, 12, TiledResources, "Tiled resources")
-SHADER_FEATURE_FLAG(9, 11, StencilRef, "Stencil reference value")
-SHADER_FEATURE_FLAG(10, 10, InnerCoverage, "Inner coverage")
-SHADER_FEATURE_FLAG(11, 13, TypedUAVLoadAdditionalFormats, "Typed UAV load additional formats")
-SHADER_FEATURE_FLAG(12, 18, ROVs, "Rasterizer order views")
-SHADER_FEATURE_FLAG(13, 9, ViewportAndRTArrayIndexFromAnyShaderFeedingRasterizer, "View port or render target array index from any shader feeding rasterizer")
-SHADER_FEATURE_FLAG(14, 19, WaveOps, "Wave-level operations")
-SHADER_FEATURE_FLAG(15, 20, Int64Ops, "64-bit integers")
-SHADER_FEATURE_FLAG(16, 21, ViewID, "View instancing")
+SHADER_FEATURE_FLAG(9, 11, StencilRef, "PS Output Stencil Ref")
+SHADER_FEATURE_FLAG(10, 10, InnerCoverage, "PS Inner Coverage")
+SHADER_FEATURE_FLAG(11, 13, TypedUAVLoadAdditionalFormats, "Typed UAV Load Additional Formats")
+SHADER_FEATURE_FLAG(12, 18, ROVs, "Raster Ordered UAVs")
+SHADER_FEATURE_FLAG(13, 9, ViewportAndRTArrayIndexFromAnyShaderFeedingRasterizer, "SV_RenderTargetArrayIndex or SV_ViewportArrayIndex from any shader feeding rasterizer")
+SHADER_FEATURE_FLAG(14, 19, WaveOps, "Wave level operations")
+SHADER_FEATURE_FLAG(15, 20, Int64Ops, "64-Bit integer")
+SHADER_FEATURE_FLAG(16, 21, ViewID, "View Instancing")
SHADER_FEATURE_FLAG(17, 22, Barycentrics, "Barycentrics")
-SHADER_FEATURE_FLAG(18, -1, NativeLowPrecision, "Use native low-precision data types")
-SHADER_FEATURE_FLAG(19, 24, ShadingRate, "Variable-rate shading")
+SHADER_FEATURE_FLAG(18, -1, NativeLowPrecision, "Use native low precision")
+SHADER_FEATURE_FLAG(19, 24, ShadingRate, "Shading Rate")
SHADER_FEATURE_FLAG(20, 25, Raytracing_Tier_1_1, "Raytracing tier 1.1 features")
SHADER_FEATURE_FLAG(21, 26, SamplerFeedback, "Sampler feedback")
-SHADER_FEATURE_FLAG(22, 27, AtomicInt64OnTypedResource, "64-bit integer atomics on typed resources")
-SHADER_FEATURE_FLAG(23, 28, AtomicInt64OnGroupShared, "64-bit integer atomics on group shared")
+SHADER_FEATURE_FLAG(22, 27, AtomicInt64OnTypedResource, "64-bit Atomics on Typed Resources")
+SHADER_FEATURE_FLAG(23, 28, AtomicInt64OnGroupShared, "64-bit Atomics on Group Shared")
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, 36, RESERVED, "<RESERVED>")
-SHADER_FEATURE_FLAG(28, 32, AtomicInt64OnHeapResource, "64-bit integer atomics on descriptor heap resources")
-SHADER_FEATURE_FLAG(29, 34, AdvancedTextureOps, "Advanced texture operations")
-SHADER_FEATURE_FLAG(30, 35, WriteableMSAATextures, "Writeable MSAA textures")
-SHADER_FEATURE_FLAG(31, 37, ExtendedComparisonSampling, "Expanded comparison sampling")
-SHADER_FEATURE_FLAG(32, 38, ExtendedCommandInfo, "Extended command information")
+SHADER_FEATURE_FLAG(27, 63, 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(33, 39, NextUnusedBit, "Next reserved shader flag bit (not a flag)")
+SHADER_FEATURE_FLAG(31, 36, NextUnusedBit, "Next reserved shader flag bit (not a flag)")
#undef SHADER_FEATURE_FLAG
#endif // SHADER_FEATURE_FLAG
@@ -83,8 +81,8 @@ 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 data types")
+DXIL_MODULE_FLAG( 8, AllResourcesBound, "All resources bound")
+DXIL_MODULE_FLAG(23, UseNativeLowPrecision, "Native 16-bit types enabled")
DXIL_MODULE_FLAG(33, ResMayNotAlias, "Any UAV may not alias any other UAV")
#undef DXIL_MODULE_FLAG
diff --git a/llvm/lib/Target/DirectX/DXILShaderFlags.cpp b/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
index 36e1fa309b61c..babf495220393 100644
--- a/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
+++ b/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
@@ -94,7 +94,7 @@ void ModuleShaderFlags::updateFunctionFlags(ComputedShaderFlags &CSF,
case Instruction::SIToFP:
case Instruction::FPToUI:
case Instruction::FPToSI:
- CSF.DoubleExtensions = true;
+ CSF.DX11_1_DoubleExtensions = true;
break;
}
}
@@ -154,7 +154,7 @@ void ModuleShaderFlags::updateFunctionFlags(ComputedShaderFlags &CSF,
if (FunctionFlags.contains(CF))
CSF.merge(FunctionFlags[CF]);
- // TODO: Set DoubleExtensions if I is a call to DXIL intrinsic
+ // TODO: Set DX11_1_DoubleExtensions if I is a call to DXIL intrinsic
// DXIL::Opcode::Fma https://github.com/llvm/llvm-project/issues/114554
CSF.WaveOps |= checkWaveOps(CI->getIntrinsicID());
diff --git a/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions-obj-test.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions-obj-test.ll
index 6cfc72f94452f..02a4c2090499a 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions-obj-test.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions-obj-test.ll
@@ -12,5 +12,5 @@ attributes #0 = { convergent norecurse nounwind "hlsl.export"}
; CHECK-NEXT: Size: 8
; CHECK-NEXT: Flags:
; CHECK: Doubles: true
-; CHECK: DoubleExtensions: true
+; CHECK: DX11_1_DoubleExtensions: true
diff --git a/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll
index 250ab534c39e3..dd8ea5f5b1aec 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll
@@ -7,8 +7,8 @@ target triple = "dxil-pc-shadermodel6.7-library"
; CHECK: ; Note: shader requires additional functionality:
; CHECK-NEXT: ; Double-precision floating point
-; CHECK-NEXT: ; Double-precision extensions
-; CHECK-NEXT: ; 64-bit integer
+; CHECK-NEXT: ; Double-precision extensions for 11.1
+; CHECK-NEXT: ; 64-Bit integer
; CHECK-NEXT: ; Note: extra DXIL module flags:
; CHECK-NEXT: ;
; CHECK-NEXT: ; Shader Flags for Module Functions
diff --git a/llvm/test/CodeGen/DirectX/ShaderFlags/int64ops.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/int64ops.ll
index e142a609fe8a8..320c775e7130e 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/int64ops.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/int64ops.ll
@@ -7,7 +7,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
;CHECK-NEXT: ; Shader Flags Value: 0x00100000
;CHECK-NEXT: ;
;CHECK-NEXT: ; Note: shader requires additional functionality:
-;CHECK-NEXT: ; 64-bit integer
+;CHECK-NEXT: ; 64-Bit integer
;CHECK-NEXT: ; Note: extra DXIL module flags:
;CHECK-NEXT: ;
;CHECK-NEXT: ; Shader Flags for Module Functions
diff --git a/llvm/test/CodeGen/DirectX/ShaderFlags/propagate-function-flags-test.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/propagate-function-flags-test.ll
index e90e5bcb8cdb7..8dee842e85e44 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/propagate-function-flags-test.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/propagate-function-flags-test.ll
@@ -7,8 +7,8 @@ target triple = "dxil-pc-shadermodel6.7-library"
; CHECK-NEXT: ;
; CHECK-NEXT: ; Note: shader requires additional functionality:
; CHECK-NEXT: ; Double-precision floating point
-; CHECK-NEXT: ; Double-precision extensions
-; CHECK-NEXT: ; 64-bit integer
+; CHECK-NEXT: ; Double-precision extensions for 11.1
+; CHECK-NEXT: ; 64-Bit integer
; CHECK-NEXT: ; Note: extra DXIL module flags:
; CHECK-NEXT: ;
; CHECK-NEXT: ; Shader Flags for Module Functions
diff --git a/llvm/test/CodeGen/DirectX/ShaderFlags/typed-uav-load-additional-formats.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/typed-uav-load-additional-formats.ll
index ac931cea4fad0..060d54f961c70 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/typed-uav-load-additional-formats.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/typed-uav-load-additional-formats.ll
@@ -11,7 +11,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
; CHECK-NEXT: Shader Flags Value: 0x00002000
; CHECK: Note: shader requires additional functionality:
-; CHECK: Typed UAV load additional formats
+; CHECK: Typed UAV Load Additional Formats
; CHECK: Function multicomponent : 0x00002000
define <4 x float> @multicomponent() #0 {
diff --git a/llvm/test/CodeGen/DirectX/ShaderFlags/wave-ops.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/wave-ops.ll
index e78718e212993..7a876f67615cd 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/wave-ops.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/wave-ops.ll
@@ -5,7 +5,7 @@
;
; CHECK: ; Shader Flags Value: [[WAVE_FLAG:0x00080000]]
; CHECK: ; Note: shader requires additional functionality:
-; CHECK-NEXT: ; Wave-level operations
+; CHECK-NEXT: ; Wave level operations
; CHECK-NEXT: ; Note: extra DXIL module flags:
target triple = "dxil-pc-shadermodel6.7-library"
>From c41732379bc135d583b9059303854cae7aec7321 Mon Sep 17 00:00:00 2001
From: Icohedron <cheung.deric at gmail.com>
Date: Wed, 2 Apr 2025 17:49:27 +0000
Subject: [PATCH 4/4] Update flags to match the bits and descriptions in the
DXC documentation
---
.../include/llvm/BinaryFormat/DXContainerConstants.def | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
index 8bf7048df1b56..a2401d5315657 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
+++ b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
@@ -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, ExtendedComparisonSampling, "Expanded comparison sampling")
+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
@@ -81,8 +83,8 @@ 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")
-DXIL_MODULE_FLAG(23, UseNativeLowPrecision, "Native 16-bit types enabled")
+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
More information about the llvm-commits
mailing list