Repository navigation
Description
hrx: the AMDGPU HAL decides APU-ness from a bit this ROCr leaves clear, so host+device-local memory types are refused on Strix Halo
From the memory lane's device work at the pinned pair (hrx-system 82804197bc, fork d8bd0ff6052a) on strixhalo
(RYZEN AI MAX+ 395 / Radeon 8060S, gfx1151, 120 GiB UMA, 1 GiB VRAM carve-out). Everything below is measured on this box
with ~/amd-oss/hrx-study/tools/hsa_probe.c (TheRock SDK libhsa rocm-10.3.0a20261031) unless a path:line is given.
Raw probe output: ~/amd-oss/hrx-study/evidence/memory/hsa-probe-20261102-0943.log.
What the attribute returns
AGENT gfx1151 (device GPU)
HSA_AMD_AGENT_INFO_SVM_DIRECT_HOST_ACCESS = 0
HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES = 0x2 (AGENT_IS_APU=0)
0x2 is undefined by the header shipped with that libhsa: hsa_ext_amd.h:1044-1050 defines the whole
hsa_amd_agent_memory_properties_t enum as one member, HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APU = (1 << 0). There is
exactly one hsa_ext_amd.h on this box (checked by find), so this is not a header-version mixup. At the same time
rocminfo on the same agent prints Memory Properties: APU
(~/amd-oss/hrx-study/evidence/memory/rocminfo.txt:12), i.e. ROCr itself considers the agent an APU by another route
(libhsa also carries hsakmt_device_is_apu_by_node_id).
What the HAL concludes
physical_device.c:455-469 decodes exactly bit 0 of that attribute:
uint8_t memory_properties[8] = {0};
iree_hsa_agent_get_info(..., HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES, memory_properties);
*out_agent_is_apu = hsa_flag_isset64(memory_properties, HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APU);hsa_flag_isset64(value, f) is value[0] & 1 (hsa_ext_amd.h:110-114), so with 0x2 the HAL records
agent_is_apu = false → device_local.unified_memory = false for a unified-memory APU.
The two consequences, both in allocator.c
- Host+device-local requests are refused instead of landing on
host_fine—:739-741
(requires_host_local && requires_device_local && !unified_memory→return false) and:753-758
(requires_host_access && requires_device_local, nodevice_finehost access,!unified_memory→return false).
On a real APU both should take thehost_finebranch two lines further down. expand_unified_memory_typeadds nothing, so nodevice_fineheap is published
(device_fine_availableat:1106-1111). Note this second effect is independently caused here: publication also
requireshas_uniform_device_fine_direct_host_access(:170-186→svm.direct_host_access,:157-168), and that
measured 0 on this box in both SVM modes. Sodevice_fineis absent regardless of the APU bit; only (1) is
attributable to the bit alone.
Why this is reported as a latent gap, not a live breakage
It is not reachable from libhrx: libhrx resolves a buffer's memory type to one of five slab source pools first
(mem_pool_backing.c:334-344 — any HOST_LOCAL bit → HOST source, any DEVICE_UNCACHED bit → UNCACHED_DEVICE,
otherwise DEVICE; every other bit is ignored) and each pool derives its own memory type, so the memory-type refusals in
allocator.c are direct-HAL-caller-only paths. Confirmed by measurement: a libhrx probe allocating with
HOST_LOCAL|DEVICE_LOCAL (0x72) and HOST_VISIBLE|HOST_COHERENT|DEVICE_LOCAL (0x36) succeeds in both SVM modes
(evidence/memory/hrx-place-20261102-1212.log). So no current llama run is affected; a HAL caller that asks for
host+device-local memory on this box just gets INVALID_ARGUMENT/UNAVAILABLE where the hardware is in fact unified.
Suggested direction (any one is enough)
- Decode APU-ness the way ROCr does for
rocminfo(ask hsakmt / do not depend on this attribute alone), or - treat an attribute value with no defined bit set as "unknown" and log it once, rather than silently concluding
non-APU, and/or - relax (1) to a warning +
host_finerouting, which is what a unified-memory APU physically is.
Cross-references: this is the same pin as engine#315 (SVM gate) and #680 (GTT ceiling). The probe and the reproduction
recipe are in ~/amd-oss/hrx-study/tools/hsa_probe.c; the surrounding analysis is FACTS-memory.md §1.1/§1.2/§7.1/§7.4
in the same directory.
Activity
bong-water-water-bong commentedon Nov 2, 2026
**Triaged — bucket A (provisional: it is latent, see the last section), owner the memory / hrx-study lane that filed it. Every claim checks out at the pin; the paths need the directory and two line numbers have drifted. Two things I can add: the consumer chain that makes "only consequence (1) is attributable to the bit" provable, and the fact that "decode it the way ROCr does" is not available in this tree.
Verified at hrx-system
82804197bcbe(the engine's held pin)runtime/src/iree/hal/drivers/amdgpu/physical_device.c:456-469—iree_hal_amdgpu_physical_device_query_agent_is_apu(), 8 bytes fromHSA_AMD_AGENT_INFO_MEMORY_PROPERTIES, thenhsa_flag_isset64(...)runtime/src/iree/hal/drivers/amdgpu/allocator.c:743-745(requires_host_local && requires_device_local && !unified_memory→return false) and:754-758(requires_host_access && requires_device_local, nodevice_fine,!unified_memory→ falls through) — the issue says:739-741/:753-758, so 4 lines of drift on the firstlibhrx/src/libhrx/mem_pool_backing.c:334-344— the five-source resolution you quote:HOST_LOCAL→ HOST,DEVICE_UNCACHED→ UNCACHED_DEVICE, else DEVICE, every other bit ignoredThe chain that makes the attribution exact
Grepping the whole tree for
is_apu|AGENT_IS_APUat this pin returns only that chain (plus its two unit-test sites), so your split is right and it is exactly one bit with one consumer: consequence (1) is the bit, consequence (2) needssvm.direct_host_access, which is theSVM_DIRECT_HOST_ACCESS = 0you measured — a second, independently-cleared signal. Worth keeping in the issue because it means fixing APU-ness buys (1) only;device_finestays absent on this box either way.What is not available: "decode it the way ROCr does"
hsakmt_device_is_apu_by_node_idis a symbol inside libhsa, not in this tree —git grepin hrx-system finds no reference to it and no second APU decision anywhere. So of the three suggested directions only two are in-tree:0x2has no defined bit (hsa_ext_amd.h's only member is1 << 0), so "the attribute did not say" is the honest read; logging the raw value once is what would have made this visible instead of silent;host_finewhen the agent declares unified memory by any means — but at this pin the only means the HAL has is the same attribute, so (2) depends on (1).Bucket, and why provisional
A by the rule (a lane owns the change and can prove it on this box), with the caveat you supplied: no current llama run is affected, because libhrx resolves to a source pool first. So it is not a live breakage and I am not pretending it blocks c20 — if the owner prefers latent-only rows out of the A count, this one moves to C and the counter drops by one; that is one word and I will do it.
Next action, one: make the APU decision three-valued (
definitely APU/definitely not/did not say) with the raw attribute value logged once, then routeHOST_LOCAL|DEVICE_LOCALtohost_fineon this box; gate = the probe's two requests (0x72,0x36) landing inhost_finewith the log line naming0x2, measured under onegpu-holdticket with the #715 trio. No llama run needed.Links: #315 (closed — the SVM gate this sits beside), #680 (the GTT ceiling; same APU-detection blurs the memory accounting), #841 (same lane, same pin, the sibling accounting gap).
bong-water-water-bong commentedon Nov 3, 2026
Measured on the same box while fixing this (THRX-COMPAT lane, overnight 2026-11-03). Two corrections, then the fix.
1.
hsa_flag_isset64does not mask with its argument; it indexes a bit with it.HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APUis a mask (1 << 0), sohsa_flag_isset64(properties, HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APU)tests bit 1, not bit 0. The issue's reading (value[0] & 1) is not what thehelper does.
2. Because of that, the reported consequence does not happen on this box: the agent already decodes as an APU.
A probe built against the pinned tree (
hrx-system 82804197b, the same decode and allocator code), onegpu-holdticket, no-SVM trio,
HSA_AMD_AGENT_INFO_MEMORY_PROPERTIESread exactly as the HAL reads it:0x2is bit 1, which is what the pre-fix code tests, sounified_memory = 1andallocator.c'srequires_host_local && requires_device_local && !unified_memorybranch is not taken. ROCr and rocminfo use bit 1 thesame way, so the whole stack is self-consistent at bit 1 on this machine.
3. The real defect is the mirror image, and it is what the PR fixes. A runtime that answers with the documented
0x1was decoded as a discrete device - and only then do theallocator.crefusals bite. That cannot be producedby this ROCr, so it is pinned by a device-free unit test rather than by a device measurement:
0x0(discrete)0x1(documented APU mask)0x2(this ROCr on gfx1151)0x4,0x80(neither encoding)PR: 1bit-MONSTER/hrx-system#9 (
1bit/840-apu-memory-properties,6383e263) - accepts both encodings in aphysical_device_capabilities.chelper, adds the unit test above and a live-device guard inallocator_test.ccthatskips on a discrete agent. Leaving this issue open for the owner to close with the PR.
Bump HRX: hrx-system 7f4236924 -- the APU memory-properties decode is…
Bump HRX: hrx-system 7f4236924 — the APU memory-properties decode is …
bong-water-water-bong commentedon Nov 6, 2026
Resolved, with one measured qualification that this issue's premise deserves.
The fix is shipped
1bit/e3e6a976-pin-6) merged as7f4236924:HSA_AMD_AGENT_INFO_MEMORY_PROPERTIESis decoded with the property as a mask instead of through the bit-index helper, and the encoding this ROCr uses (0x2) is accepted alongside the documented0x1; the capability/allocator tests are ported to this line.7f4236924after the hw-gate passed (run 42170492166, attempt 2 — the first attempt was OOM-killed together with the runner service, not a gate failure): build, ops, fa-decode-q8,kat/kld/placementon qwen3-0.6b, zaya1-8b, qwen3.8-27b, qwen3-coder-30b-a3b, qwen3-4b-iq4xs and the kq8/kvq8 rows all PASS (KLD ≤ 1e-6, same top-100 %);needlePASS at 7082/7403 tokens. The validated pin is recorded inconfig/hrx-long-prompt-validated-pin.config, and the hold file names it.The qualification
The port lane measured the symptom before the change and it does not reproduce on this ROCr:
hsa_flag_isset64(value, HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APU)indexes bit 1, and this ROCr signals APU with0x2, so the existing code already decoded it as APU —unified_memorywas already 1 andHOST_LOCAL|DEVICE_LOCALallocations already succeeded at the previous pin. So this is a correctness/portability fix for a runtime that answers the documented0x1, made explicit and test-covered, not a behaviour change on this box. If the refusal this issue reports is real somewhere else, it has another cause and this evidence is where to start.Closing on the landed decode + the gate; the per-run detail is in #1245 and the fork PR.