From cf32638264eb90399401feb07249013371dbb43a Mon Sep 17 00:00:00 2001 From: Antoniu Pop Date: Fri, 19 Jul 2024 16:51:33 +0100 Subject: [PATCH] fix(compiler): [GPU+DFR runtime] add sanity check to prevent both dataflow parallelization and GPU offload to be activated jointly as this is not yet supported. --- .../compiler/lib/Support/CompilerEngine.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/compilers/concrete-compiler/compiler/lib/Support/CompilerEngine.cpp b/compilers/concrete-compiler/compiler/lib/Support/CompilerEngine.cpp index 9bd105b983..158a1df15b 100644 --- a/compilers/concrete-compiler/compiler/lib/Support/CompilerEngine.cpp +++ b/compilers/concrete-compiler/compiler/lib/Support/CompilerEngine.cpp @@ -300,9 +300,6 @@ CompilerEngine::compile(mlir::ModuleOp moduleOp, Target target, if (loopParallelize) mlir::concretelang::dfr::_dfr_set_use_omp(true); - if (dataflowParallelize) - mlir::concretelang::dfr::_dfr_set_required(true); - // Sanity checks for enabling GPU usage: the compiler must have been // compiled with Cuda support (especially important when building // python wheels), and at least one device must be available to @@ -340,8 +337,22 @@ CompilerEngine::compile(mlir::ModuleOp moduleOp, Target target, options.batchTFHEOps = false; } } + + // Finally for now we cannot allow dataflow parallelization at the + // same time as GPU usage. This restriction will be relaxed later. + if (dataflowParallelize) { + warnx("Dataflow parallelization and GPU offloading have both been " + "requested. This is not currently supported. Continuing without " + "dataflow parallelization."); + dataflowParallelize = false; + } } + // If dataflow parallelization will proceed, mark it for + // initialising the runtime + if (dataflowParallelize) + mlir::concretelang::dfr::_dfr_set_required(true); + mlir::OwningOpRef mlirModuleRef(moduleOp); res.mlirModuleRef = std::move(mlirModuleRef); mlir::ModuleOp module = res.mlirModuleRef->get();