Repository navigation
Key the stream pool on the task's device - #1159
Merged
Merged
Conversation
`task_stream` picked the pool from `HIP.device()`, i.e. `hipGetDevice`, which skips `prepare_state` and reports the device the thread was last used with. A fresh task on another device could then claim an idle stream of the wrong device, and its kernel launches failed with `hipErrorInvalidHandle`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
AMDGPU.jl BenchmarksDetails
This comment was automatically generated by workflow using github-action-benchmark. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a regression from #1120 that made
core/codegen"Launch bounds" fail withhipErrorInvalidHandleon CSCS MI250 (Julia 1.13, main 9d33b4b).HIP.task_streampicks the pool fromHIP.device(). That ishipGetDevice, the one wrapper withoutprepare_state(), so it returns the device the OS thread was last used with, not the task's device. A fresh task on device 2, running on a thread last used with device 1, claims an idle device-1 stream. Its module is loaded on device 2, and HIP rejects the launch because the stream belongs to another device (ihipModuleLaunchKernel:stream device != ihipGetDevice()→hipErrorInvalidResourceHandle).In CI, the KernelInterface testsuite's cross-device events test leaves device 2 as the default device (#1105, item 3), and its main task leaves an idle device-1 stream in the pool.
core/codegenran next on the same worker, and "Launch bounds" is its only launch.The fix picks the pool from
AMDGPU.device(), the task's device. That matches howtest/core/tls.jlalready looks up the pool.Validated on MI250X (beverin mi200, Julia 1.13):
multi_gputest "Pooled streams match the task's device": fails on main (47/48), passes with the fix (48/48)kernelinterface_tests→core/codegenin the same process: every launch fails on main, all pass with the fixcore/tlspasses