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 {
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+ } // namespace NVVM
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 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