28 #include "llvm/Support/DebugLog.h"
29 #include "llvm/Support/LogicalResult.h"
30 #include "llvm/Support/raw_ostream.h"
32 #define DEBUG_TYPE "nvvm-to-llvm"
35 #define GEN_PASS_DEF_CONVERTNVVMTOLLVMPASS
36 #include "mlir/Conversion/Passes.h.inc"
52 LogicalResult matchAndRewrite(BasicPtxBuilderInterface op,
54 if (op.hasIntrinsic()) {
55 LDBG() <<
"Ptx Builder does not lower \n\t" << op;
60 LDBG() << op.getPtx();
62 bool needsManualMapping = op.getAsmValues(rewriter, asmValues);
64 for (
auto &[asmValue, modifier] : asmValues) {
65 LDBG() << asmValue <<
"\t Modifier : " << modifier;
75 struct ConvertNVVMToLLVMPass
76 :
public impl::ConvertNVVMToLLVMPassBase<ConvertNVVMToLLVMPass> {
80 registry.
insert<LLVM::LLVMDialect, NVVM::NVVMDialect>();
83 void runOnOperation()
override {
85 target.addLegalDialect<::mlir::LLVM::LLVMDialect>();
97 void loadDependentDialects(
MLIRContext *context)
const final {
98 context->loadDialect<NVVMDialect>();
103 void populateConvertToLLVMConversionPatterns(
118 dialect->addInterfaces<NVVMToLLVMDialectInterface>();
static MLIRContext * getContext(OpFoldResult val)
static const mlir::GenInfo * generator
This class describes a specific conversion target.
Base class for dialect interfaces providing translation to LLVM IR.
ConvertToLLVMPatternInterface(Dialect *dialect)
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
bool addExtension(TypeID extensionID, std::unique_ptr< DialectExtensionBase > extension)
Add the given extension to the registry.
Conversion from types to the LLVM IR dialect.
MLIRContext is the top-level object for a collection of MLIR operations.
A class to build PTX assembly automatically.
This class represents the benefit of a pattern match in a unitless scheme that ranges from 0 (very li...
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
Include the generated interface declarations.
void populateNVVMToLLVMConversionPatterns(RewritePatternSet &patterns)
const FrozenRewritePatternSet & patterns
LogicalResult applyPartialConversion(ArrayRef< Operation * > ops, const ConversionTarget &target, const FrozenRewritePatternSet &patterns, ConversionConfig config=ConversionConfig())
Below we define several entry points for operation conversion.
void registerConvertNVVMToLLVMInterface(DialectRegistry ®istry)
OpInterfaceRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting a...