[PATCH] D148916: [Support][Parallel] Initialize threadIndex and add assertion checking its usage.

Chris Lattner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 08:40:15 PDT 2023


lattner added a comment.

I haven't looked in detail at this patch, but I can describe the problem that I was hitting.  The situation was happening in MLIR and other clients that have an expose nested parallelism, e.g. in its parallel pass manager.  The thread pool at the time refused to do nested cases in parallel, so if you did:

  parallel for x in ...
    parallel for y in ...
       work

it would do the outer loop in parallel and then refuse to do the inner loop in parallel.  This was sort of ok, but was really really bad when the outer loop actually had only a single entry.  That would end up running the inner loop in series even though there was no parallelism in play.

The change to do 0/1 without "parallelism" led to a 50x speedup on a CIRCT workload.  It also eliminates a bit of fixed overhead in those small cases, but that is a more minor issue.

-Chris


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148916/new/

https://reviews.llvm.org/D148916



More information about the llvm-commits mailing list