Branch: refs/heads/main
Revision: 2a69071
Author: e-kayrakli
Link: Fix GPU outliner to handle promotions properly by e-kayrakli · Pull Request #19437 · chapel-lang/chapel · GitHub
Log Message:
Merge pull request #19437 from e-kayrakli/gpu-promotion
Fix GPU outliner to handle promotions properly
Previously, we were only able to handle very basic promotions (like A=1
).
However, more complicated ones (like A = B + alpha * C
) are handled mostly by
the compiler and weren't working before. This was mainly due to the
indexOfInterest
we create for promoted expressions being a special case.
In a nutshell, at the point where we do GPU outlining, they are refs defined
outside of the loop but use'd and def'd only inside it. Moreover, one of the
def's are redunant and should be removed. This PR adds a check towards such
variables and makes them a local variable to the kernel instead of trying to
pass them as an argument to the kernel (which was causing segfaults before).
While there, this PR also avoids passing symbols that appear multiple times
inside a loop as multiple different arguments. This is handled by a simple
std::set
that acts as a cache while creating kernel arguments.
[Reviewed by @daviditen]
Test:
-
[x] gpu/native
Modified Files:
A test/gpu/native/promotion2.chpl
A test/gpu/native/promotion2.execopts
A test/gpu/native/promotion2.good
A test/gpu/native/promotion2.prediff
M compiler/optimizations/gpuTransforms.cppCompare: Comparing 64258189c042...2a69071a9806 · chapel-lang/chapel · GitHub