Skip to content

Commit 9f6726c

Browse files
committed
subgroup: don't special case ClusteredReduce anymore
1 parent 61e696a commit 9f6726c

9 files changed

+18
-21
lines changed

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ pub enum GroupOperation {
2828
/// A binary operation with an identity I and n (where n is the size of the workgroup)
2929
/// elements[a0, a1, … an-1] resulting in [I, a0, (a0 op a1), … (a0 op a1 op … op an-2)].
3030
ExclusiveScan = 2,
31-
// /// See [`GROUP_OPERATION_CLUSTERED_REDUCE`]
32-
// ClusteredReduce = 3,
31+
/// The [`GroupOperation`] `ClusteredReduce`.
32+
///
33+
/// All instructions with a [`GroupOperation`] require an additional `ClusterSize` parameter when [`GroupOperation`] is
34+
/// `ClusteredReduce`. To map this requirement into rust, all function have a base version accepting [`GroupOperation`]
35+
/// as a const generic, and a `_clustered` variant that is fixed to `ClusteredReduce` and takes the additional
36+
/// `ClusterSize` parameter as a const generic. To not accidentally use a `ClusteredReduce` in the base variant of the
37+
/// function, it was removed from the [`GroupOperation`] enum and instead resides individually.
38+
ClusteredReduce = 3,
3339
/// Reserved.
3440
///
3541
/// Requires Capability `GroupNonUniformPartitionedNV`.
@@ -44,15 +50,6 @@ pub enum GroupOperation {
4450
PartitionedExclusiveScanNV = 8,
4551
}
4652

47-
/// The [`GroupOperation`] `ClusteredReduce`.
48-
///
49-
/// All instructions with a [`GroupOperation`] require an additional `ClusterSize` parameter when [`GroupOperation`] is
50-
/// `ClusteredReduce`. To map this requirement into rust, all function have a base version accepting [`GroupOperation`]
51-
/// as a const generic, and a `_clustered` variant that is fixed to `ClusteredReduce` and takes the additional
52-
/// `ClusterSize` parameter as a const generic. To not accidentally use a `ClusteredReduce` in the base variant of the
53-
/// function, it was removed from the [`GroupOperation`] enum and instead resides individually.
54-
pub const GROUP_OPERATION_CLUSTERED_REDUCE: u32 = 3;
55-
5653
/// Only usable if the extension GL_KHR_shader_subgroup_basic is enabled.
5754
///
5855
/// The function subgroupBarrier() enforces that all active invocations within a
@@ -780,7 +777,7 @@ macro_rules! macro_subgroup_op_clustered {
780777
concat!("%result = ", $asm_op, " _ %subgroup {groupop} %value %clustersize"),
781778
"OpStore {result} %result",
782779
subgroup = const SUBGROUP,
783-
groupop = const GROUP_OPERATION_CLUSTERED_REDUCE,
780+
groupop = const (GroupOperation::ClusteredReduce as u32),
784781
clustersize = const CLUSTER_SIZE,
785782
value = in(reg) &value,
786783
result = in(reg) &mut result,

tests/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 379 8
4+
OpLine %6 376 8
55
%7 = OpGroupNonUniformBallot %8 %9 %4
6-
OpLine %6 415 8
6+
OpLine %6 412 8
77
%10 = OpGroupNonUniformInverseBallot %2 %9 %7
88
OpNoLine
99
OpReturnValue %10

tests/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 511 0
4+
OpLine %7 508 0
55
%8 = OpGroupNonUniformBallotBitCount %2 %9 Reduce %4
66
OpNoLine
77
OpReturnValue %8

tests/ui/arch/subgroup/subgroup_broadcast_first.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 346 8
4+
OpLine %6 343 8
55
%7 = OpGroupNonUniformBroadcastFirst %2 %8 %4
66
OpNoLine
77
OpReturnValue %7

tests/ui/arch/subgroup/subgroup_elect.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%1 = OpFunction %2 None %3
22
%4 = OpLabel
3-
OpLine %5 181 8
3+
OpLine %5 178 8
44
%6 = OpGroupNonUniformElect %2 %7
55
OpNoLine
66
OpReturnValue %6

tests/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 809 0
4+
OpLine %6 806 0
55
%7 = OpGroupNonUniformIAdd %2 %8 ClusteredReduce %4 %9
66
OpNoLine
77
OpReturnValue %7

tests/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 796 0
4+
OpLine %6 793 0
55
%7 = OpGroupNonUniformIAdd %2 %8 ExclusiveScan %4
66
OpNoLine
77
OpReturnValue %7

tests/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 796 0
4+
OpLine %6 793 0
55
%7 = OpGroupNonUniformIAdd %2 %8 InclusiveScan %4
66
OpNoLine
77
OpReturnValue %7

tests/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 796 0
4+
OpLine %6 793 0
55
%7 = OpGroupNonUniformIAdd %2 %8 Reduce %4
66
OpNoLine
77
OpReturnValue %7

0 commit comments

Comments
 (0)