[Mlir-commits] [mlir] [MLIR][SCFToOpenMP] Add num-threads option (PR #74854)
Pablo Antonio Martinez
llvmlistbot at llvm.org
Mon Dec 11 05:06:38 PST 2023
================
@@ -390,6 +392,12 @@ struct ParallelOpLowering : public OpRewritePattern<scf::ParallelOp> {
// Create the parallel wrapper.
auto ompParallel = rewriter.create<omp::ParallelOp>(loc);
+ if (numThreads > 1) {
+ rewriter.setInsertionPoint(ompParallel);
+ mlir::Value numThreadsVar = rewriter.create<LLVM::ConstantOp>(
+ loc, rewriter.getI32IntegerAttr(numThreads));
+ ompParallel.getNumThreadsVarMutable().assign(numThreadsVar);
----------------
pabloantoniom wrote:
I have changed this and now I set it in the constructor, although I'm not quite sure if how I did it is the "standard" way or if there is a cleaner way.
https://github.com/llvm/llvm-project/pull/74854
More information about the Mlir-commits
mailing list