From 0b14f4c7c54dcb84d31e9ca819507aa708ddef85 Mon Sep 17 00:00:00 2001 From: Antoniu Pop Date: Wed, 30 Mar 2022 23:33:58 +0100 Subject: [PATCH] feat(test): allow selecting loop/dataflow parallelism independently in tests and enable loop parallelism selection by default. --- compiler/tests/TestLib/CMakeLists.txt | 1 + compiler/tests/unittest/end_to_end_jit_test.h | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/compiler/tests/TestLib/CMakeLists.txt b/compiler/tests/TestLib/CMakeLists.txt index 7631912b3..bf0141967 100644 --- a/compiler/tests/TestLib/CMakeLists.txt +++ b/compiler/tests/TestLib/CMakeLists.txt @@ -17,6 +17,7 @@ target_link_libraries( testlib_unit_test ConcretelangRuntime ConcretelangSupport + DFRuntime gtest_main ) diff --git a/compiler/tests/unittest/end_to_end_jit_test.h b/compiler/tests/unittest/end_to_end_jit_test.h index bb3bec6bc..bbc26aca8 100644 --- a/compiler/tests/unittest/end_to_end_jit_test.h +++ b/compiler/tests/unittest/end_to_end_jit_test.h @@ -131,17 +131,25 @@ inline llvm::Expected< mlir::concretelang::ClientServer> 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:: create(src, options, getTestKeySetCache(),