Skip to content

[FIX][ROCm] Use HIP for device existence checks - #20545

Open
oraluben wants to merge 3 commits into
apache:mainfrom
oraluben:codex/windows-rocm-device-query-upstream
Open

oraluben wants to merge 3 commits into
apache:mainfrom
oraluben:codex/windows-rocm-device-query-upstream

Conversation

@oraluben

@oraluben oraluben commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

ROCm device existence checks directly include hsa/hsa.h and call HSA initialization/shutdown around a HIP query. The tested Windows ROCm 10.0 pip SDK omits that header, preventing compilation, although its HIP DLL exports working HSA functions.

Use hipGetDeviceCount on Linux and Windows. HIP automatically initializes its runtime; on the ROCr path this includes HSA initialization and cleanup. Removing TVM's extra HSA reference does not bypass that initialization. Return false on HIP errors or invalid ordinals, remove unused HSA discovery/linkage, and add portable device-query regressions.

Validation:

  • Windows: actual upstream runtime source compiles with the selected SDK. The downstream mirror passes all 5 device tests and 10 GPU numerical tests on both TileLang adapters. A standalone process, with no Torch or explicit HIP/HSA initialization, passes the first device query, 400 concurrent queries, allocation and GPU copies.
  • Linux/WSL: built both upstream ROCm runtime targets and the mirror runtime against TileLang's HIP stub; actual device API queries safely report absent/invalid devices. The consumer's 12 stub regressions and real ELF symbol-reuse probe pass. Also checked the implicit initialization path in ROCm 6.2.4 sources.

Linux GPU execution and a full upstream compiler build were not tested. Mirror: tile-ai#79. Consumer: tile-ai/tilelang#3425.

@oraluben oraluben changed the title [FIX][ROCm] Query Windows device existence through HIP [FIX][ROCm] Query device existence through HIP without HSA Oct 4, 2026
@oraluben oraluben changed the title [FIX][ROCm] Query device existence through HIP without HSA [FIX][ROCm] Use HIP for device existence checks Oct 4, 2026
@oraluben
oraluben marked this pull request as ready for review October 4, 2026 06:41

This branch has not been deployed

No deployments
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