feat(test): allow selecting loop/dataflow parallelism independently in tests and enable loop parallelism selection by default.

This commit is contained in:
Antoniu Pop
2022-03-30 23:33:58 +01:00
committed by Antoniu Pop
parent 0e38e0a48c
commit 0b14f4c7c5
2 changed files with 12 additions and 3 deletions

View File

@@ -17,6 +17,7 @@ target_link_libraries(
testlib_unit_test
ConcretelangRuntime
ConcretelangSupport
DFRuntime
gtest_main
)

View File

@@ -131,17 +131,25 @@ inline llvm::Expected<
mlir::concretelang::ClientServer<mlir::concretelang::JitLambdaSupport>>
internalCheckedJit(llvm::StringRef src, llvm::StringRef func = "main",
bool useDefaultFHEConstraints = false,
bool autoParallelize = false) {
bool dataflowParallelize = false,
bool loopParallelize = false) {
auto options =
mlir::concretelang::CompilationOptions(std::string(func.data()));
if (useDefaultFHEConstraints)
options.v0FHEConstraints = defaultV0Constraints;
// Allow loop parallelism in all cases
options.loopParallelize = loopParallelize;
#ifdef CONCRETELANG_PARALLEL_EXECUTION_ENABLED
#ifdef CONCRETELANG_PARALLEL_TESTING_ENABLED
options.autoParallelize = true;
options.dataflowParallelize = true;
options.loopParallelize = true;
#else
options.autoParallelize = autoParallelize;
options.dataflowParallelize = dataflowParallelize;
#endif
#endif
auto lambdaOrErr =
mlir::concretelang::ClientServer<mlir::concretelang::JitLambdaSupport>::
create(src, options, getTestKeySetCache(),