[RefBackend] Put JITModule in refback namsepace.

pull/73/head
Sean Silva 2020-10-07 18:51:24 -07:00
parent 7edb5f3641
commit 631c8070df
6 changed files with 15 additions and 15 deletions

View File

@ -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<mlir::ExecutionEngine> engine;
refbackrt::ModuleDescriptor *descriptor;
};
} // namespace npcomp
} // namespace refback
#endif // NPCOMP_JITRUNTIME_JITMODULE_H

View File

@ -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.

View File

@ -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;

View File

@ -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;

View File

@ -39,7 +39,7 @@ static Error make_string_error(const Twine &message) {
llvm::inconvertibleErrorCode());
}
Expected<std::unique_ptr<npcomp::JITModule>>
Expected<std::unique_ptr<refback::JITModule>>
createJITModule(std::string mlirFile, mlir::DialectRegistry &registry,
ArrayRef<StringRef> sharedLibs, bool optimize) {
MLIRContext context;
@ -53,11 +53,11 @@ createJITModule(std::string mlirFile, mlir::DialectRegistry &registry,
// 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 &registry,
//===----------------------------------------------------------------------===//
static Expected<std::vector<at::Tensor>>
invokeJITModuleWithATenTensors(npcomp::JITModule &jitModule,
invokeJITModuleWithATenTensors(refback::JITModule &jitModule,
StringRef invokeFunction,
std::vector<at::Tensor> &args) {

View File

@ -131,13 +131,13 @@ Error compileAndRun(std::string mlirFile, mlir::DialectRegistry &registry,
// 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);