Skip to content

[SYCL][HIP] Fix crash from SYCL buffer destructors during shutdown#22679

Open
zjin-lcf wants to merge 1 commit into
intel:syclfrom
zjin-lcf:sycl-hip-fix-static-buffer-dtor
Open

[SYCL][HIP] Fix crash from SYCL buffer destructors during shutdown#22679
zjin-lcf wants to merge 1 commit into
intel:syclfrom
zjin-lcf:sycl-hip-fix-static-buffer-dtor

Conversation

@zjin-lcf

Copy link
Copy Markdown
Contributor

Summary

  • Fix a shutdown crash triggered by SYCL buffer destructors: make waits during shutdown optional and tolerate HIP errors (e.g. context already destroyed) during event release.
  • Re-enable Regression/static-buffer-dtor on HIP.

Test plan

  • Regression/static-buffer-dtor passes on gfx942 (repeated runs)

Relates to #22300

Static SYCL buffer destructors run after the runtime has begun shutting
down (their atexit handlers are registered before the runtime's). On HIP
this crashed twice: waiting on events whose stream/context was already
released segfaults inside libamdhip64, and releasing those events returns
hipErrorContextIsDestroyed which was thrown out of the event_impl
destructor.

- Scheduler::removeMemoryObject: extend the existing Windows-only
  "skip wait during shutdown" guard to all platforms. Host memory is not
  written back during shutdown anyway, so the wait serves no purpose and
  is unsafe against partially torn-down adapters.
- HIP adapter event release(): treat hipErrorContextIsDestroyed and
  hipErrorDeinitialized as a successful release instead of surfacing an
  exception.

Re-enables Regression/static-buffer-dtor.cpp on HIP.

Co-authored-by: Cursor <cursoragent@cursor.com>
@zjin-lcf
zjin-lcf requested review from a team as code owners July 19, 2026 21:50
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.

1 participant