Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaebaek Seo <jaebaek@google.com>2022-01-25 21:14:36 +0300
committerGitHub <noreply@github.com>2022-01-25 21:14:36 +0300
commitfb9a10cd48bc50a37bf2cf9ad260d0b503177069 (patch)
treea2cb332a76ffb6330304bf16cebff7112a79991c /include
parent6938af7f82eb3ccb17131c11f5af6745d346566d (diff)
spirv-opt: add pass to Spread Volatile semantics (#4667)
Add a pass to spread Volatile semantics to variables with SMIDNV, WarpIDNV, SubgroupSize, SubgroupLocalInvocationId, SubgroupEqMask, SubgroupGeMask, SubgroupGtMask, SubgroupLeMask, or SubgroupLtMask BuiltIn decorations or OpLoad for them when the shader model is the ray generation, closest hit, miss, intersection, or callable shaders. This pass can be used for VUID-StandaloneSpirv-VulkanMemoryModel-04678 and VUID-StandaloneSpirv-VulkanMemoryModel-04679 (See "Standalone SPIR-V Validation" section of Vulkan spec "Appendix A: Vulkan Environment for SPIR-V"). Handle variables used by multiple entry points: 1. Update error check to make it working regardless of the order of entry points. 2. For a variable, if it is used by two entry points E1 and E2 and it needs the Volatile semantics for E1 while it does not for E2 - If VulkanMemoryModel capability is enabled, which means we have to set memory operation of load instructions for the variable, we update load instructions in E1, but do not update the ones in E2. - If VulkanMemoryModel capability is disabled, which means we have to add Volatile decoration for the variable, we report an error because E1 needs to add Volatile decoration for the variable while E2 does not. For the simplicity of the implementation, we assume that all functions other than entry point functions are inlined.
Diffstat (limited to 'include')
-rw-r--r--include/spirv-tools/optimizer.hpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/spirv-tools/optimizer.hpp b/include/spirv-tools/optimizer.hpp
index 5d173c111..3e63037c5 100644
--- a/include/spirv-tools/optimizer.hpp
+++ b/include/spirv-tools/optimizer.hpp
@@ -835,6 +835,19 @@ Optimizer::PassToken CreateFixStorageClassPass();
// inclusive.
Optimizer::PassToken CreateGraphicsRobustAccessPass();
+// Create a pass to spread Volatile semantics to variables with SMIDNV,
+// WarpIDNV, SubgroupSize, SubgroupLocalInvocationId, SubgroupEqMask,
+// SubgroupGeMask, SubgroupGtMask, SubgroupLeMask, or SubgroupLtMask BuiltIn
+// decorations or OpLoad for them when the shader model is the ray generation,
+// closest hit, miss, intersection, or callable. This pass can be used for
+// VUID-StandaloneSpirv-VulkanMemoryModel-04678 and
+// VUID-StandaloneSpirv-VulkanMemoryModel-04679 (See "Standalone SPIR-V
+// Validation" section of Vulkan spec "Appendix A: Vulkan Environment for
+// SPIR-V"). When the SPIR-V version is 1.6 or above, the pass also spreads
+// the Volatile semantics to a variable with HelperInvocation BuiltIn decoration
+// in the fragement shader.
+Optimizer::PassToken CreateSpreadVolatileSemanticsPass();
+
// Create a pass to replace a descriptor access using variable index.
// This pass replaces every access using a variable index to array variable
// |desc| that has a DescriptorSet and Binding decorations with a constant