From da4ffce189fa5d4e0fe3a45df2af38c9853d1a11 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Fri, 21 Oct 2022 23:14:21 +0100 Subject: [PATCH] Add OpGroupNonUniformBroadcast subgroup op --- include/sirit/sirit.h | 4 ++++ src/instructions/group.cpp | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index 589ea06..185568f 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -1156,6 +1156,10 @@ public: /// TBD Id OpSubgroupAllEqualKHR(Id result_type, Id predicate); + // Result is the Value of the invocation identified by the id Id to all active invocations in + // the group. + Id OpGroupNonUniformBroadcast(Id result_type, Id scope, Id value, Id id); + /// 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, Id scope, Id value, Id mask); diff --git a/src/instructions/group.cpp b/src/instructions/group.cpp index 274b5b6..71ec8c9 100644 --- a/src/instructions/group.cpp +++ b/src/instructions/group.cpp @@ -36,6 +36,12 @@ Id Module::OpSubgroupAllEqualKHR(Id result_type, Id predicate) { return *code << OpId{spv::Op::OpSubgroupAllEqualKHR, result_type} << predicate << EndOp{}; } +Id Module::OpGroupNonUniformBroadcast(Id result_type, Id scope, Id value, Id id) { + code->Reserve(6); + return *code << OpId{spv::Op::OpGroupNonUniformBroadcast, result_type} << scope << value + << id << EndOp{}; +} + Id Module::OpGroupNonUniformShuffleXor(Id result_type, Id scope, Id value, Id mask) { code->Reserve(6); return *code << OpId{spv::Op::OpGroupNonUniformShuffleXor, result_type} << scope << value