Skip to content

Commit 6e9d60d

Browse files
authored
Optimize SPV_EXT_opacity_micromap and SPV_EXT_shader_invocation_reorder (KhronosGroup#6571)
It's been a while since I last added extensions to these lists, but I just ran into a long-forgotten related issue again that DXC outputs invalid SPIR-V before it's stripped away by `spirv-opt`: microsoft/DirectXShaderCompiler#8210. Shaders with these extensions weren't yet extensively tested but this at least gets us past `spir-val` in both DXC (can also be disabled with `-Vd`) and the validation layers. --- I'm probably way out of my league to ask, but is there still much significance to `extensions_allowlist_`? It seems like a maintenance burden that's very easy to miss, for (currently) a single extension that's specifically commented out to not be optimized. It's also mostly duplicated but not entirely in sync across all 4 passes either. I even noticed that `SPV_KHR_shader_clock` which **I added** to `dead_code_elim_pass` in KhronosGroup#4049 isn't in any other file, which must have been an oversight on my part but also means that presence of this extension erroneously disables all the other 3 passes.
1 parent 40093b5 commit 6e9d60d

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

source/opt/aggressive_dead_code_elim_pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,13 +1137,13 @@ void AggressiveDCEPass::InitExtensions() {
11371137
"SPV_KHR_physical_storage_buffer",
11381138
"SPV_KHR_terminate_invocation",
11391139
"SPV_KHR_shader_clock",
1140-
"SPV_KHR_vulkan_memory_model",
11411140
"SPV_KHR_subgroup_uniform_control_flow",
11421141
"SPV_KHR_integer_dot_product",
11431142
"SPV_EXT_shader_image_int64",
11441143
"SPV_KHR_non_semantic_info",
11451144
"SPV_KHR_uniform_group_instructions",
11461145
"SPV_KHR_fragment_shader_barycentric",
1146+
"SPV_KHR_vulkan_memory_model",
11471147
"SPV_NV_bindless_texture",
11481148
"SPV_EXT_shader_atomic_float_add",
11491149
"SPV_EXT_fragment_shader_interlock",
@@ -1158,6 +1158,8 @@ void AggressiveDCEPass::InitExtensions() {
11581158
"SPV_NV_linear_swept_spheres",
11591159
"SPV_KHR_maximal_reconvergence",
11601160
"SPV_NV_push_constant_bank",
1161+
"SPV_EXT_opacity_micromap",
1162+
"SPV_EXT_shader_invocation_reorder",
11611163
});
11621164
}
11631165

source/opt/local_access_chain_convert_pass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ void LocalAccessChainConvertPass::InitExtensions() {
448448
"SPV_KHR_ray_query",
449449
"SPV_EXT_fragment_invocation_density",
450450
"SPV_KHR_terminate_invocation",
451+
"SPV_KHR_shader_clock",
451452
"SPV_KHR_subgroup_uniform_control_flow",
452453
"SPV_KHR_integer_dot_product",
453454
"SPV_EXT_shader_image_int64",
@@ -470,6 +471,8 @@ void LocalAccessChainConvertPass::InitExtensions() {
470471
"SPV_NV_linear_swept_spheres",
471472
"SPV_KHR_maximal_reconvergence",
472473
"SPV_NV_push_constant_bank",
474+
"SPV_EXT_opacity_micromap",
475+
"SPV_EXT_shader_invocation_reorder",
473476
});
474477
}
475478

source/opt/local_single_block_elim_pass.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ void LocalSingleBlockLoadStoreElimPass::InitExtensions() {
241241
"SPV_AMD_gcn_shader",
242242
"SPV_KHR_shader_ballot",
243243
"SPV_AMD_shader_ballot",
244-
"SPV_AMDX_shader_enqueue",
245244
"SPV_AMD_gpu_shader_half_float",
246245
"SPV_KHR_shader_draw_parameters",
247246
"SPV_KHR_subgroup_vote",
@@ -286,6 +285,7 @@ void LocalSingleBlockLoadStoreElimPass::InitExtensions() {
286285
"SPV_EXT_physical_storage_buffer",
287286
"SPV_KHR_physical_storage_buffer",
288287
"SPV_KHR_terminate_invocation",
288+
"SPV_KHR_shader_clock",
289289
"SPV_KHR_subgroup_uniform_control_flow",
290290
"SPV_KHR_integer_dot_product",
291291
"SPV_EXT_shader_image_int64",
@@ -300,13 +300,16 @@ void LocalSingleBlockLoadStoreElimPass::InitExtensions() {
300300
"SPV_NV_cooperative_matrix",
301301
"SPV_KHR_cooperative_matrix",
302302
"SPV_KHR_ray_tracing_position_fetch",
303+
"SPV_AMDX_shader_enqueue",
303304
"SPV_KHR_fragment_shading_rate",
304305
"SPV_KHR_quad_control",
305306
"SPV_NV_shader_invocation_reorder",
306307
"SPV_NV_cluster_acceleration_structure",
307308
"SPV_NV_linear_swept_spheres",
308309
"SPV_KHR_maximal_reconvergence",
309310
"SPV_NV_push_constant_bank",
311+
"SPV_EXT_opacity_micromap",
312+
"SPV_EXT_shader_invocation_reorder",
310313
});
311314
}
312315

source/opt/local_single_store_elim_pass.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ void LocalSingleStoreElimPass::InitExtensionAllowList() {
120120
"SPV_AMD_gpu_shader_half_float_fetch",
121121
"SPV_GOOGLE_decorate_string",
122122
"SPV_GOOGLE_hlsl_functionality1",
123+
"SPV_GOOGLE_user_type",
123124
"SPV_NV_shader_subgroup_partitioned",
124125
"SPV_EXT_descriptor_indexing",
125126
"SPV_EXT_descriptor_heap",
@@ -130,11 +131,13 @@ void LocalSingleStoreElimPass::InitExtensionAllowList() {
130131
"SPV_NV_mesh_shader",
131132
"SPV_EXT_mesh_shader",
132133
"SPV_NV_ray_tracing",
134+
"SPV_KHR_ray_tracing",
133135
"SPV_KHR_ray_query",
134136
"SPV_EXT_fragment_invocation_density",
135137
"SPV_EXT_physical_storage_buffer",
136138
"SPV_KHR_physical_storage_buffer",
137139
"SPV_KHR_terminate_invocation",
140+
"SPV_KHR_shader_clock",
138141
"SPV_KHR_subgroup_uniform_control_flow",
139142
"SPV_KHR_integer_dot_product",
140143
"SPV_EXT_shader_image_int64",
@@ -151,14 +154,14 @@ void LocalSingleStoreElimPass::InitExtensionAllowList() {
151154
"SPV_KHR_ray_tracing_position_fetch",
152155
"SPV_AMDX_shader_enqueue",
153156
"SPV_KHR_fragment_shading_rate",
154-
"SPV_KHR_ray_tracing",
155157
"SPV_KHR_quad_control",
156-
"SPV_GOOGLE_user_type",
157158
"SPV_NV_shader_invocation_reorder",
158159
"SPV_NV_cluster_acceleration_structure",
159160
"SPV_NV_linear_swept_spheres",
160161
"SPV_KHR_maximal_reconvergence",
161162
"SPV_NV_push_constant_bank",
163+
"SPV_EXT_opacity_micromap",
164+
"SPV_EXT_shader_invocation_reorder",
162165
});
163166
}
164167
bool LocalSingleStoreElimPass::ProcessVariable(Instruction* var_inst) {

0 commit comments

Comments
 (0)