From 631c8070dfefc666682a5d2542c942413af4cc1c Mon Sep 17 00:00:00 2001 From: Sean Silva Date: Wed, 7 Oct 2020 18:51:24 -0700 Subject: [PATCH] [RefBackend] Put JITModule in refback namsepace. --- include/npcomp/RefBackend/JITHelpers/JITModule.h | 4 ++-- include/npcomp/RefBackend/JITHelpers/README.md | 10 +++++----- lib/Backend/RefJIT/PythonModule.cpp | 2 +- lib/RefBackend/JITHelpers/JITModule.cpp | 2 +- tools/mnist-playground/mnist-playground.cpp | 8 ++++---- tools/npcomp-run-mlir/npcomp-run-mlir.cpp | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/npcomp/RefBackend/JITHelpers/JITModule.h b/include/npcomp/RefBackend/JITHelpers/JITModule.h index 60bd0cfbb..3a2511190 100644 --- a/include/npcomp/RefBackend/JITHelpers/JITModule.h +++ b/include/npcomp/RefBackend/JITHelpers/JITModule.h @@ -23,7 +23,7 @@ namespace mlir { class PassManager; } // namespace mlir -namespace npcomp { +namespace refback { // Wrapper around refbackrt data structures and a JITted module, facilitating // interaction. class JITModule { @@ -49,6 +49,6 @@ private: std::unique_ptr engine; refbackrt::ModuleDescriptor *descriptor; }; -} // namespace npcomp +} // namespace refback #endif // NPCOMP_JITRUNTIME_JITMODULE_H diff --git a/include/npcomp/RefBackend/JITHelpers/README.md b/include/npcomp/RefBackend/JITHelpers/README.md index 9571b500b..d5b81bbfc 100644 --- a/include/npcomp/RefBackend/JITHelpers/README.md +++ b/include/npcomp/RefBackend/JITHelpers/README.md @@ -1,9 +1,9 @@ -Utilities for compiling and running on the npcomp runtime with a JIT. +Utilities for compiling and running on the reference backend with a JIT. -The runtime itself lives in {include,lib}/runtime/, but since it is totally -firewalled from the compiler codebase, it presents a fairly bare-bones -interface (e.g. it doesn't use libSupport, can't use LLVM's JIT interfaces, -etc.). +The runtime itself lives in {include,lib}/RefBackend/Runtime, but since it +is totally firewalled from the compiler codebase, it presents a fairly +bare-bones interface (e.g. it doesn't use libSupport, can't use LLVM's JIT +interfaces, etc.). The interface provided in this directory uses standard LLVM conventions and freely relies on libSupport, JIT utilities, etc. diff --git a/lib/Backend/RefJIT/PythonModule.cpp b/lib/Backend/RefJIT/PythonModule.cpp index 33cee4fc9..7fb33f80f 100644 --- a/lib/Backend/RefJIT/PythonModule.cpp +++ b/lib/Backend/RefJIT/PythonModule.cpp @@ -21,7 +21,7 @@ using llvm::Twine; // Make namespaces consistent. using mlir::PyModuleOp; using mlir::PyPassManager; -using npcomp::JITModule; +using refback::JITModule; using refbackrt::Ref; using refbackrt::Tensor; diff --git a/lib/RefBackend/JITHelpers/JITModule.cpp b/lib/RefBackend/JITHelpers/JITModule.cpp index db1557095..3c17ab249 100644 --- a/lib/RefBackend/JITHelpers/JITModule.cpp +++ b/lib/RefBackend/JITHelpers/JITModule.cpp @@ -13,7 +13,7 @@ #include "llvm/Support/InitLLVM.h" #include "llvm/Support/TargetSelect.h" -using namespace npcomp; +using namespace refback; using namespace mlir; using llvm::Error; using llvm::Expected; diff --git a/tools/mnist-playground/mnist-playground.cpp b/tools/mnist-playground/mnist-playground.cpp index 192dac680..417161aaa 100644 --- a/tools/mnist-playground/mnist-playground.cpp +++ b/tools/mnist-playground/mnist-playground.cpp @@ -39,7 +39,7 @@ static Error make_string_error(const Twine &message) { llvm::inconvertibleErrorCode()); } -Expected> +Expected> createJITModule(std::string mlirFile, mlir::DialectRegistry ®istry, ArrayRef sharedLibs, bool optimize) { MLIRContext context; @@ -53,11 +53,11 @@ createJITModule(std::string mlirFile, mlir::DialectRegistry ®istry, // Compile. PassManager pm(module.getContext(), /*verifyPasses=*/true); applyPassManagerCLOptions(pm); - npcomp::JITModule::buildBackendCompilationPipeline(pm, optimize); + refback::JITModule::buildBackendCompilationPipeline(pm, optimize); if (failed(pm.run(module))) return make_string_error(Twine("error compiling to jit backend")); - return npcomp::JITModule::fromCompiledModule(module, sharedLibs); + return refback::JITModule::fromCompiledModule(module, sharedLibs); } //===----------------------------------------------------------------------===// @@ -65,7 +65,7 @@ createJITModule(std::string mlirFile, mlir::DialectRegistry ®istry, //===----------------------------------------------------------------------===// static Expected> -invokeJITModuleWithATenTensors(npcomp::JITModule &jitModule, +invokeJITModuleWithATenTensors(refback::JITModule &jitModule, StringRef invokeFunction, std::vector &args) { diff --git a/tools/npcomp-run-mlir/npcomp-run-mlir.cpp b/tools/npcomp-run-mlir/npcomp-run-mlir.cpp index 290051037..e101cf23c 100644 --- a/tools/npcomp-run-mlir/npcomp-run-mlir.cpp +++ b/tools/npcomp-run-mlir/npcomp-run-mlir.cpp @@ -131,13 +131,13 @@ Error compileAndRun(std::string mlirFile, mlir::DialectRegistry ®istry, // Compile. PassManager pm(module.getContext(), /*verifyPasses=*/true); applyPassManagerCLOptions(pm); - npcomp::JITModule::buildBackendCompilationPipeline(pm, optimize); + refback::JITModule::buildBackendCompilationPipeline(pm, optimize); if (failed(pm.run(module))) { return make_string_error(Twine("error compiling to jit backend")); } auto expectedJitModule = - npcomp::JITModule::fromCompiledModule(module, sharedLibs); + refback::JITModule::fromCompiledModule(module, sharedLibs); if (!expectedJitModule) return expectedJitModule.takeError(); auto jitModule = std::move(*expectedJitModule);