Skip to content

borealis: keep barriers cheap until memory aliases, then strengthen them in place (G17P, M5) - #554

Merged
RyanTheTide merged 7 commits into
aurora-silicon:aurora-wipfrom
jgoyvaerts:pr/hk-g17p-alias-patch
Dec 2, 2026
Merged

RyanTheTide merged 7 commits into
aurora-silicon:aurora-wipfrom
jgoyvaerts:pr/hk-g17p-alias-patch

Conversation

@jgoyvaerts

@jgoyvaerts jgoyvaerts commented Nov 19, 2026 •

Copy link
Copy Markdown

What: G17P and M5 caches are tagged by virtual address, so a barrier needs a memory-scoped flush once a page is mapped at two GPU addresses, but on G17P that choice was made when the barrier was recorded: a command buffer recorded before memory aliased kept the cheap flush, and every word read through the second mapping later came back stale (#266's bt test). This PR moves G17P onto #552's patch-site mechanism (cheap flush until the first aliasing resource appears, then patched in place), gives capture/replay memory a single mapping, and fixes bufferDeviceAddressCaptureReplayEXT buffers, which all failed with VK_ERROR_UNKNOWN.

Tested: J616s M4 Pro (G17P), kernel 7.3.0-m4.219, at 265c547cf (merge of aurora-wip 31b9bb786, see Evidence) against aurora-wip 31b9bb786: dEQP-VK 7106-case replay/descriptor-buffer/external-memory/sparse list 6647 P / 459 NS on both, 0 cases differ; memory.* (4745) 0 differ; synchronization*.event* 6213 cases serial 6210 P / 3 NS on both, 0 status differences; dEQP-GLES3 texture+samplers identical to base case for case; meson --suite asahi --suite vulkan 386 Ok / 1 Skipped, including brl-g17p-event-alias; 0 GPU recoveries, 0 kernel error lines. Not repeated at this head: the bt alias-mode stale-word rows (last at 5a78251f9: late 16/24 -> 0/24 and the other modes 4 -> 0). Other Macs on earlier heads only: A18 Pro and M2 (RyanTheTide, 5a78251f9), M5 J714s (DjDeveloperr, 7ebd619d1 and 26e87494a).

Risk: two-way door · G17P (M4 family, A18 Pro) and M5 for the barrier patching; every Mac for commits 1-3 (agx_bo_create_at(), capture/replay memory placement). The merge of aurora-wip keeps its per-import va_alias_resources count, so the byte and 2D stencil tiling and the optimized compute kernels decide aliasing exactly as aurora-wip does on every chip. Checked unaffected: A18 Pro and M2 on cb450e343, M5 on earlier heads; nothing but the J616s at this head.

Not yet: an M5 rerun at this head: the full synchronization*.event* and BDA/descriptor_buffer lists (hk_event.c and hk_buffer.c changed since the M5 rows) and the packtest alias arms in both packing modes, with the KHR buffer bound before its address is queried; A18 Pro, M1 Pro and M2 rows at this head; the bt alias modes at this head. Not re-run on this head: the GLES31 subsets, the vkd3d-proton d3d12 suite, the recording-contention bench and bt cost. Not covered: a shader that polls host memory without an event (outside the memory model).

Details

Problem. G17P and M5 GPU caches are tagged by virtual address. When one page is mapped at two GPU addresses, a read through one mapping after a barrier sees the writes through the other only if the barrier's flush has memory scope. On G17P that scope followed a live count of resources with a second mapping, but the count was read when the barrier was recorded. A command buffer recorded while nothing aliased kept the cheaper flush. When memory aliased later, every word read through the second mapping came back stale (#266's bt test). That covers:

  • a capture/replay buffer created after recording, after a first run or during recording, or used from a secondary;
  • a sparse buffer or a second host import created after recording;
  • pending, simultaneous-use and cross-semaphore submissions;
  • another thread creating the alias mid-recording.

#552 solved the same problem on M5 with patch sites: a dependency recorded while nothing aliases keeps the cheap flush, its barrier word is noted, and the memory-scope flush is written over it when the first aliasing resource appears. This PR moves G17P onto that one mechanism. The old device-wide rule makes every DXVK and vkd3d-proton device pay about 1 µs per compute→compute barrier. Both enable sparse and fd/host-import features, but they create aliasing objects only for tiled/reserved resources or shared handles. Sources: DXVK d3d11_buffer.cpp:72-76, d3d11_texture.cpp:148-152; vkd3d-proton resource.c:4094-4101 via CreateReservedResource only, memory.c:860-881 (heaps are not sparse).

