Skip to content

Commit 6a88007

Browse files
committed
asm vector: fix subgroup_ballot()
1 parent b9251f5 commit 6a88007

9 files changed

+36
-37
lines changed

crates/spirv-std/src/arch/subgroup.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,9 @@ pub fn subgroup_ballot(predicate: bool) -> SubgroupMask {
372372
unsafe {
373373
asm! {
374374
"%u32 = OpTypeInt 32 0",
375-
"%groupmask = OpTypeVector %u32 4",
376375
"%subgroup = OpConstant %u32 {subgroup}",
377376
"%predicate = OpLoad _ {predicate}",
378-
"%result = OpGroupNonUniformBallot %groupmask %subgroup %predicate",
377+
"%result = OpGroupNonUniformBallot typeof*{result} %subgroup %predicate",
379378
"OpStore {result} %result",
380379
subgroup = const SUBGROUP,
381380
predicate = in(reg) &predicate,

tests/compiletests/ui/arch/subgroup/subgroup_ballot.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
%1 = OpFunction %2 None %3
22
%4 = OpFunctionParameter %2
33
%5 = OpLabel
4-
OpLine %6 378 13
4+
OpLine %6 377 13
55
%7 = OpGroupNonUniformBallot %8 %9 %4
6-
OpLine %6 417 13
6+
OpLine %6 416 13
77
%10 = OpGroupNonUniformInverseBallot %2 %9 %7
88
OpNoLine
99
OpReturnValue %10

tests/compiletests/ui/arch/subgroup/subgroup_ballot_bit_count.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%1 = OpFunction %2 None %3
22
%4 = OpFunctionParameter %5
33
%6 = OpLabel
4-
OpLine %7 512 0
4+
OpLine %7 511 0
55
%8 = OpGroupNonUniformBallotBitCount %2 %9 Reduce %4
66
OpNoLine
77
OpReturnValue %8

tests/compiletests/ui/arch/subgroup/subgroup_cluster_size_0_fail.stderr

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
error[E0080]: evaluation panicked: `ClusterSize` must be at least 1
2-
--> $SPIRV_STD_SRC/arch/subgroup.rs:840:1
2+
--> $SPIRV_STD_SRC/arch/subgroup.rs:839:1
33
|
4-
840 | / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
5-
841 | | An integer add group operation of all `value` operands contributed by active invocations in the group.
6-
842 | |
7-
843 | | Result Type must be a scalar or vector of integer type.
4+
839 | / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
5+
840 | | An integer add group operation of all `value` operands contributed by active invocations in the group.
6+
841 | |
7+
842 | | Result Type must be a scalar or vector of integer type.
88
... |
9-
856 | | * `ClusterSize` must not be greater than the size of the group
10-
857 | | ");
9+
855 | | * `ClusterSize` must not be greater than the size of the group
10+
856 | | ");
1111
| |__^ evaluation of `spirv_std::arch::subgroup_clustered_i_add::<0, u32, u32>::{constant#0}` failed here
1212
|
1313
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `macro_subgroup_op_clustered` (in Nightly builds, run with -Z macro-backtrace for more info)
1414

1515
note: erroneous constant encountered
16-
--> $SPIRV_STD_SRC/arch/subgroup.rs:840:1
16+
--> $SPIRV_STD_SRC/arch/subgroup.rs:839:1
1717
|
18-
840 | / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
19-
841 | | An integer add group operation of all `value` operands contributed by active invocations in the group.
20-
842 | |
21-
843 | | Result Type must be a scalar or vector of integer type.
18+
839 | / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
19+
840 | | An integer add group operation of all `value` operands contributed by active invocations in the group.
20+
841 | |
21+
842 | | Result Type must be a scalar or vector of integer type.
2222
... |
23-
856 | | * `ClusterSize` must not be greater than the size of the group
24-
857 | | ");
23+
855 | | * `ClusterSize` must not be greater than the size of the group
24+
856 | | ");
2525
| |__^
2626
|
2727
= note: this note originates in the macro `macro_subgroup_op_clustered` (in Nightly builds, run with -Z macro-backtrace for more info)

tests/compiletests/ui/arch/subgroup/subgroup_cluster_size_non_power_of_two_fail.stderr

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
error[E0080]: evaluation panicked: `ClusterSize` must be a power of 2
2-
--> $SPIRV_STD_SRC/arch/subgroup.rs:840:1
2+
--> $SPIRV_STD_SRC/arch/subgroup.rs:839:1
33
|
4-
840 | / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
5-
841 | | An integer add group operation of all `value` operands contributed by active invocations in the group.
6-
842 | |
7-
843 | | Result Type must be a scalar or vector of integer type.
4+
839 | / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
5+
840 | | An integer add group operation of all `value` operands contributed by active invocations in the group.
6+
841 | |
7+
842 | | Result Type must be a scalar or vector of integer type.
88
... |
9-
856 | | * `ClusterSize` must not be greater than the size of the group
10-
857 | | ");
9+
855 | | * `ClusterSize` must not be greater than the size of the group
10+
856 | | ");
1111
| |__^ evaluation of `spirv_std::arch::subgroup_clustered_i_add::<5, u32, u32>::{constant#0}` failed here
1212
|
1313
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `macro_subgroup_op_clustered` (in Nightly builds, run with -Z macro-backtrace for more info)
1414

1515
note: erroneous constant encountered
16-
--> $SPIRV_STD_SRC/arch/subgroup.rs:840:1
16+
--> $SPIRV_STD_SRC/arch/subgroup.rs:839:1
1717
|
18-
840 | / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
19-
841 | | An integer add group operation of all `value` operands contributed by active invocations in the group.
20-
842 | |
21-
843 | | Result Type must be a scalar or vector of integer type.
18+
839 | / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
19+
840 | | An integer add group operation of all `value` operands contributed by active invocations in the group.
20+
841 | |
21+
842 | | Result Type must be a scalar or vector of integer type.
2222
... |
23-
856 | | * `ClusterSize` must not be greater than the size of the group
24-
857 | | ");
23+
855 | | * `ClusterSize` must not be greater than the size of the group
24+
856 | | ");
2525
| |__^
2626
|
2727
= note: this note originates in the macro `macro_subgroup_op_clustered` (in Nightly builds, run with -Z macro-backtrace for more info)

tests/compiletests/ui/arch/subgroup/subgroup_i_add_clustered.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%1 = OpFunction %2 None %3
22
%4 = OpFunctionParameter %2
33
%5 = OpLabel
4-
OpLine %6 840 0
4+
OpLine %6 839 0
55
%7 = OpGroupNonUniformIAdd %2 %8 ClusteredReduce %4 %9
66
OpNoLine
77
OpReturnValue %7

tests/compiletests/ui/arch/subgroup/subgroup_i_add_exclusive_scan.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%1 = OpFunction %2 None %3
22
%4 = OpFunctionParameter %2
33
%5 = OpLabel
4-
OpLine %6 827 0
4+
OpLine %6 826 0
55
%7 = OpGroupNonUniformIAdd %2 %8 ExclusiveScan %4
66
OpNoLine
77
OpReturnValue %7

tests/compiletests/ui/arch/subgroup/subgroup_i_add_inclusive_scan.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%1 = OpFunction %2 None %3
22
%4 = OpFunctionParameter %2
33
%5 = OpLabel
4-
OpLine %6 827 0
4+
OpLine %6 826 0
55
%7 = OpGroupNonUniformIAdd %2 %8 InclusiveScan %4
66
OpNoLine
77
OpReturnValue %7

tests/compiletests/ui/arch/subgroup/subgroup_i_add_reduce.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%1 = OpFunction %2 None %3
22
%4 = OpFunctionParameter %2
33
%5 = OpLabel
4-
OpLine %6 827 0
4+
OpLine %6 826 0
55
%7 = OpGroupNonUniformIAdd %2 %8 Reduce %4
66
OpNoLine
77
OpReturnValue %7

0 commit comments

Comments
 (0)