Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ configure_file(

add_custom_target(check-warpforth
COMMAND ${LIT_COMMAND} ${CMAKE_CURRENT_BINARY_DIR} -v
DEPENDS warpforth-translate warpforth-opt
DEPENDS warpforth-translate warpforth-opt warpforthc
COMMENT "Running WarpForth lit tests"
)
4 changes: 2 additions & 2 deletions test/Conversion/ForthToGPU/invalid-intrinsic.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// RUN: %FileCheck %s < %t.err
// RUN: test ! -s %t.out

// CHECK: failed to legalize operation 'forth.intrinsic'
// CHECK: invalid-intrinsic.forth:12:7: error: failed to legalize operation 'forth.intrinsic'

module {
func.func private @main() attributes {forth.kernel} {
%0 = forth.intrinsic "unknown" : index
%0 = forth.intrinsic "unknown" : index loc("invalid-intrinsic.forth":12:7)
return
}
}
12 changes: 12 additions & 0 deletions test/Pipeline/source-locations.forth
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
\ RUN: %warpforth-translate --forth-to-mlir --mlir-print-debuginfo %s | %FileCheck %s --check-prefix=FORTH
\ RUN: %warpforthc --mlir-print-ir-after=convert-forth-to-memref --mlir-print-debuginfo --mlir-disable-threading %s -o %t.ptx 2>&1 | %FileCheck %s --check-prefix=LOWERED

\! kernel main
42

\ FORTH: forth.constant %{{.*}}(42 : i64) {{.*}} loc([[FORTH_LOC:#loc[0-9]+]])
\ FORTH: [[FORTH_LOC]] = loc("{{.*}}source-locations.forth":5:1)

\ LOWERED: IR Dump After ConvertForthToMemRef (convert-forth-to-memref)
\ LOWERED: arith.constant 42 : i64 loc([[LOWERED_LOC:#loc[0-9]+]])
\ LOWERED: [[LOWERED_LOC]] = loc("{{.*}}source-locations.forth":5:1)
3 changes: 3 additions & 0 deletions test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
config.substitutions.append(
("%warpforth-opt", os.path.join(config.warpforth_bin_root, "bin", "warpforth-opt"))
)
config.substitutions.append(
("%warpforthc", os.path.join(config.warpforth_bin_root, "bin", "warpforthc"))
)
config.substitutions.append(
("%FileCheck", config.filecheck_path)
)
Expand Down
6 changes: 5 additions & 1 deletion tools/warpforthc/warpforthc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/AsmState.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/MLIRContext.h"
Expand Down Expand Up @@ -44,7 +45,9 @@ static llvm::cl::opt<std::string>

int main(int argc, char **argv) {
llvm::InitLLVM y(argc, argv);
warpforth::registerConversionPasses();
registerMLIRContextCLOptions();
registerAsmPrinterCLOptions();
registerPassManagerCLOptions();
llvm::cl::ParseCommandLineOptions(argc, argv,
"WarpForth compiler: Forth to PTX\n");
Expand Down Expand Up @@ -88,7 +91,8 @@ int main(int argc, char **argv) {

// Run the compilation pipeline
PassManager pm(&context);
(void)applyPassManagerCLOptions(pm);
if (failed(applyPassManagerCLOptions(pm)))
return 1;
warpforth::buildWarpForthPipeline(pm);
if (failed(pm.run(*module))) {
llvm::errs() << "error: compilation pipeline failed\n";
Expand Down
Loading