Skip to content

Commit a048616

Browse files
committed
[mlir][spirv] Add convergent attribute to builtin
Add the `convergent` attribute to builtin functions and builtin function calls when lowering SPIR-V non-uniform group functions to LLVM dialect. Signed-off-by: Lukas Sommer <[email protected]>
1 parent b054289 commit a048616

File tree

2 files changed

+40
-41
lines changed

2 files changed

+40
-41
lines changed

mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,8 +1028,7 @@ class ReturnValuePattern : public SPIRVToLLVMConversion<spirv::ReturnValueOp> {
10281028
static LLVM::LLVMFuncOp lookupOrCreateSPIRVFn(Operation *symbolTable,
10291029
StringRef name,
10301030
ArrayRef<Type> paramTypes,
1031-
Type resultType,
1032-
bool convergent = true) {
1031+
Type resultType) {
10331032
auto func = dyn_cast_or_null<LLVM::LLVMFuncOp>(
10341033
SymbolTable::lookupSymbolIn(symbolTable, name));
10351034
if (func)
@@ -1040,7 +1039,7 @@ static LLVM::LLVMFuncOp lookupOrCreateSPIRVFn(Operation *symbolTable,
10401039
symbolTable->getLoc(), name,
10411040
LLVM::LLVMFunctionType::get(resultType, paramTypes));
10421041
func.setCConv(LLVM::cconv::CConv::SPIR_FUNC);
1043-
func.setConvergent(convergent);
1042+
func.setConvergent(true);
10441043
func.setNoUnwind(true);
10451044
func.setWillReturn(true);
10461045
return func;
@@ -1253,8 +1252,8 @@ class GroupReducePattern : public SPIRVToLLVMConversion<ReduceOp> {
12531252
Operation *symbolTable =
12541253
op->template getParentWithTrait<OpTrait::SymbolTable>();
12551254

1256-
LLVM::LLVMFuncOp func = lookupOrCreateSPIRVFn(
1257-
symbolTable, funcName, paramTypes, retTy, !NonUniform);
1255+
LLVM::LLVMFuncOp func =
1256+
lookupOrCreateSPIRVFn(symbolTable, funcName, paramTypes, retTy);
12581257

12591258
Location loc = op.getLoc();
12601259
Value scope = rewriter.create<LLVM::ConstantOp>(

0 commit comments

Comments
 (0)