Change. Based on aurora-wip 43beb2fc9 (contains #552 263ddb7f, the #571 test stubs, #558's pack boundary, #440, 2a5667ad3's G17P compute submit packing, and Dj's 11-23/24 BO-cache and byte-stencil work). Rebased from efabab385; what changed in the rebase:

  • hk_AllocateMemory(): ordinary memory keeps agx_bo_create_checked() (99d210278, 9b22559a8). Capture/replay memory never comes from the cache, so it runs hk_system_memory_fits() itself and, as agx_bo_create_checked() does, evicts the BO cache and asks once more before refusing. hk_memory_oom gets a capture/replay case for that (fails without the eviction).
  • hk_BindBufferMemory2(): the storage-backing record (newer than the old base) skipped memory with a second replay_va mapping; that mapping is gone, so the condition is too.
  • hk_byte_stencil_validate_dispatch() (45883f922) read va_alias_resources, which commit 4 removes. It now asks !may_alias_memory && alias_live == 0: exact on G17P and M5 (host_alias.dynamic), and on other chips also covers the fd and dma-buf imports the old count missed.
  • Commit 1 follows the read-only shadow state (11b92e58a) and the new test-agx-bo-cache mock.
  1. asahi: create a BO at a GPU address the caller chose: adds agx_bo_create_at(). The virtio backend also no longer leaks the VA when BO creation fails.
  2. borealis: map capture/replay memory once and bind capture/replay buffers into it: like RADV, memory allocated with VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT gets its only address in the capture/replay region (the captured one on replay), and a KHR capture/replay buffer takes memory address + offset (VUID-VkBindBufferMemoryInfo-bufferDeviceAddressCaptureReplay-09200, -buffer-09201). So capture/replay no longer aliases at all, and hk: give M5 barriers memory scope only while a host import may alias #552's second replay_va mapping of descriptor-buffer capture/replay memory goes with it.
    • bufferDeviceAddressCaptureReplayEXT buffers keep their own VA. Their fill page was only created for the KHR feature, so every EXT capture/replay buffer failed with VK_ERROR_UNKNOWN. Fixed here.
    • A KHR capture/replay buffer has no address until memory is bound. vkGetBufferDeviceAddress() may not ask before that: VUID-vkGetBufferDeviceAddress-bufferDeviceAddress-03324 (which replaced VUID-VkBufferDeviceAddressInfo-buffer-02600) allows an unbound capture/replay buffer only with VK_EXT_buffer_device_address's feature, and those buffers have their own VA from creation. vkGetBufferOpaqueCaptureAddress() has no binding rule and must return the opaqueCaptureAddress the buffer was created with: it returns that address, also before the bind, or 0 (no specific address) when none was asked for (hk_buffer.c).
    • New shim tests brl-{g13g,g17p}-capture-replay. They also check both queries before the bind: the KHR opaque query on capture and on replay, and the EXT address query.
  3. borealis: stop counting KHR capture/replay among the features that alias memory, in hk_device_may_alias_memory() and the alias trace.
  4. borealis: patch barrier records on G17P as on M5 when memory first aliases: one patching path for both chips.
    • hk: give M5 barriers memory scope only while a host import may alias #552's dynamic mode (sites, alias_live, host_alias.patch_lock, submit-time patch, 0→N patch of every executable command buffer) is now selected by the hardware property, hk_va_tagged_caches() (hk_device.h, used at hk_device.c and in hk_cdm_alias_scope(), hk_device.h), instead of the M5 chip check.
    • G17P's record-time count is gone (va_alias_resources, alias_import). G17P therefore counts what M5 counts: buffers and image planes with an address of their own, fd/dma-buf imports for their lifetime, and host imports only while their pages may be mapped elsewhere (hk_host_import_track(), hk_device_memory.c).
    • G17P command memory is CPU-cached, so a patched word is written back (hk_cmd_buffer_patch_alias_sites(), hk_cmd_buffer.c).
    • Transfers ordered before a draw and task launches now record sites on both chips, instead of keeping memory scope for good (hk_cmd_draw.c). A site on a tessellation stage's tail is not dropped by the next batched draw (hk_cs::alias_pin, hk_tess_batch.c). It moves with inline merges.
    • Events: hk: give M5 barriers memory scope only while a host import may alias #552 gave every command buffer with uses_events memory scope throughout. That flag is also set by vkCmdSetEvent2, which DXVK records for its event queries. Now only a wait for an event the host may set turns the command buffer to memory scope (hk_event.c, hk_cmd_alias_scope()). Such a wait's barriers may hold only host operations in their first scope (VUID-vkCmdWaitEvents2-pEvents-03839), so it has no barriers, or barriers whose srcStageMask is HOST or NONE. Only a device source stage with no HOST beside it rules the host out (hk_dependency_waits_for_host(), hk_event.c). The shim test brl-g17p-event-alias records each form, ends the command buffer and then creates the first aliasing resource: the command buffer must already have memory scope. An event set in the same command buffer must still wait for the patch. That wait is the only way a running command buffer reaches memory aliased after it started, and the G17P CDM reads about 256 bytes of stream past the launch it runs, also across event waits. Setting an event records a site (hk_event.c).
    • End of stream: hk: give M5 barriers memory scope only while a host import may alias #552's memory-scoped end of every compute stream stays, on M5 only (hk_cmd_buffer.c). The end of a G17P command already makes its writes visible at every address. bt xsub, with the second address created while the writer runs, read exact even on the old base without any patching. The earlier version's End upgrade on visible-completion kernels is dropped.
    • Packing: sites are patched at submission before the copy, and packets are built under the patch_lock read lock whenever host_alias.dynamic is set (hk_queue.c), which now includes G17P. aurora-wip 2a5667ad3 packs compute submits on G17P too; its boundary and tail flushes ask hk_cdm_alias_scope(), which on G17P now follows alias_live as on M5, so a boundary drops memory scope only while nothing aliases.
    • hk_cmd_buffer_move_alias_sites() is inline again so hk_execution_allowance runs the real one (hk: tests: stub hk_cmd_buffer_move_alias_sites() #571's stubs removed). New unit checks: sites and the pin move with an inline merge, and a pinned tessellation tail stays (hk_tess_batch).
    • ASAHI_M5_HOST_ALIAS_TRACE now also works on G17P (name kept for the M5 gate's scripts). ASAHI_M5_HOST_ALIAS_STATIC stays an M5 override: G17P always takes the dynamic tracking when its device enables a feature that can alias.

Follows #266, #472 and #552.

Merge of aurora-wip b15642289 (5a78251f9, no rebase). Conflicts and what the resolution does:

  • hk_buffer.c: borealis: preserve sparse residency map VA on buffer capture/replay #1067 restores a sparse buffer's residency-map address next to its own address on descriptor replay. Both stay, beside the KHR placement; vkGetBufferOpaqueCaptureAddress()'s address now comes from hk_get_buffer_replay_addrs().
  • hk_CreateDevice(): dynamic alias tracking is taken where the caches are VA-tagged (hk_va_tagged_caches(): G17P, M5) and the device does not already give every barrier memory scope (agx_cdm_ordering_memory_scope(), multi-die M5). ASAHI_M5_HOST_ALIAS_STATIC applies on M5 only. hk_cdm_alias_scope() follows agx_cdm_ordering_memory_scope() too.
  • va_alias_resources: aurora-wip 035af0da4 made it an exact per-import count on every chip, read by the byte and 2D stencil tiling and the optimized compute kernels. It stays for those paths with all its sites (own-VA buffers and image planes, fd/dma-buf and untracked host imports); barrier scope follows alias_live as in this series. The byte stencil check is aurora-wip's again, so the earlier risk note about it on chips without VA-tagged caches no longer applies. The capture/replay memory mapping it also counted is gone with commit 2.
  • hk_cmd_buffer.{c,h}: aurora-wip's AGX2 sparse patch sites move with a stream merge beside the alias sites. aurora-wip now cleans patched words on cached command memory itself, so that part of commit 4 is in the base.
  • hk_cmd_draw.c: the dispatch flush keeps G18G's sealed-dispatch check.
  • Tests: test-hk-memory-oom's host-import section checks the per-import count on G13G, and G17P beside G17C with host_alias.dynamic, where barrier scope follows alias_live. The new hk_query_oq test gets a hk_cdm_note_alias_site() stub, and the new host-pointer mock passes the VA argument mock_bo_alloc() takes in this series.
Evidence

Merge 265c547cf (aurora-wip 31b9bb786, no rebase): aurora-wip's e9831e6 moved the host-alias trace from ASAHI_M5_HOST_ALIAS_TRACE to ASAHI_MESA_DEBUG=hktrace (still M5 only), and 68378cf removed the ASAHI_M5_HOST_ALIAS_STATIC override. This branch traces and patches on every chip with VA-tagged caches (hk_va_tagged_caches(), G17P and M5), so the merge takes hktrace for the trace and keeps this branch's chip condition without the removed override. hk_vulkan_event_alias now adds hktrace to ASAHI_MESA_DEBUG (keeping the caller's flags, as aurora-packtest does) instead of setting the old variable.

At 265c547cf (2026-12-02, J616s, kernel 7.3.0-m4.219, release builds of the head and of aurora-wip 31b9bb786, 0 GPU recoveries): dq-fast all (7106, -j 3) 6647 Pass / 459 NotSupported on both, 0 differ; mem (4745, -j 6) 3082 / 1663 on both, 0 differ (shared gpu-run 02:35-02:38 UTC); synchronization*.event* serial (chunk.sh, 200 per process, perf gpu-run 02:49-02:51 UTC) 6210 Pass / 3 NotSupported on both, 0 status differences; GLES3 texture+samplers 5926/5953 on both, 0 status differences (the 27 failures are 8-bit *_pbo uploads and fail on aurora-wip 31b9bb786 itself, #1515); meson 386 Ok, 0 Fail, 1 Skipped.

At 5a78251f9 (J616s, kernel 7.3.0-m4.197, against a build of aurora-wip b15642289, gpu-run 16:45-17:10 UTC 11-28, 0 GPU recoveries): dq-fast 7106-case list at -j 3: 6647 P / 459 NS on base and head, 0 cases differ. GL (gallium asahi, EGL pbuffer): tex probe ok and GLES3 392/392 on both. meson --suite asahi --suite vulkan 354/354. bt (same modes and shapes as below, gpu-run 17:45 UTC): base b15642289 stale in late 16/24, pending/simul/xsem 4/4, event 4/8, sparselate 4/12, hostlate 4/8, concrec/evalias 4/4, inflight 24/24; this head 0 in every mode but inflight 12/24, as before. Event list: 6210 P / 3 NS on both, 0 differences. The rows below are from the previous head.

Testing. J616s (M4 Pro, G17P), kernel 7.3.0-m4.190, this head 2785fdd19 against its merge-base aurora-wip 43beb2fc9, one gpu-run (00:45-00:50 UTC 11-26), 0 GPU recoveries: the bt alias modes, the 7106-case replay/descriptor-buffer/external-memory list, the 6213-case synchronization*.event* list and the GL tex probe + GLES3 392. 0 cases differ, and bt has no stale rows on this head except inflight. meson --suite asahi --suite vulkan 315/315. The weakbarrier column, the memory.* list, the GLES31 subsets and the cost rows are from earlier heads with the same barrier code (f5577f472, 2eaec513f, 2644e788a). A18 Pro and M2: Ryan's rows on cb450e343 (0 diffs). M5: Dj's J714s rows on 7ebd619d1 and 26e87494a; the full event and BDA/descriptor_buffer lists have not run on M5 since hk_event.c and hk_buffer.c changed. We have no M5, A18 Pro, M1 or M2.

Device rule (ASAHI_M5_HOST_ALIAS_TRACE=1): the DXVK and vkd3d-proton feature sets take rule=per-resource; a device enabling none takes rule=none.

bt (#266's test plus sparselate, hostlate, concrec and evalias; 3 runs × 4 shapes per mode), rows with stale words, this head and merge-base 43beb2fc9 (weakbarrier on 2eaec513f against 8e288e5db):

mode merge-base this, default this, HK_PERFTEST=weakbarrier
alias, hostalias, dmabuf, xsub 0 0 0
late (capture/replay after recording, after a first run, during recording, secondary) 16/24 0/24 0/24
pending, simul, xsem 4/4 each 0/4 each 0/4 each
event 4/8 0/8 0/8
sparselate 4/12 0/12 0/12
hostlate 4/8 0/8 0/8
concrec (alias created by another thread mid-recording) 4/4 0/4 0/4
evalias (alias created during a host-event wait, then vkSetEvent) 4/4 0/4 0/4
inflight (a shader spinning on host memory, no host sync; outside the memory model) 24/24 12/24 (on 2eaec513f: only ≤ 4 launches after the alias) 12/24, same rows

xsemq (two queues behind a timeline semaphore) was left out after the 11-20 multi-queue firmware crash; it read 0/4 on an earlier head.

Cost (bt cost, µs per level with a compute→compute barrier, extra over a level without; one round on 2644e788a, same barrier code):

kernel no aliasing features DXVK set vkd3d set a sparse buffer alive
sxform, grid 0.887 0.890 0.885 1.964 … 1.966
xform, grid 0.911 0.930 0.929 1.908 … 1.923
nop, grid 0.522 0.516 0.516 0.589 … 0.590
xform, 1 thread 0.918 0.914 0.923 1.182 … 1.189

So the DXVK and vkd3d sets cost what a device without aliasing features costs, until a sparse resource exists (the device-wide rule cost about +1.1 µs on the grid rows).

  • dEQP-VK, 7106 cases (binding_model.descriptor_buffer, binding_model.buffer_device_address with every replay case, ray_tracing_pipeline.capture_replay, api.external.memory.{opaque_fd,dma_buf}, memory.external_memory_host, sparse_resources.buffer) via dq-fast -j 3: 6647 P / 459 NS / 0 F on base and on this head, 0 cases differ. At -j 10 on m4.190, aurora-wip and this change alike show VK_ERROR_OUT_OF_DEVICE_MEMORY from vkQueueSubmit in the BDA replay and descriptor-buffer sparse cases: the kernel's GPU-wide pool of 58 logical queues runs out (G17 capacity refusal LogicalQueues), as these multi-queue tests open one kernel queue per queue family. Not this PR.
  • synchronization*.event* (6213, serial, one deqp-vk per 200 cases): 6210 P / 3 NS on both, 0 status differences.
  • GL (gallium asahi, EGL pbuffer): tex probe ok and GLES3 392/392 on both.
  • meson --suite asahi --suite vulkan: 315/315, including brl-g17p-event-alias, the capture/replay shim tests and hk_memory_oom's capture/replay case.

Not re-measured on this head: the memory.* list, the GLES31 subsets, the vkd3d-proton d3d12 suite, the recording-contention bench and bt cost.

Not covered: a shader that polls host memory without an event (outside the memory model).

@RyanTheTide

Copy link
Copy Markdown

Thank you for the thorough write-up and the bt matrix; patching the noted records in place is a neat way to avoid the device-wide cost.

We select behaviour by a hardware property, not by the chip it was tested on. The new mechanism is keyed on dev->dev.chip == AGX_CHIP_G17P at hk_cmd_dispatch.c:717, hk_cmd_buffer.c:1224 and hk_event.c:196. But the reason is virtually tagged caches, which hk_device.h already says G17P and M5 share. M5 keeps the device-wide rule, so the same problem now has two mechanisms, and the cheaper one is G17P-only.

Could you select it with a predicate for that property (alongside hk_cdm_alias_scope()) and use it on M5 too? If M5's barrier records can't be patched this way, a short comment saying why would cover it.

We can run bt and the event/replay dEQP subsets on our A18 Pro (also G17P) and M4 Pro. The branch also needs a rebase.

@jgoyvaerts jgoyvaerts changed the title hk: keep G17P barriers cheap until memory aliases, then strengthen them in place hk: keep barriers cheap until memory aliases, then strengthen them in place (G17P, M5) Nov 20, 2026
@jgoyvaerts
jgoyvaerts force-pushed the pr/hk-g17p-alias-patch branch from 050acbd to c7dbd54 Compare November 20, 2026 05:23
@jgoyvaerts

Copy link
Copy Markdown
Author

Rebased on aurora-wip 45963937b and switched to a property predicate.

  • hk_va_tagged_caches() (hk_device.h:418, next to hk_cdm_alias_scope()) selects the mechanism at all three sites (hk_cmd_dispatch.c:716, hk_cmd_buffer.c:1227, hk_event.c:198). hk_cdm_alias_scope() is now the live alias count on both chips.
  • M5 uses the same mechanism, and its device-wide rule is gone. The barrier word and FLUSH_MEMORY bit are the same, and the kernel runs the recorded CDM stream at its own address on both, so the records patch the same way. The one M5-only case is submit packing, which runs copies the rewrite can't reach. On a device that may alias memory at all, a packet keeps memory scope at its members' copied noted records and at boundaries (hk_queue.c:2666-2686), which is what M5 emitted before. End on a visible-completion kernel upgrades a noted tail on such devices, so visible completion stays where it was (hk_cmd_buffer.c:999).
  • Tested on M4 Pro (G17P), 0 recoveries: bt, default and HK_PERFTEST=weakbarrier: 0 stale rows in every mode except inflight (12/24, unchanged). dEQP 7106-case list 6647 P / 459 NS, 0 differ. synchronization*.event* 5779 P / 434 NS, 0 differ. GL subsets identical. meson asahi+vulkan 212/212.
  • M5 is compile-only plus unit tests (new packet-copy check in hk_execution_allowance, hk_pack); we have no M5.

Yes please to the A18 Pro and M4 Pro bt and event/replay runs.

@DjDeveloperr

Copy link
Copy Markdown

@jgoyvaerts, from the mesa merge train: #552 ("give M5 barriers memory scope only while a host import may alias", M5 driver lane) merged into aurora-wip at 263ddb7 a short while ago, and this PR now conflicts with it in hk_buffer.c, hk_cmd_buffer.c, hk_cmd_dispatch.c, hk_cmd_draw.c, hk_device.c, hk_device.h, hk_device_memory.c, hk_event.c, hk_image.c and more.

This isn't a textual conflict we can resolve for you: both PRs now decide M5's barrier memory scope at record time and patch noted records later.

  • hk: give M5 barriers memory scope only while a host import may alias #552 keeps M5 cheap while only host imports may alias: it counts live writable imports that may alias, leaves patch sites in records made without the scope, and patches them before submission and when an aliasing import appears. Every M5 compute stream with launches ends memory-scoped while the dynamic rule is in force, and packets keep that only at their end.
  • This PR moves M5 to hk_va_tagged_caches() with in-place patching shared with G17P and drops M5's device-wide rule.

Could you rebase onto 263ddb7 and reconcile the two? Either express #552's import-alias case through your mechanism (one patching path for G17P and M5), or keep #552's M5 rule and limit this PR to G17P, with a comment on why. The M5 driver lane (which wrote #552) can answer questions about its patch sites and the packing interaction. Its M5 tests are tests/test-hk-host-alias.c and the aurora-packtest alias arms.

Once it's rebased, it gets an independent review and the M5 Pro (alias A/B + packtest + sync gate) and Neo rows in the next train batch. The train holds it until then.

@RyanTheTide

Copy link
Copy Markdown

Thanks for switching to hk_va_tagged_caches() and moving M5 onto the same in-place mechanism; that resolves our point. On the conflict with #552, we would prefer the first option: express its import-alias case through this mechanism, so G17P and M5 share one patching path. If M5 has to keep #552's rule, please add a comment giving the hardware or kernel reason. We will run the A18 Pro and M4 Pro bt and event/replay rows on the rebased head.

@DjDeveloperr

Copy link
Copy Markdown

Notes for the rebase onto #552 (263ddb7f), from #552's author

The two PRs build the same mechanism. It should exist once, and I'm happy for it to be yours.

Where #552's version lives in 263ddb7f

  • Sites: struct hk_alias_site, noted by hk_cdm_note_alias_site() (hk_cmd_dispatch.c:699). Sites move with inline merges through hk_cmd_buffer_move_alias_sites() (hk_cmd_buffer.c:204, called from hk_cs_merge_cdm_until() in hk_cmd_buffer.h).
  • Patching: sites are written when an alias appears (the count leaves 0) by hk_device_patch_alias_sites() (hk_cmd_buffer.c:274), for every executable command buffer. They are also written at submission by hk_submit_patch_alias_sites() (:311), for buffers recorded while the count was being raised.
  • Lock: a rwlock, host_alias.patch_lock (hk_device.h:176). Patching takes it for writing. Submit packing takes it for reading around hk_pack_runs() only (hk_queue.c:2707), so a packet's copies are never torn.
  • Scope: dynamic mode (host_alias.dynamic) is enabled on M5 only (hk_device.c:1086), while G17P keeps va_alias_resources. With hk_va_tagged_caches() you could make G17P dynamic too.

M5 decisions to keep

These carry the measured M5 gain: Geekbench Vulkan BB +3.0% and Face +3.5% against the device-wide rule. Evidence is on #552 (issuecomment-7032248115).

  1. Host imports count as aliases only if their pages may also be mapped elsewhere.
  2. Packet boundaries drop memory scope while the live count is 0, under the patch_lock read lock. They do not key on dev->may_alias_memory, which any device enabling sparse or writable host import has.
    • An alias created concurrently is either patched before the copy, or created after it. Vulkan does not order such an alias before the submission.
    • Records patched to memory scope are never downgraded.
  3. End of stream: in dynamic mode, every stream with launches ends memory-scoped (hk_cmd_buffer.c:1074). That covers writes read through another process's, device's or API's mapping, which Vulkan orders only at a submission boundary. Your End upgrade on may-alias devices serves the same purpose. Keep one of the two.

Tests and the M5 gate

  • Tests to keep or port:
    • test-hk-host-alias.c (classification);
    • my M5 packtest cases: hostpriv, hostalias(-late, -xsub), sparsealias(-late, -xsub, -pending), cralias(-pending).
    • A negative control without memory scope MISMATCHes in 7 of these on M5 hardware.
  • Gate offer: when the rebase is up, I can run the M5 hardware gate in one slot of 30 minutes or less. It runs those cases, aurora-packtest, dEQP alias.txt, and Geekbench uploaded against 263ddb7f.

🤖 Generated with Claude Code

@jgoyvaerts
jgoyvaerts force-pushed the pr/hk-g17p-alias-patch branch from c7dbd54 to 2644e78 Compare November 20, 2026 19:59
@jgoyvaerts

Copy link
Copy Markdown
Author

Rebased on aurora-wip afcc08b71 (#552 263ddb7f + #571), head 2644e788a. Option 1: #552's mechanism is the one path, and the PR's own one is gone (old commits 4 and 5 are replaced by one commit).

  • Selection: host_alias.dynamic is switched on by hk_va_tagged_caches() (hk_device.c:1067, hk_device.h:434) instead of the M5 check, and hk_cdm_alias_scope() is tagged && (may_alias_memory || alias_live) (hk_device.h:530). G17P's record-time count (va_alias_resources, alias_import) is deleted. Sites, alias_live, patch_lock, the submit-time patch and the 0→N patch are hk: give M5 barriers memory scope only while a host import may alias #552's, unchanged.
  • Added for G17P: a write-back of patched words, because G17P command memory is cached (hk_cmd_buffer.c:189). Also a pin so the next batched tessellation draw can't drop a site on a stage tail (hk_tess_batch.c:55). Transfer-before-draw and task-launch flushes now record sites on both chips instead of keeping memory scope (hk_cmd_draw.c:3630, :13223), which changes M5 there as well.
  • Events, changed on both chips: uses_events is also set by vkCmdSetEvent2, which DXVK records for event queries, so every barrier in such a command buffer paid memory scope. Now only a wait whose srcStageMask holds HOST turns the command buffer to memory scope (hk_event.c:207), and setting an event records a site (:138). On G17P that wait is also where the CDM prefetch (about 256 B past the running launch) would miss a patch.
  • Commits 2–3 drop hk: give M5 barriers memory scope only while a host import may alias #552's replay_va: capture/replay memory has a single address now.

Your three M5 decisions:

  1. Host-import classification: kept as is (hk_host_import_track()), and G17P uses it too. alias_import is gone, so Geekbench-style private anonymous imports no longer count on either chip.
  2. Packet boundaries: kept as is. Boundaries drop memory scope while alias_live is 0 under the patch_lock read lock, patched records are never downgraded, and nothing keys on may_alias_memory (dynamic leaves it false). G17P never packs.
  3. End of stream: kept yours. Every M5 compute stream with launches ends memory-scoped in dynamic mode (hk_cmd_buffer.c:1077). Our End upgrade is dropped. G17P doesn't take the end flush: bt xsub, with the second address created while the writer runs, read exact on G17P even on the old base without any patching, so the end of a G17P command already makes its writes visible at every address.

test-hk-host-alias.c is unchanged. move_alias_sites() is inline again, so hk_execution_allowance tests the real merge move (sites + pin), and hk_tess_batch checks the pinned tail.

Tested on M4 Pro (G17P), guarded, 0 recoveries: trace shows the DXVK and vkd3d sets take rule=per-resource. bt is 0 stale in every mode except inflight (12/24, same rows), both by default and with HK_PERFTEST=weakbarrier. bt cost: the DXVK and vkd3d sets cost the same as a device without aliasing features (sxform grid 0.890/0.885 vs 0.887 µs/level), until a sparse buffer is alive (1.96). dq-fast 7106 cases: 0 differ. Event list (6213): 5779 P / 434 NS. GL subsets identical. meson asahi+vulkan 213/213. M5 is compile and unit tests only; we have no M5.

@DjDeveloperr yes please to the M5 gate (alias A/B, packtest alias cases, dEQP alias.txt, Geekbench vs 263ddb7f). The packtest cases matter most for the graphics-path sites and the narrowed event rule. @RyanTheTide the A18 Pro / M4 Pro bt and event/replay rows on this head would be great too.

@RyanTheTide

Copy link
Copy Markdown

Thanks for the rebase onto #552's mechanism: one path selected by hk_va_tagged_caches(), with G17P's record-time count gone, is what we hoped for. The write-back of patched words for cached command memory and the tessellation pin are good catches.

Since the event and transfer/task-launch flush changes also reach M5, an M5 row from someone with one would help; we have none here. As agreed, we will run the A18 Pro and M4 Pro barrier, event and capture/replay dEQP rows on 2644e78 and post them here.

@RyanTheTide RyanTheTide changed the title hk: keep barriers cheap until memory aliases, then strengthen them in place (G17P, M5) borealis: keep barriers cheap until memory aliases, then strengthen them in place (G17P, M5) Nov 20, 2026
@jgoyvaerts
jgoyvaerts force-pushed the pr/hk-g17p-alias-patch branch from 2644e78 to f91d963 Compare November 21, 2026 06:14
@jgoyvaerts

Copy link
Copy Markdown
Author

Commit messages only, for the pre-PR checklist: the commits no longer carry Assisted-by (item 4), and the disclosure is now the PR body's last line. Subjects that started with hk now start with borealis (item 6). The tree is identical to 2644e788a9 (git diff 2644e788a9 f91d96342e is empty). New head f91d96342e.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown

Blockers: 2.

  1. The branch no longer applies: f91d96342e conflicts with aurora-wip in src/asahi/vulkan/hk_device.h (git merge-tree against b8762aab9bd). After the rebase, the rows below must be re-run on the new head.
  2. src/asahi/vulkan/hk_event.c:166-183,207: alias_host_wait is set only when one of the wait's barrier structs has HOST in srcStageMask. A VkDependencyInfo with no barrier structs at all is valid for an event the host sets (VUID-vkCmdWaitEvents2-pEvents-03839 is vacuous with zero barriers). Such a wait gets no memory scope, so the records after it stay patch sites that the CDM may already have prefetched when an alias appears during the wait. That is the evalias case the PR fixes, reached by another route. Fix: also treat a wait as host-capable when its dependency info has no barrier structs, or, more simply, when the event was not set earlier in the same command buffer. The sync1 entry point is unaffected because vk_common_CmdWaitEvents() always adds a stage barrier carrying srcStageMask.
  3. src/asahi/vulkan/hk_buffer.c:288-292: a KHR capture/replay buffer no longer has a VA until memory is bound. VUID-VkBufferDeviceAddressInfo-buffer-02600 exempts capture/replay buffers from the must-be-bound requirement, so vkGetBufferDeviceAddress/vkGetBufferOpaqueCaptureAddress (:645) may be called before the bind. That now trips assert(buffer->device_address != 0) in vk_buffer_address() (src/vulkan/runtime/vk_buffer.h:78) in debug builds and returns 0 + offset in release builds. RADV behaves the same way, but returning 0 explicitly from the opaque query while the buffer is unbound (0 = no specific address) avoids the assert and the bogus pointer. Non-blocking.

Commits 1-3 change capture/replay memory and buffer placement on every chip (G13-G18), not only on the VA-tagged ones, but the only hardware row is M4 Pro.

HW row (on the rebased head): M4 Pro and A18 Pro: bt (all modes) 0 stale rows except inflight, plus the 7106-case replay/descriptor-buffer/external-memory list and synchronization*.event*, 0 differences against the aurora-wip baseline. M1 or M2 (G13/G14): dEQP-VK.binding_model.buffer_device_address.*replay*, binding_model.descriptor_buffer.*capture_replay* and memory.* with 0 new fails. M5: hk_host_alias + the packtest alias arms + the event subset, since the event and transfer/task-launch site changes also reach M5. All with 0 GPU recoveries/kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@jgoyvaerts
jgoyvaerts force-pushed the pr/hk-g17p-alias-patch branch from f91d963 to 7ebd619 Compare November 21, 2026 17:27
@jgoyvaerts

Copy link
Copy Markdown
Author

Rebased on aurora-wip fa9a6766c, new head 7ebd619d1.

Tested on M4 Pro (G17P), kernel m4.177, guarded, 0 recoveries: meson --suite asahi --suite vulkan 220/220. dq-fast on a 37339-case compute/SSBO/GLSL/SPIR-V list, base fa9a6766c and head in one chain: 18884 P / 18455 NS each, 0 differ. GL (EGL pbuffer: tex 3/3, GLES3 392/392, GLES3 subset 2556 P / 20 NS, GLES31 subset 1001/1001) is the same on base and head. The bt alias rows in the body are still from 2644e788a. The PR diff is unchanged apart from the test line. aurora-wip has since moved to b8762aab9 (#600), which merges cleanly.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up on 7ebd619. One blocker is still open.

  • Resolved: point 1. The branch applies to aurora-wip again. Keeping hk_cdm_caches_pending() from #558 while dropping hk_cdm_alias_scope_unpatched() is right, and the mock_bo_alloc(..., NULL) test line is fine.
  • Still open: point 2 (blocker). src/asahi/vulkan/hk_event.c:165-182,206-208 has not changed. hk_dependency_waits_for_host() still returns false for a VkDependencyInfo with zero barrier structs, and that is a valid wait on an event the host sets. Such a wait gets no alias scope, so the evalias case is still reachable. Fix: return true when the dependency info has no barriers, or when the event was not set earlier in this command buffer.
  • Still open: point 3 (hk_buffer.c:288-292, unbound capture/replay buffer address), not a blocker.
  • Evidence: the new rows (meson 220/220, the 37339-case dq-fast list, the GL set) are on M4 Pro only. The bt alias rows are still from 2644e788a. The rows from our last comment are still needed on the new head: bt plus the replay/descriptor-buffer/event list on M4 Pro and A18 Pro, the G13/G14 capture/replay and memory.* run, and the M5 alias/event subset.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr

Copy link
Copy Markdown

J714s (M5 Pro, G17S / AGX3C) Hardware Row — 7ebd619d176d

Tested head 7ebd619d176d3cd5c75fdb49095bef39cfdc9735 against merge-base fa9a6766c012ca4a62c8a854b9704181458bfce2 on J714s (M5 Pro, G17S, kernel 7.3.0-m5-sship7), 0 GPU recoveries, 0 kernel errors (journalctl -k -p err empty):

  • Asahi / Borealis unit tests (asserts on): 147/147 PASS (rc=0), including direct runs of hk_host_alias_test, hk_execution_allowance_test, hk_pack_test, hk_sparse_alias_test, and hk_barrier_test.
  • aurora-packtest (20 standard arms): 20/20 PASS (failures=0) with both HK_PACK_CDM_SUBMIT=1 and HK_PACK_CDM_SUBMIT=0 (e.g. chain242 578 us packed vs 3263 us unpacked, depth 5347 us vs 12173 us).
  • dEQP-VK.synchronization*.event* (5,925 listed cases, sync1 + sync2): 5,922 Pass / 3 Skip / 0 Fail on both head and base (0 regressions, 0 status diffs).
  • dEQP-VK capture/replay BDA + descriptor_buffer (1,665 listed cases): 1,018 Pass / 647 Skip / 0 Fail on both head and base (0 regressions, 0 status diffs).
  • Alias packtest arms (caveat — harness alloc -2 on both base and head):
    • hostpriv: PASS on all 4 configurations (head pack1: 266.3 us best / 275.8 us mean; head pack0: 262.2 / 272.8 us; base pack1: 276.9 / 571.5 us; base pack0: 315.1 / 322.8 us).
    • The immediately following alias arm aborted identically on both base and head (pack1 and pack0) with FATAL packtest.c:343 vkAllocateMemory(g.dev, &ai, NULL, m) = -2 (VK_ERROR_OUT_OF_DEVICE_MEMORY), so the remaining alias arms after hostpriv did not execute on G17S yet.

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up on the J714s (M5 Pro, G17S) row for 7ebd619. The blocker from my last comment is still open, because the code hasn't changed.

What the row covers: the M5 event subset (5,922/3/0 on head and base, no status diffs), capture/replay BDA plus descriptor_buffer with no diffs, and 147/147 unit tests. Those count toward the M5 part of the evidence list.

Still open:

  1. Blocker, src/asahi/vulkan/hk_event.c:165-182,206-208: hk_dependency_waits_for_host() still returns false for a VkDependencyInfo with no barrier structs. The CTS event list passing doesn't show this case is safe. It needs an event the host sets, a wait with an empty dependency info, and memory that first aliases after the command buffer was recorded. The event list doesn't build that combination. Fix as before: treat an empty dependency info, or an event not set earlier in this command buffer, as a host wait.
  2. The M5 alias arms are the part of the row that tests this PR's patch-in-place path, and only hostpriv ran. The next arm hits vkAllocateMemory = -2 on both base and head, so it says nothing about the change either way. Please size that arm's allocation from the device's reported heap size, or skip it when the heap is too small, and re-run the remaining alias arms on G17S.
  3. Still needed on 7ebd619: the bt alias rows plus the replay/descriptor-buffer/event list on M4 Pro and A18 Pro (the bt rows are still from 2644e788a), and the G13/G14 capture/replay and memory.* run.

HW rows (our Macs): J616s (M4 Pro) and Neo (A18 Pro, G17P), the bt alias list plus dEQP-VK.synchronization*.event*, dEQP-VK.binding_model.descriptor_buffer.* and the capture/replay BDA cases on head and merge-base. Pass: 0 status diffs and 0 GPU recoveries. M1 Pro (G13S) and M2 (G14G): capture/replay plus dEQP-VK.memory.*, with the same pass.

Assisted-by: LLM (Claude:Opus 5.5)

@jgoyvaerts
jgoyvaerts force-pushed the pr/hk-g17p-alias-patch branch from 7ebd619 to 2eaec51 Compare November 22, 2026 02:19
@jgoyvaerts

Copy link
Copy Markdown
Author

New head 2eaec513f, rebased on aurora-wip 8e288e5db.

Point 2 (blocker), hk_event.c:168-189. hk_dependency_waits_for_host() now asks the reverse question: a wait counts as a host wait unless some barrier has a device source stage and none has HOST. VUID-vkCmdWaitEvents2-pEvents-03839 only says a vkSetEvent wait's barriers hold nothing but host operations in their first scope. So besides zero barriers, a barrier with srcStageMask = NONE (for example a layout transition) is also valid, and the zero-barrier check alone would have missed it. I chose this over "event not set earlier in this command buffer" because it decides from the wait alone, with no per-command-buffer set tracking, and it doesn't put events set by another command buffer on the memory-scope path. sync1 is unchanged: vk_common_CmdWaitEvents() always passes one barrier with the app's srcStageMask. New shim test hk-g17p-event-alias: on G17P it records fill → vkCmdWaitEvents2 → barrier → fill, ends the command buffer, then creates a sparse buffer (the first aliasing resource) and reads the alias trace's patched= count. A host-event wait with no barriers, with a NONE source and with HOST must leave nothing to patch (memory scope was taken at End). An event set in the same command buffer must still be patched (1). The no-barrier and NONE cases fail on 7ebd619d1 and pass now. I didn't add a GPU stale-read row for these forms: without HOST in the source scope, the wait doesn't make the host's writes visible, so that row would be outside the memory model.

Point 3, hk_buffer.c:644. vkGetBufferOpaqueCaptureAddress() returns 0 for a KHR capture/replay buffer that isn't bound yet, and hk-*-capture-replay checks that before the bind.

Rebase. One conflict, in hk_device_memory.c with a66f5d46b (BO cache before /proc/meminfo). I kept its order (size guard, cache hint, meminfo) and this PR's rule that capture/replay memory, which is never cached, skips the cache hint: (capture_replay || !agx_bo_cache_has(...)).

J616s (M4 Pro, G17P), kernel m4.177, head vs merge-base 8e288e5db, one guarded chain, 0 GPU recoveries:

  • bt alias modes (xsemq left out after the 11-20 multi-queue firmware crash): head 0 stale rows in every mode, with and without HK_PERFTEST=weakbarrier, except inflight (12/24, outside the memory model, as before). The base still reads stale in late 16/24, pending/simul/xsem 4/4, event 4/8, sparselate 4/12, hostlate 4/8, concrec 4/4, evalias 4/4.
  • dq-fast, 7106 cases (descriptor_buffer, buffer_device_address with every replay case, RT capture_replay, external memory, sparse buffer): 6647 P / 459 NS on both, 0 differ.
  • synchronization*.event*, 6213 cases one at a time: 5779 P / 434 NS on both, 0 status differences.
  • GL set is the same on both. meson --suite asahi --suite vulkan 231/231.

M5 alias arms (Dj's row). I couldn't change the arm that fails vkAllocateMemory = -2. Its harness isn't in aurora-wip's aurora_packtest.c (no alias arms there) or any branch we can reach. @DjDeveloperr, could you size that arm from VkPhysicalDeviceMemoryProperties::memoryHeaps[...].size (or skip it below that), or push the harness so we can? It fails on both base and head. Both include #440's UMA heap sizing, so the heap may now be smaller than the arm assumes. A G17S re-run of the remaining alias arms, plus hk-g17p-event-alias's M5 counterpart if you want one, would close the M5 part.

@RyanTheTide, could you run the A18 Pro (Neo) bt + replay/descriptor-buffer/event row, and the M1 Pro (G13S) and M2 (G14G) capture/replay + dEQP-VK.memory.* rows on 2eaec513f? We have none of those machines.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown

Re-checked at 2eaec51. hk_dependency_waits_for_host() is right now. A wait is treated as possibly host-set unless some barrier names a device source stage and none names HOST, which matches 03839/01158: a vkSetEvent wait may carry no barriers, HOST, or NONE sources, while vkCmdSetEvent{,2} can't put HOST in its stage mask, so a device-set event's matching wait always lands on the patched path. sync1 is unaffected, since the common wrapper always passes the app's srcStageMask. The new hk-g17p-event-alias cases fail on the old head and pass here for the no-barrier and NONE forms, which is the evidence the blocker needed. No further points from me.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial review of 2eaec513f3cc against the pre-PR checklist. 0 code or attribution blockers remain (all functional points from the 7ebd619d review are cleanly addressed), but 1 hard-rule naming blocker (§6) remains alongside owed multi-generation hardware rows (§5).

Blocker (§6 Naming — hard rule)

  • New user-visible Meson test names and test executables added by this PR use the hk- prefix instead of Borealis (brl-):
    • src/asahi/meson.build: 'hk-' + chip + '-capture-replay' and 'hk-g17p-event-alias'
    • src/asahi/vulkan/meson.build: 'hk-vulkan-capture-replay' and 'hk-vulkan-event-alias'
  • Per pre-PR checklist §6, existing upstream hk_* C filenames/symbols wait for #591, but new user-visible executables and Meson test names must use the brl- prefix (e.g., brl-vulkan-capture-replay, brl-vulkan-event-alias, brl-<chip>-capture-replay, brl-g17p-event-alias), matching #614.

Checklist & Code Audit (all clear)

  • Previous blockers resolved:
    • Host-event wait detection (src/asahi/vulkan/hk_event.c:168-189): hk_dependency_waits_for_host() now treats a wait as host-capable whenever any barrier names VK_PIPELINE_STAGE_2_HOST_BIT or the combined srcStageMask is VK_PIPELINE_STAGE_2_NONE (covering zero-barrier and NONE-source waits per VUID 03839/01158). Secondary command buffers replay into the primary via vk_cmd_queue_execute(), so secondary waits set cmd->state.alias_host_wait on the primary. Covered by the new event-alias shim test.
    • Unbound KHR capture/replay opaque address (src/asahi/vulkan/hk_buffer.c:652): hk_GetBufferOpaqueCaptureAddress() now returns 0 when !buffer->vk.device_address instead of hitting vk_buffer_address()'s assert, and the capture/replay shim test checks this before bind.
  • agx_bo_create_at() & capture/replay placement (agx_bo.c, agx_device.c, agx_device_virtio.c, hk_device_memory.c):
    • Ownership of va on both native and virtio failure paths is clean (no leak or double-free), AGX_BO_NO_CACHE prevents VA reuse while freed, and the rebase over a66f5d46b properly skips agx_bo_cache_has() for capture_replay allocations.
  • In-place patching & cache maintenance (hk_cmd_buffer.c, hk_cmd_buffer.h, hk_tess_batch.c, hk_cmd_draw.c):
    • hk_cmd_buffer_patch_alias_sites() flushes patched words on cached command memory (hk_g17p_cached_cmd_memory()) before fencing, hk_cs::alias_pin protects pinned tessellation tails and moves cleanly across hk_cs_merge_cdm_until(), and hk_va_tagged_caches() selects the shared dynamic mechanism by hardware property. Keeping the M5-only end-of-stream flush (agx_chip_g17_m5) has a documented hardware justification (bt xsub on G17P).
  • Clean-room & attribution (§4): Clean-room throughout; all 4 commits carry human author/committer and single human Signed-off-by: with no agent trailers; PR body has the Assisted-by: disclosure.

Owed Hardware / Runtime Evidence (§5)

  • Covered on 2eaec513f3cc: J616s (M4 Pro, G17P) — bt alias modes (0 stale outside out-of-model inflight, default and weakbarrier), 7,106-case dEQP-VK replay/descriptor-buffer/external-memory/sparse list (0 diffs), 6,213-case synchronization*.event* (0 diffs), GL set identical, meson --suite asahi --suite vulkan 231/231, 0 GPU recoveries.
  • Still owed on the final head:
    • M5 (J714s / G17S): The prior M5 row was on 7ebd619d, and the alias packtest arms after hostpriv aborted identically on base and head with vkAllocateMemory = -2 (VK_ERROR_OUT_OF_DEVICE_MEMORY). Needs re-run on the final head including the remaining M5 alias arms once the test harness sizes its allocation to the reported heap.
    • A18 Pro (Neo, second G17P SoC): bt alias matrix + replay/descriptor-buffer/event dEQP subset (0 diffs, 0 recoveries).
    • AGX2 (M1 Pro G13S / M2 G14G): Commits 1–3 change capture/replay memory and buffer placement across every chip; dEQP-VK capture/replay + memory.* no-regression rows are still owed.

Assisted-by: LLM (Gemini 4 Neon)

@jgoyvaerts
jgoyvaerts force-pushed the pr/hk-g17p-alias-patch branch from 2eaec51 to 26e8749 Compare November 22, 2026 05:58
@jgoyvaerts

Copy link
Copy Markdown
Author

New head 26e87494a: the §6 naming blocker is fixed. The new user-visible Meson names now use brl-, matching #614:

  • src/asahi/meson.build: 'brl-' + chip + '-capture-replay' and 'brl-g17p-event-alias'
  • src/asahi/vulkan/meson.build: 'brl-vulkan-capture-replay' and 'brl-vulkan-event-alias'

Each rename sits in the commit that adds the test: the capture/replay names in commit 2, the event-alias names in commit 4. The commit messages now name the tests the same way. As in #614, the meson variables (hk_vulkan_*) and the hk_*.c file names stay as they are until #591. No other new hk- user-visible names are left in the PR.

git range-diff 8e288e5db..2eaec513f 8e288e5db..26e87494a shows commits 1 and 3 unchanged, and in commits 2 and 4 only those four name lines and the two message mentions. meson --suite asahi --suite vulkan is 231/231 on J616s, with brl-g13g-capture-replay, brl-g17p-capture-replay and brl-g17p-event-alias passing. The driver code is unchanged, so I didn't re-run the GPU rows; the J616s rows on 2eaec513f still hold.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr

Copy link
Copy Markdown

J714s (M5 Pro, G17S B1 / AGX3C) Runtime Row — 26e87494a60a

Tested exact PR head 26e87494a60a1b1b88e1e3f609baa50c457a6020 on physical J714s (Apple M5 Pro, G17S B1, kernel 7.3.0-m5-slc1, release build of libvulkan_asahi.so, MESA_SHADER_CACHE_DISABLE=1):

  • Unit & live Vulkan tests on M5 Pro:
    • hk_host_alias_test, hk_execution_allowance_test, hk_tess_batch_test (35/35), hk_memory_oom_test: PASS
    • brl-vulkan-capture-replay (live against M5 Pro ICD): PASS
  • M5 Pro packtest alias arms (per-arm runs avoiding cumulative multi-device heap pressure, 5 iterations each, both HK_PACK_CDM_SUBMIT=1 and HK_PACK_CDM_SUBMIT=0):
    • 9/9 spec-valid alias arms PASS in both modes (18/18 runs, 0 mismatches):
      • hostpriv: PASS (pack=1: 253.8 us best; pack=0: 250.3 us best)
      • hostalias: PASS (pack=1: 174.1 us; pack=0: 872.4 us)
      • hostalias-late: PASS (pack=1: 218.3 us; pack=0: 778.7 us)
      • hostalias-xsub: PASS (pack=1: 267.0 us; pack=0: 1379.9 us)
      • sparsealias: PASS (pack=1: 208.8 us; pack=0: 754.5 us)
      • sparsealias-late: PASS (pack=1: 208.2 us; pack=0: 691.7 us)
      • sparsealias-xsub: PASS (pack=1: 225.8 us; pack=0: 232.7 us)
      • cralias: PASS (pack=1: 183.8 us; pack=0: 799.7 us)
      • sparsealias-pending: PASS (pack=1: 678.7 us; pack=0: 155.2 us)
    • Note on cralias-pending (harness bug, not a driver regression): packtest.c:459 calls vkGetBufferDeviceAddress() on an unbound non-sparse KHR capture/replay buffer (violating VUID-VkBufferDeviceAddressInfo-buffer-02600), which intentionally returns 0 under single-VA KHR capture/replay (Commit 2), causing the harness shader to dereference 0x0. The valid sparse equivalent (sparsealias-pending) and bound cralias both pass in both modes.
  • dEQP-VK (exact head 26e87494a60a):
    • dEQP-VK.synchronization2.basic.event.*: 17 Pass / 0 Fail / 0 NotSupported
    • dEQP-VK.binding_model.buffer_device_address.*capture_replay*: 10 Pass / 0 Fail / 0 NotSupported
  • Kernel / GPU health: 0 new GPU recoveries, 0 MMU faults, 0 client failures in dmesg.

Assisted-by: LLM (Google:Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown

Re-checked at 26e8749. Against 2eaec51 the only change is the four Meson test names (hk- to brl-); the driver code is identical, so the J616s rows on 2eaec51 still apply.

On the J714s row at this head: the alias arms are what this PR's patch-in-place path needed on M5, and 9/9 passing in both pack modes, with the earlier vkAllocateMemory = -2 gone, covers that part. Two things are still open on M5:

  • The dEQP part at this head is 17 synchronization2.basic.event.* cases and 10 BDA capture/replay cases. The 7ebd619 row ran 5,925 event cases and 1,665 BDA plus descriptor_buffer cases, but hk_event.c (hk_dependency_waits_for_host()) and hk_buffer.c changed after that head and both reach M5. Could you re-run that full event list and the BDA/descriptor_buffer list on 26e8749, with the merge-base beside it?
  • cralias-pending is not a harness bug. VUID-VkBufferDeviceAddressInfo-buffer-02600 requires binding only for buffers created without VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, so vkGetBufferDeviceAddress() on an unbound capture/replay buffer is valid. Here, a KHR capture/replay buffer gets no VA until bind (hk_buffer.c:282-292), and the query goes through vk_buffer_address() (src/vulkan/runtime/vk_buffer.h:78), which asserts in debug builds and returns 0 + offset in release. The 0-return at hk_buffer.c:649-653 covers only the opaque query. Did cralias-pending pass on the merge-base, where the buffer still had its own VA? If it did, commit 2 regresses a valid case on every chip, and the buffer needs an address before bind (or the query needs an answer other than 0).

Still to come on 26e8749: the A18 Pro bt alias matrix with the replay/descriptor-buffer/event list, and the M1 Pro (G13S) and M2 (G14G) capture/replay and dEQP-VK.memory.* runs, since commits 1-3 change capture/replay placement on every chip. We will post those here.

Assisted-by: LLM (Claude:Opus 5.5)

@jgoyvaerts
jgoyvaerts force-pushed the pr/hk-g17p-alias-patch branch from 26e8749 to 29774f8 Compare November 22, 2026 14:50
@jgoyvaerts

jgoyvaerts commented Nov 22, 2026 •

Copy link
Copy Markdown
Author

New head 29774f827. Only hk_buffer.c/hk_buffer.h and the capture/replay shim test changed, all in commit 2.

cralias-pending and the unbound address query. VUID-VkBufferDeviceAddressInfo-buffer-02600 is no longer in the spec. In the current registry (1.4.363, the header version aurora-wip ships, and already in 1.4.335), its rule is part of VUID-vkGetBufferDeviceAddress-bufferDeviceAddress-03324. That VUID requires one of three things: the buffer is sparse; it is bound completely and contiguously to one VkDeviceMemory; or it was created with VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT and VkPhysicalDeviceBufferDeviceAddressFeaturesEXT::bufferDeviceAddress is enabled. Under Vulkan 1.2 / KHR buffer device address, a non-sparse capture/replay buffer must therefore be bound before vkGetBufferDeviceAddress(). The address is not defined before the bind, and the debug assert in vk_buffer_address() is on an invalid call. If the arm uses the KHR feature, as Dj's note says, it makes that call, so the fix is in the harness: query after the bind, or enable bufferDeviceAddressCaptureReplayEXT for that arm. EXT capture/replay buffers still get their own VA when they are created (hk_buffer.c:286-298), and brl-*-capture-replay now queries the EXT address before the bind and checks that the bind doesn't change it. On the merge-base, the KHR buffer had a VA of its own, which is the second mapping this PR removes, so an early query could work there. We can't run the harness to confirm that it passed there (it isn't in aurora-wip's aurora_packtest.c or any branch we can reach).

What was wrong: the opaque query. vkGetBufferOpaqueCaptureAddress() has no binding rule (only 10725 and 03326), and it must return the opaqueCaptureAddress the buffer was created with. On replay, before the bind, 26e87494a returned 0. The buffer now keeps the requested address from creation and returns it, before and after the bind. With no address requested, it returns its address once bound and 0 before that (no specific address). The EXT path reads the same field for its fixed VA. Allocation and VA placement are unchanged, so nothing aliases again. brl-{g13g,g17p}-capture-replay checks the query before the bind on capture and on replay, and both fail on 26e87494a.

J616s (M4 Pro, G17P), kernel m4.177, against merge-base 8e288e5db, one guarded chain on cb450e343 (this head minus the one-line field reuse, which gives the same value), -j 3, 0 GPU recoveries:

  • dq-fast, 7106 cases (descriptor_buffer, buffer_device_address with every replay case including the 10 capture_replay_stress seeds, RT capture_replay, external memory, sparse buffer): 6647 P / 459 NS, 0 differ from the base baseline.
  • dq-fast, 4878 dEQP-VK.memory.* cases (address_binding_report, allocation.basic, binding, device_memory_report, requirements, map_placed, mapping without random): 4786 P / 92 NS on base and head, 0 differ.
  • meson --suite asahi --suite vulkan 231/231 on cb450e343 and on 29774f827.
  • No GL rerun: no shared asahi code changed. The bt and event rows on 2eaec513f still hold, because hk_event.c and the barrier code are unchanged since then.

M5. We have no rows of our own. @DjDeveloperr, the full event list and the BDA/descriptor_buffer list on this head with the merge-base beside it, as Ryan asked, would cover hk_event.c and hk_buffer.c on G17S. cralias-pending should run after the harness change above. The A18 Pro, M1 Pro (G13S) and M2 (G14G) rows are still with Ryan.

Assisted-by: LLM (Claude:Opus 5.5)

@jgoyvaerts

jgoyvaerts commented Nov 28, 2026 •

Copy link
Copy Markdown
Author

@RyanTheTide it's up: aurora-wip b15642289 merged in (merge commit, no rebase), head 5a78251f9. It also merges cleanly on today's 3c22d0909.

Conflicts and how they were resolved:

  • hk_buffer.c: borealis: preserve sparse residency map VA on buffer capture/replay #1067's buffer address and residency-map address both stay on descriptor replay, next to the KHR placement. vkGetBufferOpaqueCaptureAddress() now takes its address from hk_get_buffer_replay_addrs().
  • hk_CreateDevice() (hk_device.c:1068): dynamic alias tracking is selected from the device: VA-tagged caches (hk_va_tagged_caches(), so G17P and M5) and no device-wide memory scope (!agx_cdm_ordering_memory_scope()). ASAHI_M5_HOST_ALIAS_STATIC is honoured on M5 only, so G17P is not covered by the static override. hk_cdm_alias_scope() also follows agx_cdm_ordering_memory_scope().
  • va_alias_resources: borealis: keep barriers cheap until memory aliases, then strengthen them in place (G17P, M5) #554 had removed it, but 035af0da4 since made it an exact per-import count on every chip, read by the byte/2D stencil tiling and the optimized compute kernels. It stays for those paths with all of its sites. Barrier scope still follows alias_live. The byte-stencil check is aurora-wip's again, which drops the old risk note for chips without VA-tagged caches.
  • hk_cmd_buffer.{c,h}: aurora-wip's AGX2 sparse patch sites move with a stream merge next to the alias sites. aurora-wip now cleans patched words on cached command memory itself.
  • hk_cmd_draw.c: keeps G18G's sealed-dispatch check. In the tests, test-hk-memory-oom's host-import section now checks the per-import count on G13G and on G17P/G17C with dynamic tracking. hk_query_oq (new) gets a hk_cdm_note_alias_site() stub.

J616s at 5a78251f9 against a build of b15642289, 0 GPU recoveries:

  • dEQP-VK 7106-case replay/dbuf/extmem/sparse list: 6647 P / 459 NS, 0 differ.
  • GL tex probe + GLES3 392/392 on both builds.
  • meson asahi+vulkan: 354/354.

Edit, 17:52 UTC: rows at 5a78251f9.

  • bt alias modes, rows with stale words, base -> head: late 16/24 -> 0/24; pending/simul/xsem 4/4 -> 0/4 each; event 4/8 -> 0/8; sparselate 4/12 -> 0/12; hostlate 4/8 -> 0/8; concrec and evalias 4/4 -> 0/4. alias/hostalias/dmabuf/xsub are 0 on both, and inflight (outside the memory model) is 12/24 as before.
  • synchronization*.event*, 6213 cases serially: 6210 P / 3 NS on both, 0 differences.
  • 0 GPU recoveries, 0 kernel error lines.

Still open: the J714s run Dj asked for, and the Neo row your fleet reruns.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at 5a78251f

Blockers:

  1. Exact-head hardware rows owed from the prior review (f5577f47) and Not yet:
    • Finish the queued J616s (G17P) bt alias modes and 6,213-case synchronization*.event* runs at 5a78251f.
    • Add the J714s (M5 Pro) exact-head comparison against b15642289 covering synchronization*.event*, BDA capture/replay, descriptor_buffer, and the packtest alias arms in both packing modes.

Checked:

  • Merge commit 5a78251f (2785fdd19 + aurora-wip b15642289): 0 code blockers found.
    • agx_bo.c, agx_device.c, agx_device_virtio.c: agx_bo_create_at() takes ownership of va and frees it on both native and virtio allocation failure paths with AGX_BO_NO_CACHE.
    • hk_buffer.c: preserves #1067 sparse descriptor replay (hk_get_buffer_replay_addrs() restoring both buffer and residency-map addresses) alongside KHR capture/replay placement, and hk_GetBufferOpaqueCaptureAddress() returns opaque_capture_address / 0 when unbound.
    • hk_device.{c,h}: hk_va_tagged_caches() covers G17P and M5, hk_CreateDevice() respects agx_cdm_ordering_memory_scope() (multi-die M5) while keeping ASAHI_M5_HOST_ALIAS_STATIC M5-only, and va_alias_resources exact counting stays intact for byte/2D stencil tiling and compute paths.
    • hk_cmd_buffer.{c,h}, hk_cmd_dispatch.c, hk_cmd_draw.c, hk_event.c, hk_tess_batch.c: alias_pin protects patch-site barrier records from being dropped in hk_tess_batch_stage() and updates cleanly across hk_cs_merge_cdm_until() folding/linking; hk_dependency_waits_for_host() accurately narrows host-set event detection; Borealis test/executable names use brl-.
Evidence
  • Head: 5a78251f (MERGEABLE, +1032/-313 across 26 files).
  • Exact-head J616s (5a78251f vs b15642289): 7,106-case dEQP-VK replay/descriptor-buffer/external-memory/sparse (6647 P / 459 NS, 0 diffs), GLES3 392/392, meson --suite asahi --suite vulkan 354/354.
  • Remaining items to clear: queued J616s bt + synchronization*.event* at 5a78251f and the M5 J714s exact-head rerun requested in the prior review.

@RyanTheTide

Copy link
Copy Markdown

Current aurora-wip A/B on 06e34ecacbf3 versus integration 12ee1ea7eb49 containing 5a78251f9f6b. The 42 serial CTS cases covered synchronization events, buffer-device-address capture/replay and descriptor buffers.

  • J700 A18 Pro (G17P): 42 Pass on both ICDs.
  • J316s M1 Pro (G13S): 31 Pass and 11 NotSupported on both ICDs.

The standalone capture/replay fixture passed on both candidate runs. On both baselines it stopped at the opaque buffer replay-address check. On J700, the event alias fixture reported zero late patches for each of the three host-wait patterns and one for the device-set control. That fixture checks recording-time behavior and does not submit GPU work. There were no GPU faults or boot changes. Both exact contributor-fork CI checks passed. M2 coverage and the full exact M5 event/BDA/descriptor and both-mode alias runs remain due.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH at 5a78251

Checked: Verified exact contributor CI and the J616s alias/event evidence, plus the independent J700 and J316s comparisons. J700’s recording-time alias fixture does not submit GPU work. The full J714s M5 event, BDA, descriptor and both-packing-mode alias comparison remains due; keep the tracked M2 coverage.

@RyanTheTide

Copy link
Copy Markdown

The M2 regression check is complete on J473 (G14G), running the saved 7.3.0-aurora-m2combo30 boot. Compared landed 06e34ecacbf3 with preview 12ee1ea7eb49 containing 5a78251f9f6b.

All 42 Vulkan CTS statuses matched (31 Pass and 11 NotSupported per arm) across event synchronization, BDA capture/replay and descriptor buffers. The standalone opaque-address replay failed on baseline and passed on the candidate. No GPU faults or boot changes. The J714s event, BDA/descriptor and both alias packing modes are still outstanding.

@RyanTheTide

Copy link
Copy Markdown

Jonathan, two items remain on #554.

  1. The new trunk conflicts in hk_CmdSetEvent2 after 91b85fae79a3. A local forward merge onto 8bad0a5741b4 dispatches the pending transfer writes and refreshes the active stream before recording the deferred alias site or applying the visibility flush. The local preview passed 358/358 host tests and all 42 J700 CTS cases on both drivers. Opaque capture/replay failed on baseline and passed on the preview. The recording fixture passed all three host-event checks and the device-set control.
  2. The existing review still needs the J714s event, BDA capture/replay and descriptor-buffer CTS comparison and the valid alias arms in both packing modes.

If you’re taking the merge, please keep both event paths and let us know here. If there’s no update by November 30 at 19:56 AEDT, I’ll refresh and carry the tested forward merge, then request exact-head review. The J714s row is still queued.

Signed-off-by: DjDeveloperr <hey@djdev.me>

@aurora-silicon-review aurora-silicon-review Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded 12-01: not a hold under the merge bar (no shown failure). No code affirmation for integration delta; follow-ups: integrated build, M5 Pro event/BDA/descriptor/alias comparisons

The current integration changes shared command and synchronization paths since the earlier reviewed build. Please confirm the current integrated build and provide the outstanding M5 Pro event, BDA capture/replay, descriptor buffer and both alias packing-mode comparisons. The earlier recording-time fixture did not submit GPU work.

@DjDeveloperr

Copy link
Copy Markdown

Merged aurora-wip at 5842cc694cf9. In src/asahi/vulkan/hk_event.c:342, CmdSetEvent2 dispatches pending transfer writes and refreshes the active stream before recording the alias site or flushing. The remaining M5 check is event, BDA capture/replay and descriptor-buffer CTS plus the valid alias fixture in both packing modes, with the buffer bound before querying its address.

@github-actions github-actions Bot added area:asahi-common Area from CODEOWNERS (bot) area:borealis Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) changes-requested A reviewer requested changes (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) merge-conflict Conflicts with the base branch (bot) labels Dec 1, 2026
aurora-wip's e9831e6 moved the host-alias trace from
ASAHI_M5_HOST_ALIAS_TRACE to ASAHI_MESA_DEBUG=hktrace, still on M5 only,
and 68378cf removed the ASAHI_M5_HOST_ALIAS_STATIC override. This
branch traces and patches on every chip with VA-tagged caches
(hk_va_tagged_caches(), G17P and M5), so the merge takes hktrace for the
trace and keeps this branch's chip condition without the removed
override.

The event-alias test read the trace through ASAHI_M5_HOST_ALIAS_TRACE;
it now adds hktrace to ASAHI_MESA_DEBUG, keeping the caller's flags, as
aurora-packtest does.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at 265c547cfd9f. Both code items from my last review are fixed, so I'm clearing my change request.

  • hk_buffer.c: capture/replay buffers take both replay addresses from hk_get_buffer_replay_addrs(), so #1067's sparse residency-map address is kept, and a KHR buffer only reserves its own VA when bufferDeviceAddressCaptureReplayEXT is enabled.
  • hk_CreateDevice: dynamic alias tracking is chosen by hk_va_tagged_caches(), not by the M5 check, and the M5 static-mode override isn't extended to G17P.
  • hk_CmdSetEvent2 (hk_event.c:342) dispatches pending transfer writes before it records the alias site or the visibility flush. hk_dependency_waits_for_host() treats no barriers, and HOST or NONE source stages, as host waits.
  • The new test names use brl-.

Merge waits on one row: J714s (M5 Pro) at this head, with the synchronization event, BDA capture/replay and descriptor-buffer lists against base, and the alias fixture in both packing modes. It's requested. Merge-result CI on current aurora-wip is at https://github.com/DjDeveloperr/mesa/tree/ci/head-554-ec520d24.

@DjDeveloperr

Copy link
Copy Markdown

J714s row at 265c547cfd9fc7a7cb74d83b005b68f13e65fca9: passed.

MacBook Pro (M5 Pro, G17S B1), stock 7.3.0-m5-pr67, boot 6c48d997-34de-4cbd-abe5-b8ecd12b4a7d, SLC on (16 planes). Base is the merge base with aurora-wip, 31b9bb7866f5d155b8722ccc8873e12cc63b13f3. Both drivers ran on the same boot, headless (no display), selected per process with VK_DRIVER_FILES; every process was checked to have the intended driver mapped.

Driver Commit libvulkan_asahi.so SHA-256
base 31b9bb7866f5 6e441d31bebd321e515136a72632456442073350ac3063e09d523ba668b15c27
head 265c547cfd9f 38e26a50fcd0d05a5050a6379a89ddf6d632d2cc169c5f904019eb58138af884
  • aurora-packtest pack0: base pass, head pass. SUMMARY PASS failures=0
  • aurora-packtest pack1: base pass, head pass. SUMMARY PASS failures=0
  • brl-vulkan-capture-replay default: base fail, head pass.
  • brl-vulkan-event-alias default: base fail, head pass.
  • vulkan-storage-alias default: base pass, head pass. SUMMARY 41/41 case groups pass
  • Vulkan CTS 1.4.7.1: 12993 cases on every driver (list of 12993, spread over the row's groups). base 10125 Pass, 2868 NotSupported; head 10125 Pass, 2868 NotSupported. Status differences: 0, regressions: 0.
  • New GPU/kernel fault lines attributed to base / head: 0 / 0.
  • Scope: The hk: give M5 barrier flushes memory scope only on devices that can alias memory #266 'bt' alias tool is not in the tree and not in the kit; the packtest arms run with HK_PACK_CDM_SUBMIT=0 and =1, plus the in-tree capture/replay, event-alias and storage-alias programs.

Handback: postflight clean (stock snapshot, boot, pacman -Qkk mesa 0 altered, system ICD files and GPU capacity unchanged), test directory removed, lease released ok.

@DjDeveloperr

Copy link
Copy Markdown

J700 (G17P) second-generation row, merge-tree: mesa#554 merge-tree row · J700 MacBook Neo (A18 Pro, G17P B1), stock Fedora 44 kernel 7.3.0-41.fc44.aurora, same boot, userspace only · base aurora-wip tip fd2d93544681 vs head 265c547cfd9f merged into that tip (local merge 904d1f311263, tree 047c759c4d37): PASS — dEQP-VK event/BDA capture-replay/descriptor_buffer list, serial, from the J714s 12,993-case #554 list (the 11-29 42-case list is not recorded): tier 1 (1,827) + 27 serial event cases + 1 of 8 tier-2 slices, 3,254 cases compared (tip 3,021 Pass / 233 NotSupported, merge 3,021 Pass / 233 NotSupported), 0 status diffs; brl-vulkan-capture-replay tip FAIL → merge PASS; brl-vulkan-event-alias tip FAIL → merge PASS; 0 GPU faults, 0 kernel WARNINGs; stock handback verified.

Fixture tip fd2d93544681 merge 904d1f311263 (#554 head 265c547cfd9f merged into that tip)
brl-vulkan-capture-replay FAIL (vkGetBufferOpaqueCaptureAddress ≠ replay address) PASS
brl-vulkan-event-alias FAIL (host event, no barriers: patched=-1, want 0) PASS (all four cases as expected)
  • Case list: the 11-29 42-case list isn't recorded anywhere we could find, so this uses the J714s borealis: keep barriers cheap until memory aliases, then strengthen them in place (G17P, M5) #554 list. It ran serially: all 1,827 tier-1 BDA capture/replay cases, the 27 synchronization*.basic.event cases, and 1 of 8 tier-2 slices (1,400 event-op and descriptor_buffer cases) within the time cap. That is 3,254 cases compared, with 0 status diffs.
  • Kernel and GPU: 0 GPU faults and 0 kernel WARNs.
  • Handback: the stock fingerprint and both Apple partners were identical before and after.

Evidence on Mini: work/j700-mesa554-row-20261202/evidence/receipt-kcXLhvXQ/ (kit archive 2ab03996972c4480…). The merge commit has a fixed identity, so build/build-icds.sh fd2d93544681 31b9bb7866f5 reproduces 904d1f311263 for the J714s row.

@DjDeveloperr

Copy link
Copy Markdown

J714s merge-tree row (FRONTIER-554): 265c547cfd9fc7a7cb74d83b005b68f13e65fca9 merged into aurora-wip 5bed28382cacddc88a708ff81a915f5c522abdc6 passed.

The tested head is a local merge commit 949a8f462dea9a6d634fdd3a9dc87ecc9d8c8c77 (not pushed): tree 2c461b3c5ecf29a762e03bcd12960ff6f1909358, parents 5bed28382cacddc88a708ff81a915f5c522abdc6 (aurora-wip) and 265c547cfd9fc7a7cb74d83b005b68f13e65fca9 (this PR), merge base 31b9bb7866f5d155b8722ccc8873e12cc63b13f3, no conflicts. Base is the aurora-wip tip 5bed28382cacddc88a708ff81a915f5c522abdc6.

MacBook Pro (M5 Pro, G17S B1), stock 7.3.0-m5-pr67, boot a7360295-c649-497d-8eaf-1fe72696a2a2, SLC on (16 planes). Both drivers were built on the M5 from the exact commits and ran on the same boot, headless (no display), each selected per process with VK_DRIVER_FILES. dEQP and fixture processes were checked to have the intended driver mapped; GPUBench output had to carry the driver's git- stamp.

Driver Commit libvulkan_asahi.so SHA-256
base 5bed28382cac e88a11338bb7edc1b1bd81b6ffa45fdce46cbef85830624cd2404ba94953140e
head 949a8f462dea 326bd9c32aa3f9cd2e1d6e1d071bd4f2d16d52f0b010b8f1a27fad6f65dd3e59
  • aurora-packtest pack0: base pass, head pass. Head: SUMMARY PASS failures=0.
  • aurora-packtest pack1: base pass, head pass. Head: SUMMARY PASS failures=0.
  • brl-vulkan-capture-replay default: base fail, head pass.
  • brl-vulkan-event-alias default: base fail, head pass.
  • vulkan-storage-alias default: base pass, head pass. Head: SUMMARY 41/41 case groups pass.
  • Vulkan CTS 1.4.7.1, this row's list (12993 cases; the first 1827 are the groups this change touches most, the rest an even sample): 12993 cases ran on both drivers. base 10125 Pass, 2868 NotSupported; head 10125 Pass, 2868 NotSupported. Status differences: 0, regressions: 0.
  • GPU or kernel fault lines while base / head ran: 0 / 0.

Handback: postflight clean (same boot, stock snapshot, pacman -Qkk mesa 0 altered, system ICD files and GPU capacity unchanged), test directory removed, lease released ok.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at 265c547

Checked: The conflict resolution keeps capability-based alias tracking and the landed trace control. Event recording dispatches pending transfer writes and refreshes the stream before recording or flushing the alias site. Capture/replay gets both addresses through the common replay helper, including the sparse residency address, and separate VA reservation is limited to the EXT path. The J714s comparison passed capture/replay and alias fixtures and matched all 12,993 CTS outcomes. The J700 integration matched 3,254 CTS outcomes with no GPU faults. The exact fork build and policy suites passed.

Follow-ups: A future revision to these paths can split capture/replay address handling from barrier optimization so each change can be tested independently.

@RyanTheTide
RyanTheTide merged commit 876ab8a into aurora-silicon:aurora-wip Dec 2, 2026
@RyanTheTide

Copy link
Copy Markdown

Merged as 876ab8abd04a. Thanks, Jonathan, for the barrier and capture/replay work, and for carrying the fix through the latest integration. The exact fork jobs and J714s and J700 comparisons passed. The current merge tree also passed the memory and tessellation host checks.

jgoyvaerts added a commit to jgoyvaerts/mesa that referenced this pull request Dec 4, 2026
Conflicts:
- hk_device_memory.c, hk_system_memory_fits(): aurora-wip moved the
  reserve into hk_memory_reserve(); this branch's overflow-safe
  comparison now uses it.
- hk_device_memory.c, hk_AllocateMemory(): aurora-wip's capture/replay
  memory (aurora-silicon#554) is allocated at its own address after the same admission
  check. With DRM_ASAHI_FEATURE_IDLE_VM_RECLAIM it is left to the kernel
  too: no MemAvailable check, so the check's cache eviction is gone with
  it. A kernel refusal of capture/replay memory now evicts the idle
  cached BOs and tries once more, as agx_bo_create_checked() does for
  other memory, at a fresh reservation of the same address (a failed
  agx_bo_create_at() frees its address).
- test-hk-memory-oom.c: both sides' cases stay. The reclaim case also
  allocates capture/replay memory past the mock kernel's limit with a BO
  in the cache, and checks it reads no MemAvailable and evicts once.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:asahi-common Area from CODEOWNERS (bot) area:borealis Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) changes-requested A reviewer requested changes (bot) door:two-way Revertible or not, from Merge risk (bot) merge-conflict Conflicts with the base branch (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants