feat: throw clear error if DF jit-exec is not supported

was previously getting an undefined symbol error as the runtime lib
didn't support dataflow execution
This commit is contained in:
youben11
2022-04-14 07:42:13 +01:00
committed by Ayoub Benaissa
parent c2d92b0132
commit c8ca318fde
3 changed files with 16 additions and 0 deletions

View File

@@ -38,6 +38,8 @@ public:
llvm::Expected<std::unique_ptr<clientlib::PublicResult>>
call(clientlib::PublicArguments &args);
void setUseDataflow(bool option) { this->useDataflow = option; }
private:
/// invokeRaw execute the jit lambda with a list of Argument, the last one is
/// used to store the result of the computation.
@@ -52,6 +54,10 @@ private:
mlir::LLVM::LLVMFunctionType type;
std::string name;
std::unique_ptr<mlir::ExecutionEngine> engine;
// Tell if the DF parallelization was on or during compilation. This will be
// useful to abort execution if the runtime doesn't support dataflow
// execution, instead of having undefined symbol issues
bool useDataflow = false;
};
} // namespace concretelang

View File

@@ -45,6 +45,9 @@ JITSupport::compile(llvm::SourceMgr &program, CompilationOptions options) {
}
auto result = std::make_unique<JitCompilationResult>();
result->lambda = std::shared_ptr<concretelang::JITLambda>(std::move(*lambda));
// Mark the lambda as compiled using DF parallelization
result->lambda->setUseDataflow(options.dataflowParallelize ||
options.autoParallelize);
result->clientParameters =
compilationResult.get().clientParameters.getValue();
return std::move(result);

View File

@@ -77,6 +77,13 @@ uint64_t numArgOfRankedMemrefCallingConvention(uint64_t rank) {
llvm::Expected<std::unique_ptr<clientlib::PublicResult>>
JITLambda::call(clientlib::PublicArguments &args) {
#ifndef CONCRETELANG_PARALLEL_EXECUTION_ENABLED
if (this->useDataflow) {
return StreamStringError(
"call: current runtime doesn't support dataflow execution, while "
"compilation used dataflow parallelization");
}
#endif
// invokeRaw needs to have pointers on arguments and a pointers on the result
// as last argument.
// Prepare the outputs vector to store the output value of the lambda.