Repository navigation
feat(rocke): expose ASIC revision through typed HIP queries - #11639
Conversation
✅ 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. |
24e5aed to
3c18a84
Compare
|
does it work correctly when the binary is cross compiled? |
|
Yes, for the compilation boundary owned by this PR. Cross-compilation uses the explicit target supplied by the caller and remains independent of the build host's GPU. rocKE separates that input into the runtime target ID, compiler target, and base architecture. For I verified those cases with the real ROCm 10 COMGR and hipcc toolchains as well as focused unit tests covering both compilation paths and the LLVM-IR hipcc helper. The destination ROCr stack remains responsible for loading the resulting code object and applying any available compatibility transformation; artifact selection and translation-aware dispatch are tracked in AICK-2069. |
There was a problem hiding this comment.
🔵 Needs a closer look
The hand-maintained HIP binary layout and unvalidated Windows and older-runtime behavior require final human review.
Pull request overview
Adds typed HIP device-property queries so rocKE can expose ASIC revisions and normalize runtime targets for lowering and compilation.
Changes:
- Adds immutable
DeviceInfosnapshots backed byhipDeviceProp_tR0600. - Separates runtime target IDs, base architectures, and compiler targets.
- Updates compile paths and tests for profile and feature suffix handling.
File summaries
| File | Description |
|---|---|
tests/runtime/test_device_info.py |
Tests querying, snapshots, failures, and exports. |
tests/instances/test_rocke_multiarch.py |
Updates device-property parsing tests. |
tests/core/test_compile_target_selection.py |
Tests normalized compiler and lowering targets. |
tests/core/test_arch_target_identity.py |
Tests target identity conversions. |
python/rocke/runtime/hip_module.py |
Uses typed R0600 HIP property queries. |
python/rocke/runtime/device_info.py |
Introduces the DeviceInfo API. |
python/rocke/runtime/_hip_device_properties.py |
Defines the ctypes R0600 ABI structure. |
python/rocke/runtime/__init__.py |
Exports the device-info API. |
python/rocke/helpers/compile.py |
Normalizes targets for COMGR and hipcc. |
python/rocke/core/arch/target.py |
Adds target parsing and normalization helpers. |
python/rocke/core/arch/__init__.py |
Exports target helpers. |
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
TheRock Submodule Bump ActivityNewest first
|
Summary
rocKE needs ASIC revision information for logic that depends on a device's
silicon revision.
get_device_info(device)now returns a snapshot with read-onlyasic_revision,target_id,base_arch, andcompiler_targetproperties.Each call makes one HIP query; reading the snapshot makes no further calls.
There is no query cache. Zero is a valid revision; unavailable values are
None.The HIP binding replaces raw-buffer scanning with a typed
hipDeviceProp_tR0600structure bound tohipGetDevicePropertiesR0600. ASICrevision and target ID come from named fields in the same result. Runtimes
without that versioned function return no properties.
Python and C++ share the same target identity contract: preserve the exact
runtime target ID, use the base architecture for catalog lookup and lowering,
and remove runtime profiles while preserving compiler feature suffixes for
compilation. For example,
gfx1250-strictmaps to compiler/basegfx1250,while
gfx942:sramecc+:xnack-keeps its compiler features and uses basegfx942.Catalog names such as
gfx11-genericremain intact. Explicit compilationcontinues to use the caller's target without querying the build host's GPU.
The C++ architecture API now mirrors the three Python target helpers and fixes
rocke_arch_from_isa(), whose last-hyphen parsing previously returnedstrict,an empty string, or
genericfor these inputs. Its caller-owned output buffers,NUL termination, and truncation convention are preserved. Native tests cover
the target forms and buffer boundaries, and are registered with CTest, installed
test artifacts, and CI test categories. A Python test compares all four native
queries with Python across 312 inputs when
ROCKE_ARCH_TARGET_TEST_EXEpointsto the built native test executable.
Capability rules will follow separately. The HIP query/snapshot API remains in
the Python runtime; the C++ additions are architecture string helpers.
ISSUE ID : AICK-2222
Harness: Codex; model: gpt-6; reasoning: medium.
Test plan
79 passed, 1 deselected (the LLVM datalayout guard excluded in prior validation).
Includes the 312-input Python/C++ comparison.
git diff --check, and the relative-path guard.Previously recorded validation for the HIP-query changes:
ctypes fields and architecture bitfields without a GPU or HIP runtime library.
with ROCm 10.0.0 / HIP 7.15.26333.
DeviceInfoon gfx90a: one HIP call per query, no calls from property access,and agreement with native HIP.