[all-commits] [llvm/llvm-project] 652436: [OpenMPOpt] Ask the runtime how many of a block's ...
Larry Meadows via All-commits
all-commits at lists.llvm.org
Fri Sep 11 12:46:30 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 652436711805b4aa035341324465c880f19d297d
https://github.com/llvm/llvm-project/commit/652436711805b4aa035341324465c880f19d297d
Author: Larry Meadows <Lawrence.Meadows at amd.com>
Date: 2026-09-11 (Fri, 11 Sep 2026)
Changed paths:
M llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
M llvm/lib/Transforms/IPO/OpenMPOpt.cpp
M llvm/test/Transforms/OpenMP/callback_parallel_regions.ll
M llvm/test/Transforms/OpenMP/custom_state_machines.ll
M llvm/test/Transforms/OpenMP/spmdization.ll
M llvm/test/Transforms/OpenMP/spmdization_guarding.ll
M llvm/test/Transforms/OpenMP/spmdization_indirect.ll
M llvm/test/Transforms/OpenMP/spmdization_no_guarding_two_reaching_kernels.ll
M openmp/device/include/Interface.h
M openmp/device/src/Mapping.cpp
Log Message:
-----------
[OpenMPOpt] Ask the runtime how many of a block's threads can be workers (#221450)
The custom state machine gates a thread on `InitCB < BlockHwSize -
WarpSize`,
reconstructing the worker count from the block size on the assumption
that the
main thread occupies a whole warp above them. That arithmetic has to be
kept in
step with whatever launch geometry the toolchain uses, and when it is
not, the
workers in between are left in neither group, waiting for no parallel
region
while the runtime hands them iterations.
Export the number the device runtime already computes in
`mapping::getMaxTeamThreads()`, which its own generic state machine
gates on, as
`__kmpc_get_max_team_threads()`, and gate on that instead. The new entry
point is
added to the virtual-use callback that keeps the state machine's callees
alive,
and the existing `runtimeFnsAvailable()` check skips the rewrite against
an older
device runtime.
NFC upstream, where `getMaxTeamThreads()` is `BlockSize - WarpSize`. It
matters
for a toolchain whose block is not laid out that way, and it is what
lets the
arithmetic live in one place.
Depends on #221449; the first commit is from that PR.
Tested on gfx90a: `llvm/test/Transforms/{OpenMP,Attributor}` 260 passed,
1
unsupported. No kernel in the AOMP smoke and smoke-fort suites changes
execution
mode.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list