Skip to content

Fix: Wrong handle in multi-stream handle test#186

Merged
sjain-stanford merged 2 commits into
mainfrom
sambhav/handle_test
Feb 24, 2026
Merged

Fix: Wrong handle in multi-stream handle test#186
sjain-stanford merged 2 commits into
mainfrom
sambhav/handle_test

Conversation

@sjain-stanford

@sjain-stanford sjain-stanford commented Feb 24, 2026

Copy link
Copy Markdown
Member

The multi-stream handle test failed flakily on a recent CI run on main: https://github.com/iree-org/fusilli/actions/runs/22334529677/job/64623964052

-------------------------------------------------------------------------------
Handle creation with stream and deviceId
  Create multiple handles with different HIP streams
-------------------------------------------------------------------------------
/workspace/tests/hip_tests/test_handle.cpp:92
...............................................................................

/workspace/tests/hip_tests/test_handle.cpp:136: FAILED:
  REQUIRE( readData == hostData )
with expansion:
  { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.
  0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
  0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }
  ==
  { 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.
  14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.
  14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f, 3.14f }

terminate called after throwing an instance of 'std::bad_variant_access'
  what():  std::get: wrong index for variant
/workspace/tests/hip_tests/test_handle.cpp:136: FAILED:
  {Unknown expression after the reported line}
due to a fatal error condition:
  SIGABRT - Abort (abnormal termination) signal
  • Fixed copy-paste bug in test_handle.cpp where the "Create multiple handles with different HIP streams" test was using handle1 instead of handle2 for the second buffer's allocate and read calls
  • (I'm not sure if this is accurate) This could have caused a cross-stream race condition resulting in flaky D2H reads returning all zeros instead of the expected 3.14f values

🤖 Generated with Claude Code

The second buffer allocate/read in "Create multiple handles with
different HIP streams" was using handle1 instead of handle2, causing
a cross-stream race that resulted in flaky D2H reads of all zeros.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Sambhav Jain <sambhav@alumni.stanford.edu>
@sjain-stanford sjain-stanford changed the title Fix wrong handle in multi-stream handle test Fix: Wrong handle in multi-stream handle test Feb 24, 2026
@sjain-stanford sjain-stanford enabled auto-merge (squash) February 24, 2026 19:16
@AaronStGeorge

Copy link
Copy Markdown
Contributor

This could have caused a cross-stream race condition resulting in flaky D2H reads returning all zeros instead of the expected 3.14f values

The fix is definitely what we want, but I'm a little lost as to why it would cause a race condition. Everything should have been stream ordered on handle 1.

@sjain-stanford sjain-stanford merged commit cb02830 into main Feb 24, 2026
10 of 12 checks passed
@sjain-stanford sjain-stanford deleted the sambhav/handle_test branch February 24, 2026 19:35
@sjain-stanford

Copy link
Copy Markdown
Member Author

The fix is definitely what we want, but I'm a little lost as to why it would cause a race condition. Everything should have been stream ordered on handle 1.

Hence my prefix on what Claude generated :P
(I'm not sure if this is accurate)

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.

2 participants