File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed
Dialect/LLVMIR/Transforms
lib/Dialect/LLVMIR/Transforms Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,13 @@ namespace LLVM {
23
23
void registerInlinerInterface (DialectRegistry ®istry);
24
24
25
25
} // namespace LLVM
26
+
27
+ namespace NVVM {
28
+ // / Register the `NVVMInlinerInterface` implementation of
29
+ // / `DialectInlinerInterface` with the NVVM dialect.
30
+ void registerInlinerInterface (DialectRegistry ®istry);
31
+ } // namespace NVVM
32
+
26
33
} // namespace mlir
27
34
28
35
#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) {
167
167
gpu::registerBufferDeallocationOpInterfaceExternalModels (registry);
168
168
gpu::registerValueBoundsOpInterfaceExternalModels (registry);
169
169
LLVM::registerInlinerInterface (registry);
170
+ NVVM::registerInlinerInterface (registry);
170
171
linalg::registerAllDialectInterfaceImplementations (registry);
171
172
linalg::registerRuntimeVerifiableOpInterfaceExternalModels (registry);
172
173
memref::registerAllocationOpInterfaceExternalModels (registry);
Original file line number Diff line number Diff line change 14
14
#include " mlir/Dialect/LLVMIR/Transforms/InlinerInterfaceImpl.h"
15
15
#include " mlir/Analysis/SliceWalk.h"
16
16
#include " mlir/Dialect/LLVMIR/LLVMDialect.h"
17
+ #include " mlir/Dialect/LLVMIR/NVVMDialect.h"
17
18
#include " mlir/IR/Matchers.h"
18
19
#include " mlir/Interfaces/DataLayoutInterfaces.h"
19
20
#include " mlir/Interfaces/ViewLikeInterface.h"
@@ -815,3 +816,9 @@ void mlir::LLVM::registerInlinerInterface(DialectRegistry ®istry) {
815
816
dialect->addInterfaces <LLVMInlinerInterface>();
816
817
});
817
818
}
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
1
+ // RUN: mlir-opt %s -inline -split-input-file | FileCheck %s
2
+
3
+ // UNSUPPORTED: system-windows
4
+
5
+ llvm.func @threadidx () -> i32 {
6
+ %tid = nvvm.read.ptx.sreg.tid.x : i32
7
+ llvm.return %tid : i32
8
+ }
9
+
10
+ // CHECK-LABEL: func @caller
11
+ llvm.func @caller () -> i32 {
12
+ // CHECK-NOT: llvm.call @threadidx
13
+ // CHECK: nvvm.read.ptx.sreg.tid.x
14
+ %z = llvm.call @threadidx () : () -> (i32 )
15
+ llvm.return %z : i32
16
+ }
You can’t perform that action at this time.
0 commit comments