Skip to content

Do not stamp reqd_sub_group_size on kernels with indirect calls (#1380) - #1386

Open
pvelesko wants to merge 1 commit into
mainfrom
2026-07-28-warps-indirect-argdrop
Open

Do not stamp reqd_sub_group_size on kernels with indirect calls (#1380)#1386
pvelesko wants to merge 1 commit into
mainfrom
2026-07-28-warps-indirect-argdrop

Conversation

@pvelesko

Copy link
Copy Markdown
Collaborator

HipWarpsPass stamps intel_reqd_sub_group_size on every kernel in a module as soon as one shuffle or ballot intrinsic is declared anywhere in it. A stamped kernel then silently drops every argument after the first of a device indirect call, with no error and no diagnostic. One #include <Kokkos_Core.hpp> is enough to trigger it, so every Kokkos application that dispatches on the device computed garbage.

Skip kernels that can reach an indirect call over direct edges, and leave every other kernel stamped exactly as before.

Fixes #1380

HipWarpsPass puts intel_reqd_sub_group_size on every kernel in the module as
soon as one shuffle/ballot declaration appears anywhere in it, so that __shfl
and friends see the warp width chipStar was built for.

A stamped kernel silently loses the arguments of a device indirect call. The
callee receives the first argument and every argument after it arrives as
zero, with no error and no diagnostic.

Kokkos declares the shuffle intrinsics from Kokkos_Core.hpp, so a single
#include stamped an entire application and broke device-side indirect dispatch
for every Kokkos program. Virtual calls lower to the same indirect call, and
kynema-ugf / Nalu-Wind builds its whole Kernel, NodeKernel, EdgeKernel,
MasterElement and CoeffApplier architecture on exactly that, so it linked and
ran while computing garbage.

Skip kernels that can reach an indirect call over direct edges, and leave
every other kernel exactly as before. Narrowing the stamp the other way, to
only those kernels that provably reach a sensitive function, was tried first
and is wrong today: WarpSizeSensitiveFuncNames lists only some of the shuffle
overloads, so Kokkos' own reductions lost the subgroup size they depend on and
started accumulating each contribution four times.

Reduced reproducer, plain HIP, no Kokkos: adding one unused __global__ that
calls __shfl turns a correct indirect dispatch of f(7.0, 3) from 7036.0 into
7006.0. That is TestIndirectCallWithWarpPrimitive.hip.

Fixes #1380
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Device indirect calls silently drop every argument after the first when a warp intrinsic is declared

1 participant