[llvm] [DirectX] [NFC] Revise descriptions of DXIL module flags (PR #133543)
Deric C. via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 28 16:41:10 PDT 2025
https://github.com/Icohedron created https://github.com/llvm/llvm-project/pull/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.
>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] [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" {
More information about the llvm-commits
mailing list