[Mlir-commits] [mlir] [mlir][spirv] Add definition for OpGroupNonUniformBallotBitCount (PR #126055)
Andrea Faulds
llvmlistbot at llvm.org
Thu Feb 6 08:58:46 PST 2025
================
@@ -1287,4 +1297,70 @@ def SPIRV_GroupNonUniformLogicalXorOp :
// -----
+def SPIRV_GroupNonUniformBallotBitCountOp : SPIRV_Op<"GroupNonUniformBallotBitCount", [
+ SPIRV_ExecutionScopeAttrIs<"execution_scope", "Subgroup">,
+ SPIRV_GroupOperationAttrIs<"group_operation", "Reduce">
+]> {
+ let summary = [{
+ Result is the number of bits that are set to 1 in Value, considering
+ only the bits in Value required to represent all bits of the scope
+ restricted tangle.
+ }];
+
+ let description = [{
+ Result Type must be a scalar of integer type, whose Signedness operand
+ is 0.
+
+ Execution is the scope defining the scope restricted tangle affected by
+ this command. It must be Subgroup.
+
+ The identity I for Operation is 0.
+
+ Value must be a vector of four components of integer type scalar, whose
+ Width operand is 32 and whose Signedness operand is 0.
+
+ Value is a set of bitfields where the first invocation is represented in
+ the lowest bit of the first vector component and the last (up to the
+ size of the scope) is the higher bit number of the last bitmask needed
+ to represent all bits of the invocations in the scope restricted tangle.
+
+ An invocation will not execute a dynamic instance of this instruction
+ (X') until all invocations in its scope restricted tangle have executed
+ all dynamic instances that are program-ordered before X'.
+
+ <!-- End of AutoGen section -->
+
+ #### Example:
+
+ ```mlir
+ %count = spirv.GroupNonUniformBallotBitCount <Subgroup> <Reduce> %val : vector<4xi32> -> i32
+ ```
+ }];
+
+ let availability = [
+ MinVersion<SPIRV_V_1_3>,
+ MaxVersion<SPIRV_V_1_6>,
+ Extension<[]>,
+ Capability<[SPIRV_C_GroupNonUniformBallot]>
+ ];
+
+ let arguments = (ins
+ SPIRV_ScopeAttr:$execution_scope,
+ SPIRV_GroupOperationAttr:$group_operation,
+ SPIRV_IOrUIVec4:$value
+ );
+
+ let results = (outs
+ SPIRV_SignlessOrUnsignedInt:$result
----------------
andfau-amd wrote:
In SPIR-V, Signedness = 0 means either signless or unsigned. There aren't separate bit values for signless and unsigned respectively. So `SPIRV_SignlessOrUnsignedInt` is what you want.
https://github.com/llvm/llvm-project/pull/126055
More information about the Mlir-commits
mailing list