diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index 7b68757..aa6b976 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -941,11 +941,24 @@ public: // Group + /// Computes a bitfield value combining the Predicate value from all invocations in the current + /// Subgroup that execute the same dynamic instance of this instruction. + Id OpSubgroupBallotKHR(Id result_type, Id predicate); + /// Return the value from the invocation in the subgroup with an invocation ID equal to index. /// The index must be the same for all active invocations in the subgroup, otherwise the results /// are undefined. Id OpSubgroupReadInvocationKHR(Id result_type, Id value, Id index); + /// TBD + Id OpSubgroupAllKHR(Id result_type, Id predicate); + + /// TBD + Id OpSubgroupAnyKHR(Id result_type, Id predicate); + + /// TBD + Id OpSubgroupAllEqualKHR(Id result_type, Id predicate); + /// Return the value of the invocation identified by the current invocation's id within the /// group xor'ed with mask. Id OpGroupNonUniformShuffleXor(Id result_type, spv::Scope scope, Id value, Id mask); diff --git a/src/instructions/group.cpp b/src/instructions/group.cpp index 3c3d429..aba6422 100644 --- a/src/instructions/group.cpp +++ b/src/instructions/group.cpp @@ -9,6 +9,12 @@ namespace Sirit { +Id Module::OpSubgroupBallotKHR(Id result_type, Id predicate) { + auto op = std::make_unique(spv::Op::OpSubgroupBallotKHR, bound++, result_type); + op->Add(predicate); + return AddCode(std::move(op)); +} + Id Module::OpSubgroupReadInvocationKHR(Id result_type, Id value, Id index) { auto op = std::make_unique(spv::Op::OpSubgroupReadInvocationKHR, bound++, result_type); op->Add(value); @@ -16,6 +22,24 @@ Id Module::OpSubgroupReadInvocationKHR(Id result_type, Id value, Id index) { return AddCode(std::move(op)); } +Id Module::OpSubgroupAllKHR(Id result_type, Id predicate) { + auto op = std::make_unique(spv::Op::OpSubgroupAllKHR, bound++, result_type); + op->Add(predicate); + return AddCode(std::move(op)); +} + +Id Module::OpSubgroupAnyKHR(Id result_type, Id predicate) { + auto op = std::make_unique(spv::Op::OpSubgroupAnyKHR, bound++, result_type); + op->Add(predicate); + return AddCode(std::move(op)); +} + +Id Module::OpSubgroupAllEqualKHR(Id result_type, Id predicate) { + auto op = std::make_unique(spv::Op::OpSubgroupAllEqualKHR, bound++, result_type); + op->Add(predicate); + return AddCode(std::move(op)); +} + Id Module::OpGroupNonUniformShuffleXor(Id result_type, spv::Scope scope, Id value, Id mask) { auto op = std::make_unique(spv::Op::OpGroupNonUniformShuffleXor, bound++, result_type); op->Add(static_cast(scope));