Skip to content

Commit 3d50325

Browse files
committed
[Offload] Guard HSA implicit arguments if they aren't created
Summary: We conditionally allocate the implicit arguments, so they possibly are null. The flang compiler seems to hit this case, even though it shouldn't when it's supposed to conform to the HSA code object. For now guard this to fix the regression and cover a case in the future where someone rolls a fully custom implementatation. Fixes: #132982
1 parent 60eb89f commit 3d50325

File tree

1 file changed

+12
-10
lines changed
  • offload/plugins-nextgen/amdgpu/src

1 file changed

+12
-10
lines changed

offload/plugins-nextgen/amdgpu/src/rtl.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3386,16 +3386,18 @@ Error AMDGPUKernelTy::launchImpl(GenericDeviceTy &GenericDevice,
33863386
return Err;
33873387

33883388
// Set the COV5+ implicit arguments to the appropriate values.
3389-
ImplArgs->BlockCountX = NumBlocks[0];
3390-
ImplArgs->BlockCountY = NumBlocks[1];
3391-
ImplArgs->BlockCountZ = NumBlocks[2];
3392-
ImplArgs->GroupSizeX = NumThreads[0];
3393-
ImplArgs->GroupSizeY = NumThreads[1];
3394-
ImplArgs->GroupSizeZ = NumThreads[2];
3395-
ImplArgs->GridDims = NumBlocks[2] * NumThreads[2] > 1
3396-
? 3
3397-
: 1 + (NumBlocks[1] * NumThreads[1] != 1);
3398-
ImplArgs->DynamicLdsSize = KernelArgs.DynCGroupMem;
3389+
if (ImplArgs) {
3390+
ImplArgs->BlockCountX = NumBlocks[0];
3391+
ImplArgs->BlockCountY = NumBlocks[1];
3392+
ImplArgs->BlockCountZ = NumBlocks[2];
3393+
ImplArgs->GroupSizeX = NumThreads[0];
3394+
ImplArgs->GroupSizeY = NumThreads[1];
3395+
ImplArgs->GroupSizeZ = NumThreads[2];
3396+
ImplArgs->GridDims = NumBlocks[2] * NumThreads[2] > 1
3397+
? 3
3398+
: 1 + (NumBlocks[1] * NumThreads[1] != 1);
3399+
ImplArgs->DynamicLdsSize = KernelArgs.DynCGroupMem;
3400+
}
33993401

34003402
// Push the kernel launch into the stream.
34013403
return Stream->pushKernelLaunch(*this, AllArgs, NumThreads, NumBlocks,

0 commit comments

Comments
 (0)