Skip to content

Commit 7ef6bc3

Browse files
authored
[OPT] Add SPV_KHR_ray_tracing to allow list (#5941)
When adding SPV_KHR_ray_tracing to the allow lists, we missed the list in local-single-store-elim. Adding it now. microsoft/DirectXShaderCompiler#7063
1 parent 1732172 commit 7ef6bc3

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

source/opt/local_single_store_elim_pass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ void LocalSingleStoreElimPass::InitExtensionAllowList() {
145145
"SPV_NV_cooperative_matrix",
146146
"SPV_KHR_cooperative_matrix",
147147
"SPV_KHR_ray_tracing_position_fetch",
148-
"SPV_KHR_fragment_shading_rate"});
148+
"SPV_KHR_fragment_shading_rate",
149+
"SPV_KHR_ray_tracing"});
149150
}
150151
bool LocalSingleStoreElimPass::ProcessVariable(Instruction* var_inst) {
151152
std::vector<Instruction*> users;

test/opt/local_single_store_elim_test.cpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,56 @@ namespace {
2424

2525
using LocalSingleStoreElimTest = PassTest<::testing::Test>;
2626

27+
TEST_F(LocalSingleStoreElimTest, DoSomethingWithExtensions) {
28+
const std::string capabilities_and_extensions =
29+
R"(OpCapability Shader
30+
OpExtension "SPV_EXT_fragment_shader_interlock"
31+
OpExtension "SPV_NV_compute_shader_derivatives"
32+
OpExtension "SPV_KHR_ray_query"
33+
OpExtension "SPV_NV_shader_subgroup_partitioned"
34+
OpExtension "SPV_KHR_ray_tracing"
35+
OpExtension "SPV_EXT_descriptor_indexing"
36+
)";
37+
38+
const std::string before = capabilities_and_extensions +
39+
R"(%1 = OpExtInstImport "GLSL.std.450"
40+
OpMemoryModel Logical GLSL450
41+
OpEntryPoint Fragment %2 "main"
42+
OpExecutionMode %2 OriginUpperLeft
43+
OpSource GLSL 140
44+
%void = OpTypeVoid
45+
%4 = OpTypeFunction %void
46+
%float = OpTypeFloat 32
47+
%_ptr_Function_float = OpTypePointer Function %float
48+
%float_0 = OpConstant %float 0
49+
%2 = OpFunction %void None %4
50+
%8 = OpLabel
51+
%9 = OpVariable %_ptr_Function_float Function
52+
OpStore %9 %float_0
53+
%10 = OpLoad %float %9
54+
OpReturn
55+
OpFunctionEnd
56+
)";
57+
const std::string after = capabilities_and_extensions +
58+
R"(%1 = OpExtInstImport "GLSL.std.450"
59+
OpMemoryModel Logical GLSL450
60+
OpEntryPoint Fragment %2 "main"
61+
OpExecutionMode %2 OriginUpperLeft
62+
OpSource GLSL 140
63+
%void = OpTypeVoid
64+
%4 = OpTypeFunction %void
65+
%float = OpTypeFloat 32
66+
%_ptr_Function_float = OpTypePointer Function %float
67+
%float_0 = OpConstant %float 0
68+
%2 = OpFunction %void None %4
69+
%8 = OpLabel
70+
%9 = OpVariable %_ptr_Function_float Function
71+
OpStore %9 %float_0
72+
OpReturn
73+
OpFunctionEnd
74+
)";
75+
SinglePassRunAndCheck<LocalSingleStoreElimPass>(before, after, true, true);
76+
}
2777
TEST_F(LocalSingleStoreElimTest, PositiveAndNegative) {
2878
// Single store to v is optimized. Multiple store to
2979
// f is not optimized.

0 commit comments

Comments
 (0)