Repository navigation
fix(clr): keep hipLaunchKernelEx cluster dimensions in stream capture - #14228
Conversation
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🚫 Please fix the failed policies before requesting reviews. The following policy checks failed:
The |
There was a problem hiding this comment.
🔵 Needs a closer look
No concrete defects were identified, but capture-and-replay behavior still needs validation on cluster-capable hardware before final human approval.
No open issues 🎉
What changed in this PR
This PR fixes HIP stream capture so hipLaunchKernelEx preserves explicit cluster dimensions in captured kernel nodes while retaining existing fallback behavior when dimensions are omitted.
Changes:
- Forward decoded cluster dimensions through the common launch capture hook.
- Preserve kernel-defined cluster requirements and continue dropping the dynamic data prefetch hint.
- Add and register regression tests checking captured node attributes and replayed cluster shapes.
| File | Description |
|---|---|
| projects/hip-tests/catch/unit/cluster/hipClusterStreamCapture.cc | Tests explicit, omitted, and compiler-defined cluster dimensions during capture and replay. |
| projects/hip-tests/catch/unit/cluster/CMakeLists.txt | Adds the new test source to the build. |
| projects/hip-tests/catch/config/configs/unit/cluster.yaml | Registers both stream-capture test cases. |
| projects/clr/hipamd/src/hip_module.cpp | Forwards cluster arguments to the common capture hook. |
| projects/clr/hipamd/src/hip_graph.cpp | Passes explicit dimensions or the fallback sentinel to kernel-node creation. |
| projects/clr/hipamd/src/hip_graph_capture.hpp | Declares the updated capture hook and prefetch configuration type. |
Review effort: Balanced
e2d3157 to
c355437
Compare
c355437 to
d133b00
Compare
hipLaunchKernelExC decodes hipLaunchAttributeClusterDimension and passes the
cluster dimensions to hipLaunchKernel_common, but the capture hook there only
forwarded the plain hipLaunchKernel arguments. A captured launch therefore lost
its cluster dimensions: the kernel node fell back to the kernel's own
requirement, or to no cluster, and replayed with the wrong cluster shape.
hipDrvLaunchKernelEx capture was not affected.
Replace capturehipLaunchKernel with capturehipLaunchKernelCommon, which takes
the decoded cluster dimensions and passes them to the kernel node when they
were given explicitly. When they were not, it passes {0,0,0} as before, so the
node still resolves __cluster_dims__ or a runtime cluster attribute. The
dynamic data prefetch hint is still dropped from the captured node, as before.
Add ClusterTest cases that capture hipLaunchKernelEx with and without a cluster
attribute, and launches of a __cluster_dims__ kernel without cluster
dimensions, and check both the captured node's cluster attribute and the
cluster shape seen by the replayed blocks.
Co-Authored-By: Claude <noreply@anthropic.com>
…ure tests Co-Authored-By: Claude <noreply@anthropic.com>
999f1e4 to
c8c5fb6
Compare
|
🤖 AI-assisted pre-review (for @mangupta) Re-reviewed the updated head ( |
TheRock Submodule Bump ActivityNewest first
|
Motivation
hipLaunchKernelExwithhipLaunchAttributeClusterDimensionloses its cluster dimensions when the launch is stream-captured.hipLaunchKernelExCpasses the decoded cluster dimensions tohipLaunchKernel_common, but the capture hook there only forwarded the plainhipLaunchKernelarguments. The kernel node then fell back to the kernel's__cluster_dims__(or no cluster), and the graph replayed with the wrong cluster shape.hipDrvLaunchKernelExcapture is not affected.Technical Details
capturehipLaunchKernelis replaced bycapturehipLaunchKernelCommon, which takes the cluster dimensions fromhipLaunchKernel_common.{0,0,0}is passed as before, so the node still resolves__cluster_dims__or a runtime cluster attribute.hipClusterStreamCapture.ccin ClusterTest. Both tests check the captured node'shipLaunchAttributeClusterDimensionand the cluster shape seen by the replayed blocks:Unit_hipClusterLaunch_StreamCapture_LaunchAttribute:hipLaunchKernelExwith and without a{2,1,1}cluster attribute.Unit_hipClusterLaunch_StreamCapture_CompilerDirective: a__cluster_dims__(2,1,1)kernel launched viahipLaunchKernelGGL,hipLaunchKernelExwithout attributes, andhipLaunchKernelExwith a matching attribute.Issue Tracking
JIRA ID: AIRUNTIME-3085
Test Plan
Unit_hipClusterLaunch_StreamCapture_*on a device with cluster launch support, develop vs this PR.Test Result
Submission Checklist