Skip to content
Open
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
7 changes: 1 addition & 6 deletions mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -3176,12 +3176,7 @@ def NVVM_PrefetchOp : NVVM_Op<"prefetch",
let llvmBuilder = [{
auto [id, args] = NVVM::PrefetchOp::getIntrinsicIDAndArgs(op,
moduleTranslation, builder);

if(op.getTensormap())
// Overloaded intrinsic
createIntrinsicCall(builder, id, args, {args[0]->getType()});
else
createIntrinsicCall(builder, id, args);
createIntrinsicCall(builder, id, builder.getVoidTy(), args);
}];
}

Expand Down
9 changes: 9 additions & 0 deletions mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,15 @@ llvm::CallInst *createIntrinsicCall(llvm::IRBuilderBase &builder,
ArrayRef<llvm::Value *> args = {},
ArrayRef<llvm::Type *> tys = {});

/// Creates a call to an LLVM IR intrinsic function with the given return type
/// and arguments. If the intrinsic is overloaded, the function signature will
/// be automatically resolved based on the provided return type and argument
/// types.
llvm::CallInst *createIntrinsicCall(llvm::IRBuilderBase &builder,
llvm::Intrinsic::ID intrinsic,
llvm::Type *retTy,
ArrayRef<llvm::Value *> args);

/// Creates a call to a LLVM IR intrinsic defined by LLVM_IntrOpBase. This
/// resolves the overloads, and maps mixed MLIR value and attribute arguments to
/// LLVM values.
Expand Down
11 changes: 7 additions & 4 deletions mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,10 +892,13 @@ void mlir::LLVM::detail::connectPHINodes(Region &region,
llvm::CallInst *mlir::LLVM::detail::createIntrinsicCall(
llvm::IRBuilderBase &builder, llvm::Intrinsic::ID intrinsic,
ArrayRef<llvm::Value *> args, ArrayRef<llvm::Type *> tys) {
llvm::Module *module = builder.GetInsertBlock()->getModule();
llvm::Function *fn =
llvm::Intrinsic::getOrInsertDeclaration(module, intrinsic, tys);
return builder.CreateCall(fn, args);
return builder.CreateIntrinsic(intrinsic, tys, args);
}

llvm::CallInst *mlir::LLVM::detail::createIntrinsicCall(
llvm::IRBuilderBase &builder, llvm::Intrinsic::ID intrinsic,
llvm::Type *retTy, ArrayRef<llvm::Value *> args) {
return builder.CreateIntrinsic(retTy, intrinsic, args);
}

llvm::CallInst *mlir::LLVM::detail::createIntrinsicCall(
Expand Down