Skip to content

Commit b019b1a

Browse files
committed
shared: fix unused shared memory failing validation
1 parent 6101a19 commit b019b1a

File tree

2 files changed

+18
-32
lines changed

2 files changed

+18
-32
lines changed

crates/rustc_codegen_spirv/src/linker/spirt_passes/explicit_layout.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,7 @@ pub fn erase_when_invalid(module: &mut Module) {
4141
parent_block: None,
4242
};
4343

44-
// Seed the queues starting from the module exports.
45-
for exportee in module.exports.values_mut() {
46-
exportee
47-
.inner_transform_with(&mut eraser)
48-
.apply_to(exportee);
49-
}
44+
eraser.in_place_transform_module(module);
5045

5146
// Process the queues until they're all empty.
5247
while !eraser.global_var_queue.is_empty() || !eraser.func_queue.is_empty() {

tests/compiletests/ui/arch/shared/dce_shared.stderr

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,32 @@ OpName %4 "used_shared"
99
OpName %5 "dce_shared"
1010
OpDecorate %9 Block
1111
OpMemberDecorate %9 0 Offset 0
12-
OpDecorate %10 ArrayStride 4
1312
OpDecorate %2 NonWritable
1413
OpDecorate %2 Binding 0
1514
OpDecorate %2 DescriptorSet 0
1615
OpDecorate %3 Binding 1
1716
OpDecorate %3 DescriptorSet 0
1817
OpDecorate %6 BuiltIn LocalInvocationIndex
19-
%11 = OpTypeFloat 32
20-
%9 = OpTypeStruct %11
21-
%12 = OpTypePointer StorageBuffer %9
22-
%13 = OpTypePointer Workgroup %11
23-
%14 = OpTypeInt 32 1
24-
%15 = OpTypeInt 32 0
25-
%16 = OpConstant %15 2
26-
%10 = OpTypeArray %14 %16
27-
%17 = OpTypePointer Workgroup %10
28-
%18 = OpTypeVector %15 3
18+
%10 = OpTypeFloat 32
19+
%9 = OpTypeStruct %10
20+
%11 = OpTypePointer StorageBuffer %9
21+
%12 = OpTypePointer Workgroup %10
22+
%13 = OpTypeInt 32 1
23+
%14 = OpTypeInt 32 0
24+
%15 = OpConstant %14 2
25+
%16 = OpTypeArray %13 %15
26+
%17 = OpTypePointer Workgroup %16
27+
%18 = OpTypeVector %14 3
2928
%19 = OpTypePointer Input %18
3029
%20 = OpTypeVoid
3130
%21 = OpTypeFunction %20
32-
%22 = OpTypePointer StorageBuffer %11
33-
%2 = OpVariable %12 StorageBuffer
34-
%23 = OpConstant %15 0
35-
%3 = OpVariable %12 StorageBuffer
31+
%22 = OpTypePointer StorageBuffer %10
32+
%2 = OpVariable %11 StorageBuffer
33+
%23 = OpConstant %14 0
34+
%3 = OpVariable %11 StorageBuffer
3635
%6 = OpVariable %19 Input
3736
%24 = OpTypeBool
38-
%4 = OpVariable %13 Workgroup
39-
%25 = OpConstant %15 264
40-
%26 = OpConstant %15 1
37+
%4 = OpVariable %12 Workgroup
38+
%25 = OpConstant %14 264
39+
%26 = OpConstant %14 1
4140
%5 = OpVariable %17 Workgroup
42-
error: error:0:0 - [VUID-StandaloneSpirv-None-10684] Invalid explicit layout decorations on type for operand '17[%_ptr_Workgroup__arr_int_uint_2]'
43-
%dce_shared = OpVariable %_ptr_Workgroup__arr_int_uint_2 Workgroup
44-
|
45-
= note: spirv-val failed
46-
= note: module `$TEST_BUILD_DIR/arch/shared/dce_shared.vulkan1.2`
47-
48-
error: aborting due to 1 previous error
49-

0 commit comments

Comments
 (0)