File tree Expand file tree Collapse file tree 4 files changed +30
-0
lines changed
Dialect/LLVMIR/Transforms
lib/Dialect/LLVMIR/Transforms Expand file tree Collapse file tree 4 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,13 @@ namespace LLVM {
2323void registerInlinerInterface (DialectRegistry ®istry);
2424
2525} // namespace LLVM
26+
27+ namespace NVVM {
28+ // / Register the `NVVMInlinerInterface` implementation of
29+ // / `DialectInlinerInterface` with the NVVM dialect.
30+ void registerInlinerInterface (DialectRegistry ®istry);
31+ }
32+
2633} // namespace mlir
2734
2835#endif // MLIR_DIALECT_LLVMIR_TRANSFORMS_INLINERINTERFACEIMPL_H
Original file line number Diff line number Diff line change @@ -167,6 +167,7 @@ inline void registerAllDialects(DialectRegistry ®istry) {
167167 gpu::registerBufferDeallocationOpInterfaceExternalModels (registry);
168168 gpu::registerValueBoundsOpInterfaceExternalModels (registry);
169169 LLVM::registerInlinerInterface (registry);
170+ NVVM::registerInlinerInterface (registry);
170171 linalg::registerAllDialectInterfaceImplementations (registry);
171172 linalg::registerRuntimeVerifiableOpInterfaceExternalModels (registry);
172173 memref::registerAllocationOpInterfaceExternalModels (registry);
Original file line number Diff line number Diff line change 1414#include " mlir/Dialect/LLVMIR/Transforms/InlinerInterfaceImpl.h"
1515#include " mlir/Analysis/SliceWalk.h"
1616#include " mlir/Dialect/LLVMIR/LLVMDialect.h"
17+ #include " mlir/Dialect/LLVMIR/NVVMDialect.h"
1718#include " mlir/IR/Matchers.h"
1819#include " mlir/Interfaces/DataLayoutInterfaces.h"
1920#include " mlir/Interfaces/ViewLikeInterface.h"
@@ -815,3 +816,9 @@ void mlir::LLVM::registerInlinerInterface(DialectRegistry ®istry) {
815816 dialect->addInterfaces <LLVMInlinerInterface>();
816817 });
817818}
819+
820+ void mlir::NVVM::registerInlinerInterface (DialectRegistry ®istry) {
821+ registry.addExtension (+[](MLIRContext *ctx, NVVM::NVVMDialect *dialect) {
822+ dialect->addInterfaces <LLVMInlinerInterface>();
823+ });
824+ }
Original file line number Diff line number Diff line change @@ -641,6 +641,21 @@ llvm.func @caller(%ptr : !llvm.ptr) -> i32 {
641641
642642// -----
643643
644+ llvm.func @threadidx () -> i32 {
645+ %tid = call i32 @llvm.nvvm.read.ptx.sreg.tid.x ()
646+ llvm.return %tid : i32
647+ }
648+
649+ // CHECK-LABEL: func @caller
650+ llvm.func @caller () -> i32 {
651+ // CHECK-NOT: llvm.call @private_func
652+ // CHECK: call i32 @llvm.nvvm.read.ptx.sreg.tid.x
653+ %z = llvm.call @private_func () : () -> (i32 )
654+ llvm.return %z : i32
655+ }
656+
657+ // -----
658+
644659llvm.func @vararg_func (...) {
645660 llvm.return
646661}
You can’t perform that action at this time.
0 commit comments