Repository navigation
hk: keep write-combined command memory on G16G - #1594
IronsideXXVI wants to merge 1 commit into
Conversation
Exclude AGX_CHIP_G16G from hk_g17p_cached_cmd_memory() so G16G (M4) uses write-combined command-buffer memory rather than CPU-cached command pools with explicit cache-clean publishes, while keeping CPU-cached command memory enabled on G15, G17P, and single-die M5. Add test_cached_cmd_memory_chip_policy() in test-hk-cmd-pending.c to verify hk_g17p_cached_cmd_memory() across all agx_chip values. Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: HOLD at 1d09f41352a1: it takes back a measured G16G gain without a measurement.
Blockers:
src/asahi/vulkan/hk_cmd_pool.h:123:dev->chip != AGX_CHIP_G16Gputs G16G alone on write-combined command memory. #1132 moved G16G to cached command memory on purpose, with an A/B on J713 (M4 Air):render.mdid=4 +5.74 %,render.lightd=16 +2.88 %,render.lightd=1 +0.42 % wall and 2 % less recording CPU, with slab suballocation, root reuse and push-descriptor elision on top. Undoing that needs an A/B showing which workload it hurts and by how much.- It's a chip gate with no hardware property behind it. If cleaning the cache costs too much on some submit path, that path is the place to fix (
hk_cmd_buffer_publish_cached_uploads(): how many lines it cleans, and when), for every chip that uses it.
Checked: no other chip changes; the new policy test fails when the predicate is put back; no overlap with other open PRs.
We put this head in our J773g timing kit (base afbbb02b06f1: llama.cpp Q4_K_M pp512/tg128 and gpubench compute.*). If write-combined memory wins there, the numbers will show which path to fix.
|
Thanks for the review and for adding this head to the J773g timing kit, @DjDeveloperr. Agreed that taking back |
|
HW: J773g (Apple M4 / G16G B0,
|
|
Thanks for running the isolated J773g A/B, @DjDeveloperr. With |
What: Restore write-combined (WC) command-buffer memory on G16G (M4) in Borealis (
hk):src/asahi/vulkan/hk_cmd_pool.h(hk_g17p_cached_cmd_memory()) currently returnsagx_chip_is_agx3_single_die(dev->chip) && util_has_cache_ops(), placing G16G on CPU-cached command/root/descriptor memory with explicit cache-clean publishes before submission.AGX_CHIP_G16G(dev->chip != AGX_CHIP_G16G) inhk_g17p_cached_cmd_memory()so G16G stays on write-combined command memory while keeping CPU-cached command pools enabled on G15, G17P, and single-die M5 (G17G/G17S/G17C).test_cached_cmd_memory_chip_policy()insrc/asahi/vulkan/tests/test-hk-cmd-pending.cverifyinghk_g17p_cached_cmd_memory()across everyenum agx_chipvalue.Tested:
1d09f41352a1onorigin/aurora-wip(f4a74912604,gcc 16.1.1,aarch64,-Dbuild-tests=true -Dtools=drm-shim,git merge-tree --write-treeclean4cbaf8ec1385):libvulkan_asahi.sobuilt cleanly (0warnings in touched files).hk_cmd_pending(test-hk-cmd-pending.c): PASS (1/1,hk_cmd_pending: ok, includingtest_cached_cmd_memory_chip_policy()).meson test -t 4 --suite asahi:403 Ok / 0 Fail / 1 Skipped.mesa-aurora/vulkan-aurora 1.8327,set 9a38001371d141eb, paired withlinux-aurora-next 1.1695,1df3ddcb45f9, boot433bd8d2):pp512 = 1627.26 tok/s(101.1%vs macOS),tg128 = 98.82 tok/s(iqr 0.09%,trim1 1.07%),RH64 = 246.99 us(100.9%),MLX = 90.66 tok/s,Quake = 1195.0 fps,0GPU faults.Risk: two-way door · G16G (M4) Borealis command-pool memory type only (
2files,+23 / -3lines, of which+5 / -3ishk_cmd_pool.hpredicate + comment). Every other single-die AGX3 chip (G15*, G17P, G17G/G17S/G17C), multi-die G17D, G18G, and AGX2 are unchanged, and Borealis already supports both WC and CPU-cached command pools cleanly across all upload/publish paths. A plain revert restores CPU-cached command pools on G16G.Not yet:
aurora-wip(1d09f41352a1) J604 / M4 hardware A/B (llama-benchpp512/tg128, Vulkan submission latency,gpubench-vk,0GPU faults) isolated from other1.8327carries.Offline & unit test details
Scope (
j604-hk-g16g-wc-cmd-memory, head1d09f41352a1onaurora-wipf4a74912604)src/asahi/vulkan/hk_cmd_pool.h(+5 / -3)src/asahi/vulkan/tests/test-hk-cmd-pending.c(+18)Signed-off-by: Dylan Ironside <dylan@dylanironside.io>git merge-tree --write-tree origin/aurora-wip HEAD: clean (4cbaf8ec1385e9f8927ef708778e17075ca30256).hk_cmd_pending1/1OK,meson test --suite asahi403 Ok / 0 Fail / 1 Skipped.