[flang-commits] [flang] [llvm] [OpenMPIRBuilder] Always inline device-outlined target regions (PR #211136)
Spencer Bryngelson via flang-commits
flang-commits at lists.llvm.org
Wed Jul 22 06:51:15 PDT 2026
sbryngelson wrote:
Root-caused properly in https://github.com/llvm/llvm-project/issues/211132#issuecomment-5046797165. Correcting two things I said here.
The inline cost is not the cause. The outlined region ends up with two callsites in the kernel rather than one, because flang's workshare-loop scheme leaves `MayUseNestedParallelism = 1` in the kernel environment, which keeps the serialized branch in `__kmpc_parallel_60` live. Two callsites forfeits `LastCallToStaticBonus`, worth 165000 on AMDGPU. Starting cost is -165045 with one callsite and -45 with two, so the threshold never matters in the case that works.
The `private()` pointer indirection I blamed is not it either. It accounts for 720 of the cost and is irrelevant to the outcome.
`-fopenmp-assume-no-nested-parallelism` avoids the whole thing on unpatched upstream today, 1.30x to 1.77x on gfx942 with bit-identical output. The real fix is in `AAKernelInfo`, not here. Keeping this draft for the analysis only; it should not merge.
https://github.com/llvm/llvm-project/pull/211136
More information about the flang-commits
mailing list