Skip to content

Fix hang on exit and build issues on Windows - #105

Open
pschlan-amd wants to merge 2 commits into
AMD-Ecosystem:hrx-graph-develop-v2from
pschlan-amd:fix/windows-hang-on-exit
Open

pschlan-amd wants to merge 2 commits into
AMD-Ecosystem:hrx-graph-develop-v2from
pschlan-amd:fix/windows-hang-on-exit

Conversation

@pschlan-amd

@pschlan-amd pschlan-amd commented Sep 18, 2026

Copy link
Copy Markdown

Overview

Fix a few issues discovered on Windows:

  • Linking issues (missing IMPLIB, missing DLL exports)
  • Hang-on-exit due to teardown of GPU from the registry destructor (which in exit() case happens when HSA-related threads are already dead)
  • Fix test build failures due to POSIX-only env manipulation APIs

Additional information

  • ggml_backend_hrx_reg_context now doesn't clean up after itself anymore and leaves this to the OS. This seems to be the pattern other backends also follow. Since this is owned by the process-lifetime registry, there should be no real leaks coming from this.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES, Cursor was used for RCA of the hang-on-exit and the fix draft as well as the build system fixes

pschlan-amd and others added 2 commits September 18, 2026 16:56
The HRX registry lives in a function-local static, so its destructor runs during DLL_PROCESS_DETACH. On Windows that is after ExitProcess has already killed every other thread, including HSA's, and hrx_gpu_shutdown then hangs in hsa_queue_destroy. Leave device state for the OS on process exit; call hrx_gpu_shutdown from live application code if the process will continue without HRX.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@pschlan-amd pschlan-amd changed the title Fix/windows hang on exit Fix hang on exit and build issues on Windows Sep 18, 2026
@pschlan-amd
pschlan-amd marked this pull request as ready for review September 18, 2026 15:21
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