ro-i wrote:

before commenting on details, I'd like to ask a few clarifying questions 
because I'm a bit confused what's going on here.

Afaiu, no-loop is essentially a loop where we can size the grid such that there 
is a 1:1 mapping between threads and loop iterations such that no thread has to 
actually loop.
Basically, we need to do two things to make that happen: adapt the index 
computation and the grid size selection.*

The index computation will look like `idx = blockIdx * blockDim + threadIdx` 
(if idx < #elements). I wonder: that should be the exact same idx computation 
that is also used for big-jump loop, no? Aka, isn't no-loop just a variant of 
big-jump loop?

Regarding the grid size selection: afaiu, we key it using the no-loop exec 
mode. But is that really necessary? Can't we just say for *every* loop: hey, if 
the grid size allows us to do the 1:1 mapping between threads and iterations 
(or if we're allowed to embiggen the grid size such that this becomes 
possible), then let's do it since it's unconditionally beneficial. (Although 
the "unconditionally beneficial" part might be a question, not something I know 
or have measured at this point.)

*From this POV, I wonder why this PR does so much work? If I understand 
correctly, the goal is to converge clang and OMPIRBuilder/flang? But then, 
there should probably be an appropriate refactoring, if needed, because the 
work duplication for no-loop in `clang/lib/CodeGen/CGStmtOpenMP.cpp` seems very 
error-prone to me, tbh. Naively speaking, I don't really see why we need that 
much just to have a different index computation.

https://github.com/llvm/llvm-project/pull/205325
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to