Issue 238409
Summary [offload][AMDGPU] Stuck async mem copies
Labels
Assignees ro-i
Reporter ro-i
    This issue is to inform people why https://lab.llvm.org/buildbot/#/builders/234 is sometimes timeouting for [offloading/kernel_launch_environment_reduction.c](https://github.com/llvm/llvm-project/blob/53c7d67c0fea4a44475bb2357115c1c8ad336995/offload/test/offloading/kernel_launch_environment_reduction.c).

The issue is not due to any recent changes. A build from Oct 4 fails as well. It's not introduced by the PR that added the affected test (aka, https://github.com/llvm/llvm-project/pull/231923). For everything I know at the moment, this test is just exposing a pre-existing issue.

Despite its name, the test is not specifically testing reductions. It's about the KLE (not to be confused with the kernel environment) - reductions are just one way of triggering the addition of a KLE for an OpenMP kernel (dynamic group memory would be another option).

This test seems to also accidentally stress-testing concurrent H2D transfers in general.

Obviously, I'm debugging and fixing the issue. As a rough overview of where that might lead, below a preliminary analysis by Claude.

In the meantime, I think there might be two temporary workarounds to unblock the buildbot:
1) Rewriting the test to not trigger the issue
2) Setting the test to unsupported

There is not really a point in reverting PRs (imho) since the failures can also be triggered without these PRs.

@jhuber6 @adurang 

Claude's analysis:

> I've narrowed the hang down to copy operations that never complete on the GPU. It isn't caused by the recent KLE or direct-write commits, and it already happened with a toolchain from a month ago. I haven't found the root cause yet.
> 
> How it hangs. I caught 4 hangs under gdb with debug-info runtimes and dumped the plugin's stream state and the HSA queue:
> - The host is idle. Every helper thread waits in AMDGPUSignalTy::wait (rtl.cpp:938) inside AMDGPUStreamTy::synchronize [...]. No callback or lock is blocking anything.
> - The stuck work is async copies that never finish even though their dependencies are done: staged H2D copies after a completed host memcpy, D2H copies after a completed kernel, and H2D copies with no dependencies at all.
> - One of those copies is the dependency of the BARRIER_AND packet at the read index of the HSA queue that most streams share. Every kernel queued behind it waits, which is why the whole process hangs instead of just one target region.
> 
> [...]
> 
> Caveats:
> - I can only trigger it with very heavy load: 24 processes sharing the GPU, 8 of them in record mode, which reserves 8 GiB each. I don't know what load the CI container sees.
> [...]
> - Record mode, when its 8 GiB reservation fails with OUT_OF_RESOURCES, keeps running and reports wrong results instead of aborting. That's a separate bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to