Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cext/mlir-llvm70/include/llvm70/LLVM70Target.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class MLIRToLLVM70 {
llvm::Error translateClusterArriveOp(mlir::Operation *op, bool isRelaxed);
llvm::Error translateClusterWaitOp(mlir::Operation *op);
llvm::Error translateBarrierOp(mlir::Operation *op);
llvm::Error translateBarrier0Op(mlir::Operation *op);
llvm::Error translateCttzCtlzOp(mlir::Operation *op, llvm::StringRef intrBase,
mlir::Value in, mlir::Value res,
bool isZeroPoison);
Expand Down
14 changes: 14 additions & 0 deletions cext/mlir-llvm70/lib/LLVM70Target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,18 @@ llvm::Error MLIRToLLVM70::translateBarrierOp(Operation *op) {
return llvm::Error::success();
}

llvm::Error MLIRToLLVM70::translateBarrier0Op(Operation *op) {
// NVVM::Barrier0Op takes no operands and is equivalent to bar.sync 0.
// Lower it to the LLVM 7 intrinsic llvm.nvvm.barrier0() : void.
const char *intrName = "llvm.nvvm.barrier0";
LLVMTypeRef fnTy = b.funcTy(b.voidTy(), nullptr, 0, false);
LLVMValueRef fn = b.getNamedFunction(intrName);
if (!fn)
fn = b.addFunction(intrName, fnTy);
b.buildCall(fn, nullptr, 0, "");
return llvm::Error::success();
}

llvm::Error MLIRToLLVM70::translateCttzCtlzOp(Operation *op,
llvm::StringRef intrBase,
Value in, Value res,
Expand Down Expand Up @@ -2412,6 +2424,8 @@ llvm::Error MLIRToLLVM70::translateNVVMOp(Operation *op) {
[&](auto) { return this->translateClusterWaitOp(op); })
.Case<NVVM::BarrierOp>(
[&](auto) { return this->translateBarrierOp(op); })
.Case<NVVM::Barrier0Op>(
[&](auto) { return this->translateBarrier0Op(op); })
.Case<NVVM::Breakpoint>([&](auto) {
LLVMTypeRef fnTy = b.funcTy(b.voidTy(), nullptr, 0, false);
LLVMValueRef asmVal =
Expand Down
Loading