[Mlir-commits] [mlir] [MLIR][NVVM] Enable nvvm intrinsics import (PR #68843)
Tobias Gysi
llvmlistbot at llvm.org
Tue Oct 17 23:18:45 PDT 2023
gysit wrote:
I would second @ftynse here that we should separate the import of NVVM intrinsics. The import is very similar to the export in the sense that you can implement an interface for your target that implements the actual conversion. There are some difficulties to solve there since the intrinsics don't have a dialect associated in LLVM IR. The interface therefore needs to communicate which intrinsics it supports (https://discourse.llvm.org/t/rfc-extensible-llvm-ir-import/67256).
In principle, you want to build a counterpart to LLVMDialectLLVMIRImportInterface inside the mlir/lib/Target/LLVMIR/Dialect/NVVM folder. It needs to overwrite the relevant methods (I guess you do not care about metadata import). The `getSupportedIntrinsics` method returns the supported intrinsics and `convertIntrinsicImpl`. Most of the code in this methods can be autogenerated using tablegen. Finally you need to make sure to register the new translation interface.
I think you are the first one that tries this mechanism for intrinsics (at least upstream). However, things should work analogous to the LLVMIR import.
https://github.com/llvm/llvm-project/pull/68843
More information about the Mlir-commits
mailing list