diff --git a/test/Pipeline/i64-memory-alignment.forth b/test/Pipeline/i64-memory-alignment.forth index e36113e..ab95703 100644 --- a/test/Pipeline/i64-memory-alignment.forth +++ b/test/Pipeline/i64-memory-alignment.forth @@ -1,8 +1,8 @@ \ RUN: %warpforthc %s -o %t.ptx \ RUN: %FileCheck %s --implicit-check-not='{{(ld|st)[.a-z]*\.[bsuf]32}}' < %t.ptx -\ i64 global accesses and the stack slots in word functions are naturally -\ aligned, so each is a single 64-bit memory operation. +\ i64 global accesses are naturally aligned, so each is a single 64-bit memory +\ operation. \! kernel main \! param A i64[256] @@ -18,7 +18,3 @@ GLOBAL-ID CELLS A + ! \ CHECK: ld{{(\.global)?}}.{{[bsuf]}}64 {{%[a-z]+[0-9]+}}, [ \ CHECK: ld{{(\.global)?}}.{{[bsuf]}}64 {{%[a-z]+[0-9]+}}, [ \ CHECK: st{{(\.global)?}}.{{[bsuf]}}64 [ - -\ CHECK-LABEL: .func {{.*}}SUM3( -\ CHECK: ld{{(\.global)?}}.{{[bsuf]}}64 {{%[a-z]+[0-9]+}}, [ -\ CHECK: st{{(\.global)?}}.{{[bsuf]}}64 [ diff --git a/test/Pipeline/inlined-words.forth b/test/Pipeline/inlined-words.forth new file mode 100644 index 0000000..239bfe1 --- /dev/null +++ b/test/Pipeline/inlined-words.forth @@ -0,0 +1,13 @@ +\ RUN: %warpforthc %s -o %t.ptx +\ RUN: %FileCheck %s < %t.ptx + +\ Words inlined into the kernel must not survive as device functions. +\ CHECK-NOT: .func +\ CHECK: .entry k( +\ CHECK-NOT: .func + +\! kernel k +\! param a i64[256] +: sq DUP * ; +: sumsq 0 SWAP 0 DO I sq + LOOP ; +GLOBAL-ID sumsq GLOBAL-ID CELLS a + ! diff --git a/tools/warpforthc/CMakeLists.txt b/tools/warpforthc/CMakeLists.txt index 9b8c8fc..08a225a 100644 --- a/tools/warpforthc/CMakeLists.txt +++ b/tools/warpforthc/CMakeLists.txt @@ -12,6 +12,7 @@ target_link_libraries(warpforthc MLIRArithToLLVM MLIRBuiltinToLLVMIRTranslation MLIRControlFlowToLLVM + MLIRFuncInlinerExtension MLIRFuncToLLVM MLIRGPUToLLVMIRTranslation MLIRLLVMToLLVMIRTranslation diff --git a/tools/warpforthc/warpforthc.cpp b/tools/warpforthc/warpforthc.cpp index 0815d67..bd13536 100644 --- a/tools/warpforthc/warpforthc.cpp +++ b/tools/warpforthc/warpforthc.cpp @@ -9,8 +9,9 @@ #include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h" #include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h" #include "mlir/Dialect/ControlFlow/IR/ControlFlow.h" // IWYU pragma: keep -#include "mlir/Dialect/Func/IR/FuncOps.h" // IWYU pragma: keep -#include "mlir/Dialect/MemRef/IR/MemRef.h" // IWYU pragma: keep +#include "mlir/Dialect/Func/Extensions/InlinerExtension.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" // IWYU pragma: keep +#include "mlir/Dialect/MemRef/IR/MemRef.h" // IWYU pragma: keep #include "mlir/IR/AsmState.h" #include "mlir/IR/BuiltinOps.h" #include "mlir/IR/Diagnostics.h" @@ -75,6 +76,7 @@ int main(int argc, char **argv) { cf::registerConvertControlFlowToLLVMInterface(registry); registerConvertFuncToLLVMInterface(registry); registerConvertMemRefToLLVMInterface(registry); + func::registerInlinerExtension(registry); registerBuiltinDialectTranslation(registry); registerGPUDialectTranslation(registry);