[Mlir-commits] [mlir] accfbf4 - [MLIR][ROCDL] Add BallotOp and lit test (#84856)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Mar 12 17:07:19 PDT 2024
Author: Zahi Moudallal
Date: 2024-03-12T17:07:16-07:00
New Revision: accfbf4e4959957db0993a15bab7316001131df3
URL: https://github.com/llvm/llvm-project/commit/accfbf4e4959957db0993a15bab7316001131df3
DIFF: https://github.com/llvm/llvm-project/commit/accfbf4e4959957db0993a15bab7316001131df3.diff
LOG: [MLIR][ROCDL] Add BallotOp and lit test (#84856)
Added:
Modified:
mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td
mlir/test/Target/LLVMIR/rocdl.mlir
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td b/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td
index 32b5a1c016b6f8..abb38a3df8068c 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td
@@ -158,6 +158,16 @@ Arguments<(ins I32:$index,
}];
}
+def ROCDL_BallotOp :
+ ROCDL_Op<"ballot">,
+ Results<(outs LLVM_Type:$res)>,
+ Arguments<(ins I1:$pred)> {
+ string llvmBuilder = [{
+ $res = createIntrinsicCall(builder,
+ llvm::Intrinsic::amdgcn_ballot, {$pred}, {llvm::Type::getInt32Ty(moduleTranslation.getLLVMContext())});
+ }];
+ let assemblyFormat = "$pred attr-dict `:` type($res)";
+}
//===----------------------------------------------------------------------===//
// Thread index and Block index
diff --git a/mlir/test/Target/LLVMIR/rocdl.mlir b/mlir/test/Target/LLVMIR/rocdl.mlir
index d35acb0475e6f8..93550f5c7bd5a4 100644
--- a/mlir/test/Target/LLVMIR/rocdl.mlir
+++ b/mlir/test/Target/LLVMIR/rocdl.mlir
@@ -88,6 +88,13 @@ llvm.func @rocdl.bpermute(%src : i32) -> i32 {
llvm.return %0 : i32
}
+llvm.func @rocdl.ballot(%pred : i1) -> i32 {
+ // CHECK-LABEL: rocdl.ballot
+ // CHECK: call i32 @llvm.amdgcn.ballot
+ %0 = rocdl.ballot %pred : i32
+ llvm.return %0 : i32
+}
+
llvm.func @rocdl.waitcnt() {
// CHECK-LABEL: rocdl.waitcnt
// CHECK-NEXT: call void @llvm.amdgcn.s.waitcnt(i32 0)
More information about the Mlir-commits
mailing list