[Mlir-commits] [mlir] [MLIR][SCFToOpenMP] Add num-threads option (PR #74854)

Hans Pabst llvmlistbot at llvm.org
Mon Dec 11 05:31:16 PST 2023


================
@@ -340,8 +340,10 @@ namespace {
 
 struct ParallelOpLowering : public OpRewritePattern<scf::ParallelOp> {
 
-  ParallelOpLowering(MLIRContext *context)
-      : OpRewritePattern<scf::ParallelOp>(context) {}
+  unsigned numThreads;
+
+  ParallelOpLowering(MLIRContext *context, unsigned numThreads)
----------------
hfp wrote:

I would be careful about default values in this context. Perhaps rely on a default like "0" to denote "default". This is because OpenMP's default behavior for the default number of threads is "all available threads". Hence for instance defaulting to one ("1") may be counterintuitive wrt OpenMP (although it might actually improve performance ;-).

https://github.com/llvm/llvm-project/pull/74854


More information about the Mlir-commits mailing list