Skip to content

Commit

Permalink
Make BuiltinInfo::isMuxBuiltinWithBarrierID() into two separate funct…
Browse files Browse the repository at this point in the history
…ions (#107)
  • Loading branch information
AmyCodeplay authored Aug 28, 2023
1 parent 89defaa commit a5ac5d1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions modules/compiler/utils/include/compiler/utils/builtin_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,16 @@ class BuiltinInfo {
/// @brief Returns true if the mux builtin has a barrier ID as its first
/// operand.
static bool isMuxBuiltinWithBarrierID(BuiltinID ID) {
// NOTE sub group barriers do have an ID operand, but the handle barriers
// pass doesn't need to know about that.
if (isMuxControlBarrierID(ID)) {
return true;
}
auto Info = isMuxGroupCollective(ID);
return Info && Info->isWorkGroupScope();
}

/// @brief Returns true if the mux builtin has a barrier ID as its first
/// operand, and applies at Work Group scope.
static bool isMuxBuiltinWithWGBarrierID(BuiltinID ID) {
if (ID == eMuxBuiltinWorkGroupBarrier) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/compiler/utils/source/barrier_regions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ void compiler::utils::Barrier::FindBarriers() {
Function *callee = call_inst->getCalledFunction();
if (callee != nullptr) {
auto const B = bi_->analyzeBuiltin(*callee);
if (BuiltinInfo::isMuxBuiltinWithBarrierID(B.ID)) {
if (BuiltinInfo::isMuxBuiltinWithWGBarrierID(B.ID)) {
unsigned id = ~0u;
auto *const id_param = call_inst->getOperand(0);
if (auto *const id_param_c = dyn_cast<ConstantInt>(id_param)) {
Expand Down

0 comments on commit a5ac5d1

Please sign in to comment.