Repository navigation
fix(ck-tile): prefer amd-smi for dispatcher GPU-arch detection - #10445
Conversation
Extends the amd-smi-first migration (PR #9731, #10204) to the dispatcher. Adds detect_gpu_arch() to the shared smi_utils wrapper (amd-smi static TARGET_GRAPHICS_VERSION first, rocm-smi --showproductname GFX Version fallback) and routes the dispatcher arch detection through it: - dispatcher_common.detect_gpu_arch(): prefer amd-smi via the wrapper, then rocminfo, then the caller default. Also removes a duplicate definition of this function. - gemm_utils._get_arch(): try amd-smi via the wrapper before rocminfo, preserving the raise-on-unresolved (no silent default) behavior. The dispatcher reaches the sibling tile_engine/ops/common/smi_utils via a guarded import and degrades to rocminfo if it is unavailable, so behavior is unchanged on hosts without amd-smi. Adds mock-based unit tests for the new detect_gpu_arch() (amd-smi preference, rocm-smi fallback, default) plus a live check. Verified on MI350X/gfx950: both dispatcher arch helpers return gfx950 via amd-smi; test_gemm_utils 21/21 still pass. JIRA: ROCM-28734
✅ All Checks Passed — Ready for Review
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 All checks passed! This PR is ready for review. |
There was a problem hiding this comment.
Pull request overview
This PR extends the existing “amd-smi first, rocm-smi fallback” policy into GPU-architecture detection for the CK Tile Engine and the dispatcher, centralizing arch detection in smi_utils.detect_gpu_arch() and updating dispatcher-side detection to prefer that wrapper before falling back to rocminfo.
Changes:
- Added
detect_gpu_arch()totile_engine/ops/common/smi_utils.pyand corresponding unit/live tests. - Updated
dispatcher_common.detect_gpu_arch()to prefer the shared wrapper (and removed a duplicate function definition). - Updated
gemm_utils._get_arch()to try the shared wrapper beforerocminfo, while preserving “raise if unresolved” behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| projects/composablekernel/tile_engine/ops/common/test_smi_utils.py | Adds unit/live tests for detect_gpu_arch() behavior and preference ordering. |
| projects/composablekernel/tile_engine/ops/common/smi_utils.py | Introduces detect_gpu_arch() with amd-smi-first / rocm-smi fallback. |
| projects/composablekernel/dispatcher/python/gemm_utils.py | Tries wrapper-based arch detection before rocminfo in _get_arch(). |
| projects/composablekernel/dispatcher/python/dispatcher_common.py | Prefers wrapper-based arch detection and removes duplicate detect_gpu_arch(). |
…cher Addresses review feedback: the previous change only migrated dispatcher_common.detect_gpu_arch() and gemm_utils._get_arch(), leaving the busiest entry point (ctypes_utils.detect_gpu_arch(), used by every GEMM example) and grouped_conv_utils on rocminfo. Routes both through the shared amd-smi-first smi_utils wrapper (JIRA ROCM-28734) before rocminfo, so the title's "dispatcher GPU-arch detection" is now true end-to-end. DRY: the amd-smi bridge now lives once in dispatcher_common (_detect_gpu_arch_via_amd_smi); gemm_utils/ctypes_utils/grouped_conv_utils import it instead of re-implementing the sys.path reach. Copilot review: - smi_utils.detect_gpu_arch(): add Optional[str] type annotations and skip tools missing from PATH via shutil.which (consistent with the rest of the module) instead of relying on FileNotFoundError. - TestDetectGpuArch: force CK_SMI_TOOL off and mock shutil.which so the amd-smi-preference assertions are deterministic regardless of ambient env or host GPU tooling; add a tools-absent case. - Annotate the intentional best-effort broad excepts with noqa: BLE001. Verified: py_compile all six files; TestDetectGpuArch 5/5 pass; live host (gfx90a) resolves via amd-smi through all four helpers; gemm_utils reuses the canonical bridge (identity check).
Review self-assessment + follow-up changes (commit
|
Production source should not point to internal JIRA tickets; ticket context belongs in the PR/commit metadata instead.
|
Wanted to leave a note on why this change is still worth landing on top of #9731 and #10204, since at a glance it can look like more of the same amd-smi migration. Those two PRs both live entirely in Meanwhile every arch-detection entry point in the dispatcher is still shelling out to
So this PR is doing work the earlier two never covered: it adds the arch wrapper to the shared module and routes all four dispatcher paths through it, so device-property access is amd-smi first everywhere in CK instead of the dispatcher being the one island still on Two other things worth calling out. First, One honest caveat: the "rocm-smi is going away" reasoning from #9731 does not directly apply here, since the dispatcher was on Happy to move the shared wrapper to a neutral location if reviewers would rather not have the dispatcher reach into |
fix(ck-tile): prefer amd-smi for dispatcher GPU-arch
detection (#10445)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## Summary
Extends the amd-smi-first migration (#9731, #10204) from the Tile Engine
to the
dispatcher's GPU-architecture detection.
- Adds `detect_gpu_arch()` to the shared
`tile_engine/ops/common/smi_utils.py`
wrapper: amd-smi `static` (`TARGET_GRAPHICS_VERSION`) first, rocm-smi
`--showproductname` (`GFX Version`) fallback — same amd-smi-first policy
as the
rest of the wrapper.
- `dispatcher_common.detect_gpu_arch()`: prefers amd-smi via the
wrapper, then
rocminfo, then the caller-supplied default. Also removes a **duplicate**
definition of this function.
- `gemm_utils._get_arch()`: tries amd-smi via the wrapper before
rocminfo,
preserving the raise-on-unresolved (no silent default) behavior.
## Motivation
Per the directive behind #9731, device-property access should prefer
`amd-smi` (rocm-smi is being phased out). The Tile Engine was already
migrated
(#9731, #10204); the dispatcher still detected the GPU arch by shelling
out to
`rocminfo` directly. Tracked in JIRA **ROCM-28734**.
## Design note
The dispatcher reaches the sibling `tile_engine/ops/common/smi_utils.py`
through
a guarded import and falls back to `rocminfo` if the wrapper is
unavailable, so
behavior is unchanged on hosts without amd-smi. (Open to moving the
shared
wrapper to a neutral location if reviewers prefer avoiding the
dispatcher →
tile_engine reach.)
## Test plan (MI350X / gfx950)
- [x] New mock-based unit tests for `detect_gpu_arch()` (amd-smi
preference,
rocm-smi fallback, default) + a live check — 4/4 pass.
- [x] `dispatcher_common.detect_gpu_arch()` and `gemm_utils._get_arch()`
both
return `gfx950` via amd-smi on the live host.
- [x] `test_gemm_utils` 21/21 still pass (no arch-detection regression).
fix(ck-tile): prefer amd-smi for dispatcher GPU-arch detection
## Summary
Extends the amd-smi-first migration (#9731, #10204) from the Tile Engine
to the
dispatcher's GPU-architecture detection.
- Adds `detect_gpu_arch()` to the shared
`tile_engine/ops/common/smi_utils.py`
wrapper: amd-smi `static` (`TARGET_GRAPHICS_VERSION`) first, rocm-smi
`--showproductname` (`GFX Version`) fallback — same amd-smi-first policy
as the
rest of the wrapper.
- `dispatcher_common.detect_gpu_arch()`: prefers amd-smi via the
wrapper, then
rocminfo, then the caller-supplied default. Also removes a **duplicate**
definition of this function.
- `gemm_utils._get_arch()`: tries amd-smi via the wrapper before
rocminfo,
preserving the raise-on-unresolved (no silent default) behavior.
## Motivation
Per the directive behind #9731, device-property access should prefer
`amd-smi` (rocm-smi is being phased out). The Tile Engine was already
migrated
(#9731, #10204); the dispatcher still detected the GPU arch by shelling
out to
`rocminfo` directly. Tracked in JIRA **ROCM-28734**.
## Design note
The dispatcher reaches the sibling `tile_engine/ops/common/smi_utils.py`
through
a guarded import and falls back to `rocminfo` if the wrapper is
unavailable, so
behavior is unchanged on hosts without amd-smi. (Open to moving the
shared
wrapper to a neutral location if reviewers prefer avoiding the
dispatcher →
tile_engine reach.)
## Test plan (MI350X / gfx950)
- [x] New mock-based unit tests for `detect_gpu_arch()` (amd-smi
preference,
rocm-smi fallback, default) + a live check — 4/4 pass.
- [x] `dispatcher_common.detect_gpu_arch()` and `gemm_utils._get_arch()`
both
return `gfx950` via amd-smi on the live host.
- [x] `test_gemm_utils` 21/21 still pass (no arch-detection regression).
---------
Co-authored-by: Muhammed Emin Ozturk <3836908+ozturkosu@users.noreply.github.com>
Summary
Extends the amd-smi-first migration (#9731, #10204) from the Tile Engine to the
dispatcher's GPU-architecture detection.
detect_gpu_arch()to the sharedtile_engine/ops/common/smi_utils.pywrapper: amd-smi
static(TARGET_GRAPHICS_VERSION) first, rocm-smi--showproductname(GFX Version) fallback — same amd-smi-first policy as therest of the wrapper.
dispatcher_common.detect_gpu_arch(): prefers amd-smi via the wrapper, thenrocminfo, then the caller-supplied default. Also removes a duplicate
definition of this function.
gemm_utils._get_arch(): tries amd-smi via the wrapper before rocminfo,preserving the raise-on-unresolved (no silent default) behavior.
Motivation
Per the directive behind #9731, device-property access should prefer
amd-smi(rocm-smi is being phased out). The Tile Engine was already migrated(#9731, #10204); the dispatcher still detected the GPU arch by shelling out to
rocminfodirectly. Tracked in JIRA ROCM-28734.Design note
The dispatcher reaches the sibling
tile_engine/ops/common/smi_utils.pythrougha guarded import and falls back to
rocminfoif the wrapper is unavailable, sobehavior is unchanged on hosts without amd-smi. (Open to moving the shared
wrapper to a neutral location if reviewers prefer avoiding the dispatcher →
tile_engine reach.)
Test plan (MI350X / gfx950)
detect_gpu_arch()(amd-smi preference,rocm-smi fallback, default) + a live check — 4/4 pass.
dispatcher_common.detect_gpu_arch()andgemm_utils._get_arch()bothreturn
gfx950via amd-smi on the live host.test_gemm_utils21/21 still pass (no arch-detection regression).