feat(runtime): enable parallel execution for TestLib when available.

This commit is contained in:
Antoniu Pop
2022-03-17 16:58:31 +00:00
committed by Antoniu Pop
parent 460fbabbe0
commit 8defa338e8
3 changed files with 15 additions and 0 deletions

View File

@@ -20,6 +20,12 @@ void compile_and_run(EndToEndDesc desc, LambdaSupport support) {
options.v0Parameter = *desc.v0Parameter;
}
/* 0 - Enable parallel testing where required */
#ifdef CONCRETELANG_PARALLEL_TESTING_ENABLED
options.dataflowParallelize = true;
options.loopParallelize = true;
#endif
/* 1 - Compile the program */
auto compilationResult = support.compile(desc.program, options);
ASSERT_EXPECTED_SUCCESS(compilationResult);

View File

@@ -16,6 +16,12 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
)
endif()
if(CONCRETELANG_PARALLEL_EXECUTION_ENABLED)
add_compile_options(
-DCONCRETELANG_PARALLEL_TESTING_ENABLED
)
endif()
add_concretecompiler_lib_test(
unit_tests_concretelang_testlib
testlib_unit_test.cpp

View File

@@ -40,6 +40,9 @@ compile(std::string outputLib, std::string source,
mlir::concretelang::CompilationContext::createShared();
mlir::concretelang::CompilerEngine ce{ccx};
mlir::concretelang::CompilationOptions options(funcname);
#ifdef CONCRETELANG_PARALLEL_TESTING_ENABLED
options.autoParallelize = true;
#endif
ce.setCompilationOptions(options);
auto result = ce.compile(sources, outputLib);
if (!result) {