From d1da6ce05fcc364959b0d36ff51ab4e0c23498b7 Mon Sep 17 00:00:00 2001 From: youben11 Date: Fri, 25 Mar 2022 10:51:45 +0100 Subject: [PATCH] fix: detect early when parallelization isn't supported --- compiler/lib/CAPI/Support/CompilerEngine.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/compiler/lib/CAPI/Support/CompilerEngine.cpp b/compiler/lib/CAPI/Support/CompilerEngine.cpp index de592ef2f..63f279523 100644 --- a/compiler/lib/CAPI/Support/CompilerEngine.cpp +++ b/compiler/lib/CAPI/Support/CompilerEngine.cpp @@ -30,6 +30,13 @@ jit_lambda_support(const char *runtimeLibPath) { std::unique_ptr jit_compile(JITLambdaSupport_C support, const char *module, mlir::concretelang::CompilationOptions options) { +#ifndef CONCRETELANG_PARALLEL_EXECUTION_ENABLED + if (options.autoParallelize || options.loopParallelize || + options.dataflowParallelize) { + throw std::runtime_error( + "This package was built without parallelization support"); + } +#endif GET_OR_THROW_LLVM_EXPECTED(compilationResult, support.support.compile(module, options)); return std::move(*compilationResult); @@ -69,6 +76,13 @@ library_lambda_support(const char *outputPath) { std::unique_ptr library_compile(LibraryLambdaSupport_C support, const char *module, mlir::concretelang::CompilationOptions options) { +#ifndef CONCRETELANG_PARALLEL_EXECUTION_ENABLED + if (options.autoParallelize || options.loopParallelize || + options.dataflowParallelize) { + throw std::runtime_error( + "This package was built without parallelization support"); + } +#endif GET_OR_THROW_LLVM_EXPECTED(compilationResult, support.support.compile(module, options)); return std::move(*compilationResult);