Repository navigation
hk: submit packing follow-ups from the #488 reviews - #558
DjDeveloperr wants to merge 2 commits into
Conversation
- The G16G rationale for packing global atomics, and the ordering note of the planner, now say what linux#2419 keeps true: the G16 kernel runs every compute command of a VM in order on its one firmware compute queue, never beside another VM's. It no longer runs one command of the device at a time. - The HAL200 boundary is limited to the G16 parts. G17A, the other HAL200 part, sits between G17P and M5, which both have tagged caches and a memory-scoped flush form; it has no boundary until its caches are known. G15's exclusion now gives its real reason: packing there is not qualified, not that its barrier differs. - An unparsable HK_PACK_ATOMICS keeps G16G's default (on), as before #488. - hk_pack_admits_strong_tail() says whether a member may end with a strong flush without memory scope, as an application barrier at the end of a command buffer leaves it: at the HAL200 boundary, which upgrades it in place, and not at the visible-completion boundary (M5), whose members must end with the memory-scoped flush. The packing trace reports it as strong_tails=, and a test pins it to what hk_pack_run_member() takes on G17S and G16G. - aurora-packtest's must-pack check follows it: cases whose command buffers end with a dispatch (multi-tail, disjoint) must pack wherever packing is on; those ending with a barrier (chain242, chain300, loops, chain-all, multi) only where the trace reports strong_tails=1. With no trace available, only must-pack cases fail. - hk_pack_test: an exact-prior queue whose earlier submission forgot a render splits as the resolver resolves it (last_absolute, not ever; from the fourth review), and G17A has no boundary. Signed-off-by: Diljit Singh <hey@djdev.me>
Independent review of
|
| Mutation | Failing check |
|---|---|
Restore "HAL200 && no memory-scope form" in hk_pack_boundary() |
G17A: HAL200 but not G16, no boundary |
hk_sync_queue_kinds() returns ever in exact mode as well |
exact: a render forgotten in an earlier submission splits |
hk_pack_admits_strong_tail() returns boundary != NONE |
M5: no strong-flush tail, and the trace says so |
hk_pack_admits_strong_tail() returns false |
G16G: a strong-flush tail, and the trace says so |
G16 member check accepts only weak_barrier_end |
G16G: a strong-flush tail, … |
M5 member check relaxed as in #506 (strong_flush_end == end only) |
M5: no strong-flush tail, … |
So the exact-vs-legacy test (finding 5) does tell the two lookups apart, and no pre-existing check does: in the second mutation it is the only failure.
The aurora-packtest must-pack logic was checked with a harness that calls trace_line() and must_pack() directly:
strong_tails=0makeschain242not must-pack and leavesdisjointmust-pack;=1makes both must-pack;- with no line seen yet, the value is
-1, which counts as must-pack (the old behaviour); - after a render,
chain-allis not must-pack.
The case lists are classified correctly: multi-tail and disjoint end with an OP_MIX, and the other five end with OP_BARC/OP_BAR. With no trace available, only must-pack cases FAIL.
The G16G rationale now matches linux#2419 as written there: "compute commands queue behind the same VM's in-flight compute on the one firmware compute queue", and "only the same VM queues".
Findings (most severe first, all low)
L1. hk_pack_admits_strong_tail() mirrors hk_pack_run_member() instead of being used by it. hk_pack.c:56, hk_pack.c:101
- Scenario. The PR says hk: pack M5 command buffers that end in a barrier without memory scope #506 "should flip this one function", but hk: pack M5 command buffers that end in a barrier without memory scope #506 edits the visible-completion branch of
hk_pack_run_member()and leaves this function alone. Rebased onto this PR, hk: pack M5 command buffers that end in a barrier without memory scope #506 fails the M5 check attest-hk-pack.c:506, which is what we want. But if the check is then "fixed" on therun_memberside only, the trace keeps printingstrong_tails=0while M5 packs barrier-ended chains.aurora-packtestthen silently stops requiringchain242/chain300/loops/chain-all/multion M5. - Fix. Make the predicate the single source of truth inside the member check, for example in the visible-completion branch:
if (cs->strong_flush_end != end || (!hk_pack_admits_strong_tail(boundary) && (!cs->visible_completion || cs->memory_flush_end != end))) return NULL;. hk: pack M5 command buffers that end in a barrier without memory scope #506 then really flips one function. At minimum, tell hk: pack M5 command buffers that end in a barrier without memory scope #506 that it must flip this function and invert this check.
L2. With a driver older than this commit, aurora-packtest still fails barrier-ended cases on M5. tests/aurora_packtest.c:812, :841, :969
- Scenario. This head's packtest runs against an M5 driver without the
strong_tails=field. The value stays-1, which counts as must-pack, sochain242etc. FAIL as before. The value is also sticky: a line without the field keeps the previous value. - Fix. None needed: falling back to must-pack is the right default. Say in the comment (or the PR text) that the relaxation needs a driver that has this commit, so an M5 row on an older driver isn't misread.
L3. The HK_PACK_ATOMICS nit has no test. hk_queue.c:2460
- Scenario.
hk_pack_atomics_allowed()is static inhk_queue.c, which no unit test links, so thefalse→truedefault isn't pinned. I verified it by readingdebug_parse_bool_option(). - Fix. Optional: move the env-to-bool decision into a small pure helper in
hk_pack.cand add a two-line check.
L4. Wording in the G16G atomics rationale. hk_queue.c:2445-2446
- "none runs beside a packet out of order" mixes overlap with order. The property atomics need is that the firmware runs the queued commands one after another and never beside another queue's.
- Fix. "…several commands of one VM may be in flight there, but the firmware runs them one after another, never beside a packet."
Nits
hk_pack.c:204(108 columns) andhk_queue.c:2383(83 columns): the comment rewrites weren't reflowed.hk_device.h:452still says "The other HAL200 parts (G16) have only the plain strong flush". With the new G17A note inhk_pack.c, it should leave G17A out or say its caches are unknown.
Independent review. Scope: the diff, plus local build and tests on the host. Not run on hardware.
🤖 Generated with Claude Code
From the review of #558: - hk_pack_run_member() now asks hk_pack_admits_strong_tail() whether a member may end with a strong flush without memory scope, instead of restating the rule. The packing trace reports the same answer, so a change to one (mesa#506 admitting such tails on M5) changes both, and aurora-packtest's must-pack check follows it. - hk_pack_atomics_choice() is the HK_PACK_ATOMICS decision, now a pure helper with a test: on by default on G16G and opt-in elsewhere with one kernel queue; an unparsable value keeps the default. - aurora-packtest says that only a driver with the strong_tails= field relaxes the barrier-ended must-pack cases; with an older one on M5 without #506 they FAIL as before. - Comments: the G16G atomics rationale says the firmware runs a VM's compute commands one after another, never beside a packet; G17A's caches are not known (hk_device.h); two paragraphs reflowed. Signed-off-by: Diljit Singh <hey@djdev.me>
|
Thanks. All fixed in one commit on top, new head bc0f0dc:
Local checks at this head (host aarch64, clang 23.1.1, release,
|
Follow-ups to #488 (merged as 11ee623) from its third and fourth independent reviews (comments 7025084567 and 7025630906) and the M5 lane's re-review. One commit, no change in what packs on G16G or G17S today.
Changes
hk_cdm_memory_scope_form()doesn't list it. It sits between G17P and M5, which both have tagged caches and a memory-scoped flush form, so it gets no boundary until its caches are known. No current kernel admits G17A.HK_PACK_ATOMICSon G16G (nit). An unparsable value keeps the default (on), as before hk: pack runs of plain compute command buffers into one command #488.hk_pack_admits_strong_tail()says whether a member may end with a strong flush without memory scope, as an application barrier at the end of a command buffer leaves it.strong_tails=, and a test pins it to whathk_pack_run_member()accepts on G17S and on G16G.multi-tail,disjoint) must pack wherever packing is on.chain242,chain300,loops,chain-all,multi) must pack only where the trace reportsstrong_tails=1, so M5 rows without hk: pack M5 command buffers that end in a barrier without memory scope #506 no longer FAIL them by design.hk_pack_test: exact-prior queue history (finding 5). This is the reviewer's test: a render forgotten in an earlier submission on an exact-prior queue splits, as the resolver resolves it (last_absolute, notever). A G17A row is also added.Checks
-j2, 2 GiB cap:libvulkan_asahi.soandaurora-packtestbuild;meson test --suite asahi: 139 Ok, 0 Fail;hk_pack_test: 142 checks, 0 failures; random harness 3180 packets, history harness 4872 packets, 0 failures;strong_tails=1. This head's aurora-packtest (the boundary-aware must-pack) hasn't run on hardware yet. It runs in the next M4 slot, and an M5 row with and without hk: pack M5 command buffers that end in a barrier without memory scope #506 would check thestrong_tails=0path.Not in this PR
hk_cdm_alias_scope()false on G16G) get their own PR once the fix candidate's full CTS has run on the M4. That PR also adds thealias-*aurora-packtest cases.🤖 Generated with Claude Code