Skip to content

Update Aurora Edge to aurora-wip 45963937 for the next Neo Edge Mesa - #566

Merged
DjDeveloperr merged 327 commits into
aurora-edgefrom
djdev/edge-neo-mesa-20261120
Nov 21, 2026
Merged

DjDeveloperr merged 327 commits into
aurora-edgefrom
djdev/edge-neo-mesa-20261120

Conversation

@DjDeveloperr

Copy link
Copy Markdown

Bring aurora-edge to aurora-wip 45963937 for the next Neo Edge Mesa, keeping #447.

This head merges aurora-edge (a755cbc) into aurora-wip 4596393. Its tree is aurora-wip 4596393 plus one line: #447's ralloc_free(gs_copy).

What happens to aurora-edge's 8 commits:

What aurora-wip adds since the Edge freeze includes:

This repository's Actions have been off since 10-24, so CI follows the outage rule: local agent-policy, a local build and the asahi tests, then the Neo gate on the exact Fedora 44 RPM pair. The Neo gate is the full Vulkan CTS and GL/GLES CTS against the shipped Mesa d4ad4a4 baseline, a deep-sleep soak, and smoke tests. Results will be posted here before merge.

🤖 Generated with Claude Code

jgoyvaerts and others added 30 commits November 19, 2026 06:34
vectorize_sorted_entries() pairs each entry with every later one in the
sorted array and skips those too far away to combine. The entries are
sorted by offset and a combined entry keeps the lower offset, so once one
entry is out of reach every later one is too: stop there instead of
scanning the rest. The result is the same, and a bucket of n loads at
distinct offsets costs O(n * k) for the k entries within reach instead of
O(n^2).

The CTS shaders of VK_KHR_shader_constant_data read up to 262128
constants in straight-line code, one load each. Compiled for G17P under
the no-op DRM shim, on aurora-wip with that extension enabled for the
measurement (upstream 00e37b6), dEQP-VK.spirv_assembly.constant_data.
basic.width_N_count_M_comp take 1.1 -> 0.5 s (32766 x 8 bytes), 2.5 ->
1.2 s (65532 x 4), 8.5 -> 3.0 s (131064 x 2) and 28.1 -> 5.8 s (262128 x
1). The fragment variants spend most of their time elsewhere
(nir_opt_if under nir_opt_varyings_bulk), which this does not change.

Same output: 6961 shaders from a dEQP-VK sample and llama.cpp's 351
MUL_MAT shaders compile to identical statistics. nir_tests vectorize
112/112.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
Assisted-by: LLM
…yout

A compute shader that uses set 0 with a pipeline layout of zero sets
killed the process in vkCreateComputePipelines. Descriptor lowering read
the missing set layout through a NULL pointer; only an assert guarded it.

Vulkan makes this layout invalid usage, but a driver must not crash on it.
hk_compile_shaders now checks every resource index and image, sampler and
texture variable against the layout first. A missing set or binding
returns VK_ERROR_UNKNOWN and frees the NIR it consumed.

Fixes #236.

(cherry picked from commit 71f363b)
With HK_FRAME_ANATOMY_TS=all (the default) each cross-engine step of a
sampled submit waits on the host, so the gaps the tool shows between
render and compute work are largely its own. On an M4 Max (G17P) a
multi-pass test went from 0.53 to 3.41 ms per frame with it, and a game
showed ~600 us gaps between engines that are not there without it. The
header only described this for the M5. Start stamps are also taken
before a command's barriers resolve, and sampling every submit costs
~23 % fps by itself.

Say so in the header, next to the HK_FRAME_ANATOMY_TS description, and
print a one-line note in the log header when ts=all is active, pointing
at the existing low-perturbation modes (edges, none). No behaviour
change.

Measurements by AxxzyWasTaken (#453).

Fixes: #453
Assisted-by: Claude Opus 5.5

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
maxMeshMultiviewViewCount was held at 16 on G17P even though a multiview
mesh draw is replayed once per view by hk_foreach_view, which walks every
bit of the 32-bit view mask, and the mesh shader writes the view index to
the layer of each primitive it may output. Nothing in that path is limited
to 16 views; maxMultiviewViewCount already reports
HK_MAX_MULTIVIEW_VIEW_COUNT (32) for every other stage.

The lower value only existed to keep
dEQP-VK.mesh_shader.ext.properties.max_view_index passing: the test builds
its subpass view mask as (1u << count) - 1u, which is undefined for 32
views, and on AArch64 yields 0, so only layer 0 is drawn. That is a CTS
bug, still present in VK-GL-CTS main, and is not a reason to under-report
the limit. Report HK_MAX_MULTIVIEW_VIEW_COUNT and document the CTS
failure next to the limit.

This changes the reported limit on G17P only (multiviewMeshShader is not
exposed elsewhere). Built for x86 with the asahi unit tests.

Builds on c676eb2 by Diljit Singh.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The G17P ray query program image is generated at device creation
(hk_gen1_rq_init_generated()). Alongside it the driver still carried
the bring-up paths that replaced or inspected that image, each behind
an environment variable:

- ASAHI_G17P_RQ_CAPTURE_DIR read a complete program image, its code
  map, user image, uniforms and intersection table from files and ran
  it instead of the generated one.
- ASAHI_G17P_RQ_BODIES_PATH read per-slot program bodies and constants
  from a file container over the generated slots, and
  ASAHI_G17P_RQ_MINIMAL_FROM_BLOB copied selected slots from that
  container over the generated stubs.
- ASAHI_G17P_RQ_IMAGE_DUMP wrote the image to a file.
- ASAHI_G17P_RQ_MINIMAL_TRAP made each stub body store a marker, read
  back and printed at device destruction (with ASAHI_G17P_RQ_TRAP_LOG
  appending it to a file); ASAHI_G17P_AABB_REACH_DIAGNOSTIC printed
  words at a fixed offset of the image.
- ASAHI_G17P_AS_PHASE_ADDRESS made the common builder emit build phase
  markers and wrote them to a raw GPU address taken from the
  environment.
- ASAHI_G17P_CAPTURE_STRESS_INPUT wrote the vertex input of one
  specific build to files and skipped the build.

None of them is set by default, so the default path is unchanged:
the image is always the generated one, phase markers stay off, and
builds always run. Remove the variables, the loaders, the unused
hk_gen1_rq_substitute_generated() and the trap form of
agx3_rt_gen1_stub_body_generate(), which only the trap variable used.

Tested with the asahi unit tests (meson test --suite asahi) on an x86
build; test-hk-rt-on-demand no longer unsets the removed variables.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
asahi: G17P GL: predicate texel fetches only in robust contexts
… constants

Four driver tunables were read from the environment with a default that
is the measured value. Make each a named constant whose comment carries
the measurement it comes from, and drop the environment overrides:

- HK_G18_BATCH -> HK_G18_BATCH_LAUNCHES (64), the G18G launches per CDM
  stream. 07a390b by Joshua Warren measured decode throughput on one
  G18G with llama-bench (7B Q4_0) at batch 8 to 256; 64 is where it stops
  rising. The old MIN2(..., 1400) clamp only guarded an oversized user
  value and becomes a static_assert on the constant.
- ASAHI_G17P_SIBLING_QUEUES, ASAHI_G17P_SIBLING_MIN_IN_FLIGHT and
  ASAHI_G17P_SIBLING_MIN_THREADS -> HK_G17P_SIBLING_QUEUES_M4_PRO (3),
  HK_G17P_SIBLING_MIN_IN_FLIGHT (2) and HK_G17P_SIBLING_MIN_THREADS
  (65536), from the J616s gpubench runs of f22f090 and the queue
  count of d33c6d3 by Diljit Singh. The two gates no longer need
  per-queue fields, and the zero-depth early return in hk_sibling_deep
  is gone with the knob that could set it.
- ASAHI_M5_RENDER_PRIMS: plain-draw renders now always use the existing
  AGX_G17G_RENDER_PRIMS_PLAIN (512K), whose comment now cites the M5 Pro
  measurement of 6cdff78 by Jens Axboe.

Default behaviour is unchanged on every chip: each constant equals the
default the knob had. Built for x86 with the asahi unit tests.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
asahi: ASAHI_MESA_DEBUG=stats: time every command and name each render pass
asahi: do not flush a render batch for a disjoint buffer-range write
asahi: draw colourless passes sharing a batch's depth inside that batch
ASAHI_G17P_RQ_LIVE_AS_TABLE (off by default) switched G17P ray queries
from the device's sparse AS table to a per-command-buffer copy: a
device-wide query bank mirrored the first table slots, and every
hk_gen1_upload_as_table() call took a row of a chunk that aliased the
bank with a private writable tail, recycled through command-pool and
device caches. In that mode AS creation also refused the IDs above the
mirrored slots. Its own test called it the diagnostic live-table mode.

Without the variable the device never created the bank or the chunk
caches and hk_gen1_upload_as_table() returned the sparse table, which is
the only path left. Remove the variable, the bank, the chunk allocator
and caches in hk_cmd_pool.c, their command buffer, pool and device
fields, and the live-mode case of test-hk-as-registry.

Default behaviour does not change on any chip.

Tested with the asahi unit tests (meson test --suite asahi) on an x86
build.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
asahi: emit clean G17P multi-draw sub-draws without re-validating state
…iews

asahi: count only views the draw's shaders read as feedback loops
The M5 (G17G/G17S/G17C) acceleration structure builder and trace rays
path still read a set of bring-up switches from the environment:

- ASAHI_M5_AS_PHASE_DIAG and ASAHI_M5_AS_PHASE_ADDRESS made builds emit
  phase markers and write them, with extra flushes, to a raw GPU
  address taken from the environment.
- ASAHI_M5_AS_BATCH_ENCODE_PROBE enabled an alternative encoder that
  batched the node encoding of independent builds through a GPU-built
  job map (the hk_agx3_batch_{plan,leaf,envelope} programs and their
  HK_AGX3_BATCH shader variants); ASAHI_M5_AS_BATCH_DIAG printed its
  batch sizes.
- ASAHI_M5_BATCH_LEAVES (default on) could switch leaf generation back
  from the batched leaf launch to the common per-geometry one.
- ASAHI_M5_RT_SINGLE_KICK (default on) could switch multi-kernel trace
  rays back from the single templated launch to K indirect dispatches.
- ASAHI_M5_LAUNCH_DEBUG printed refused builds and single-kick launches
  in these files.

Keep what the defaults did: no markers, the scalar per-state encoder,
the batched leaf launch, and the single kick on M5. The K-dispatch
selection stays as the path of the other chips and the fallback when a
kernel cannot be templated, as before. Remove the switches, the batch
encoder with its programs, shader variants and interface structures,
and the per-geometry M5 build ops; hk_m5_agx3_node_encoder_spirv() loses
its batch argument.

Default behaviour does not change on any chip; the non-batch M5 programs
compile to the same SPIR-V.

Tested with the asahi unit tests (meson test --suite asahi) on an x86
build; test-hk-agx3-as-format no longer checks the removed batch
encoder.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
ASAHI_M5_AABB_RECORD_STRIDE (default 48) selected the stride of M5
bounding-box leaf records: 48 bytes packed (record class 4), or 64
bytes, one per slot (class 5). The host passed the choice to the planner
in hk_agx3_plan_args::plan_restored and to the node encoder in
hk_agx3_leaf_args::slot_bias, and both programs switched on it.

The stride is a property of the record format, not a tunable. Define
HK_AGX3_M5_AABB_RECORD_B in bvh/hk_build_interface.h, next to the
documented record layout, so the planner and the encoder use it
directly; describe the same layout as struct hk_agx3_m5_aabb_record on
the host and static_assert its field offsets and size against the
constant. The host no longer passes a stride, so plan_restored and
slot_bias are unused on M5 again.

The 48-byte record was the default and is what remains; default
behaviour does not change. This only reaches the M5 chips.

Tested with the asahi unit tests (meson test --suite asahi) on an x86
build.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
These switches, all off by default, served bring-up of features that
are finished. Each makes the compiler emit code that is wrong for the
application (probe values in place of outputs, capture stores to a fixed
address, a different coefficient source, a missing lowering) or prints
refusal details through a separate ad-hoc variable. Remove them with
their code:

- ASAHI_G17P_EMPTY_FS_PIXEL_DIAGNOSTIC: pixel entry and release in an
  empty G17P fragment shader.
- ASAHI_M5_TILE_DATA_COPY_PROBE: copies of M5 multisample tile data
  before ST_TILE.
- ASAHI_MESH_PP_AUDIT, ASAHI_MESH_MARKER_VA and ASAHI_MESH_PP_AUDIT_FAN:
  capture stores of the mesh per-primitive records.
- ASAHI_MESH_PP_PROBE: storage addresses in place of the VAR0 output.
- ASAHI_MESH_NATIVE_PAGE_CARRIER: a one-word page carrier for the
  per-primitive storage address; the default two-word carrier is now
  the PAGE_CARRIER_WORDS constant.
- ASAHI_MESH_CONTRACT_DEBUG: refusal prints in the Gen1 mesh lowering.
- ASAHI_MESH_PP_VIT_SOURCE: override of the PrimitiveID coefficient
  source.
- ASAHI_G17P_CAPTURE_SCS_INDEX: capture store of the SCS thread index in
  ray-query kernels.
- ASAHI_G17P_RQ_LOWERING_DIAGNOSTIC: refusal print of the Gen1 ray-query
  lowering.
- ASAHI_G17P_COMPUTE_HW_DERIVATIVE_DIAGNOSTIC: skipping the compute
  derivative lowering.
- ASAHI_G17P_ZERO_COLOUR_RELEASE_DIAGNOSTIC: a zero colour release mask
  for G17P background and end-of-tile programs.

With no variable set the generated code is unchanged; every removed
branch was off by default. The precompiled libagx output is
byte-identical.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
NativeForms.M5NativeTriangleMeshProbeCompiles printed the compiled
size and wrote native-triangle-mesh.bin into the working directory on
every run. Nothing reads that file; the copy at the repository root was
committed by accident in 6d7c719 after a test run from the tree. The
dump came in with 7c91ddd (DjDeveloperr). Keep the compile and
shared-size assertions, drop the printf/fopen and the stray binary.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
AGX3PackBinary.DISABLED_FcmpselShapeSurvey was a one-off diagnostic
that enumerated fcmpsel operand shapes and printed which ones the packer
refused. It asserts nothing and gtest never runs it (DISABLED_ prefix,
no --gtest_also_run_disabled_tests anywhere). Added by 44236b2
(Acelogic); the fcmpsel forms it surveyed are covered by the real
F32TiedMaximum*/fcmpsel tests next to it.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…hed probes

Several driver paths could be switched by an environment variable. Some
switched off a behaviour that is on by default and was kept only for
comparison; the others enabled probes or diagnostics that never became
the default. Remove the switches and keep exactly the default code path.

Defaults kept, switch removed:
- ASAHI_M5_PRUNE_DEPTH_COLOR (262b6af): M5 depth-only pipelines
  always prune unused fragment colours, as G17P does.
- AGX_G17P_SAMPLE_KILL_TEST_ONCE, AGX_M5_SAMPLE_KILL_TEST_ONCE,
  AGX_G17P_SAMPLE_KILL_ONE_UPDATE, AGX_M5_SAMPLE_KILL_ONE_UPDATE, in hk
  and Gallium: sample-shaded fragments always test coverage once and put
  their kills into that one update. The G17P MSAA epilog unit test loses
  its negative-control branch on the same variable.
- HK_G13_STAGE_OVERLAP (55271cf): G13/G14 queues always use fragment
  barriers when the kernel offers them.
- AGX_FS_CPROG (9ce0f71 by AxxzyWasTaken): G17P GL fragments always
  try the native constant program.
- ASAHI_M5_MRT_SPLIT (7bcd742 by Jens Axboe), ASAHI_M5_CPU_MIPMAP
  (99b3e2a by Jens Axboe): M5 always draws MRT in one pass and
  generates 2D mipmaps on the GPU where the framebuffer allows it.

Opt-in paths deleted:
- ASAHI_G17P_GRAPHICS_RQ_KEEP_LOOPS_DIAGNOSTIC and
  ASAHI_G17P_GRAPHICS_RQ_CPROG_DIAGNOSTIC, ray query diagnostics of
  fce5f94 and d37d708, with hk_keep_ray_query_loops.
- ASAHI_M5_BOUNDED_VEC_PROBE, ASAHI_M5_BOUNDS_FACTOR_PROBE and
  ASAHI_M5_PREDICATED_LOAD_PROBE from 7c91ddd: the bounded-load
  vectorizer (which printed its groups to stderr), the two alternative
  bounds checks in check_in_bounds and the predicated-load lowering.
- ASAHI_M5_SWTNL_TESS: it forced M5 tessellation onto the CPU path, which
  2a15055 already takes whenever the draw module can tessellate.
  ASAHI_M5_GPU_TESS is unchanged.
- AGX_SWTNL_NO_LLVM: the draw module's own DRAW_USE_LLVM=false selects
  its interpreter; agx_swtnl_can_tessellate() follows that setting.
- AGX_SWTNL_DUMP (NIR printing) and AGX_NO_SWTNL (turned the M5 CPU
  geometry path off, so those draws were dropped).

ASAHI_M5_RQ_KEEP_LOOPS stays: 9a99be3 measured a large code size
and compile time win and no regressions, but kept it opt-in until a
complete hardware run.

No default behaviour changes on any chip. Built for x86 with the asahi
unit tests; the precompiled libagx output is identical.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
agx3_m5_instructions returns a distinct exit code per failed check, and
the half-precision fcmp_reg16 check used 77. Meson's exitcode protocol
treats 77 as "skipped", so a wrong encoding there showed up as SKIP
instead of FAIL. Use 75, which no other check in main() returns. The
code numbering came with 7c91ddd (DjDeveloperr).

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
_instr_length() tests an instruction against every form of its table in
order until one matches: 404 forms for agx3c, 571 for agx3d. The G18G
transcoder segments every program with it and the re-encoding cache keys
every per-draw program with it, so on the M6 agx3c_instr_length was about
half of Chromium's GPU-process time while dragging Google Maps.

gen-disasm.py now indexes each table by the 10 bits of an instruction's
first 64 that the most forms fix. A bucket lists, in table order, the
forms whose fixed bits agree with it; a form whose shortest length does not
reach a bit does not fix it. The first match within the bucket is therefore
the first match in the whole table. agx3c averages 6 candidates per bucket
instead of 404. The per-form test is unchanged (now _spec_length(), shared
with the linear reference _instr_length_linear()).

test-instr-length-index compares the indexed lookup with the linear scan,
length and form, for all four encodings on 200000 random codes at every
available length and at every byte offset of the native witness texts:
1175712 lookups, 637251 of them matching a form, no difference (also under
ASan/UBSan). On a G17G text the lookup takes 20 ns instead of 176 ns per
instruction (x86-64 host).

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
These standalone programs are not in any meson.build, no test() or
runner script references them, and nothing else in the tree names them;
each is only built by hand from the cc line in its own header/README,
so no build has compiled or run them since they landed:

- zink/tests/{partial-clear-readback,partial-clear-write}.c (7b893e7,
  d351e9f), blit-after-invalidate.c (ac1e65a),
  depth-sample-after-pass-start.c (548b58d), ssbo-block-limit.c
  (8574e4f), all Ryan Murray: X11/EGL GL repros.
- asahi/tests/g18-reload.{c,md} (676053a, Acelogic): G18 reload/resolve
  GL probe.
- vulkan/tests/g17g_zink_draw.c + README.g17g-zink.md (44236b2,
  Acelogic): M5 Zink triangle probe.
- vulkan/tests/agx2-transfer-record.c (b57868b, Ryan Murray): offline
  drm-shim transfer recorder built against hk internals by hand.

They stay in history for anyone who wants to rebuild one.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
On G17P, binding memory to a buffer that holds acceleration structures
publishes their addresses into the device's acceleration structure table,
assigning each a traversal base below it. When no base could be assigned,
hk_gen1_publish_buffer_as_addresses() logged an error and carried on, and
vkBindBufferMemory2 returned VK_SUCCESS. The table entry of that structure
was left describing its previous (unbound) state, so a later ray traversal
of it reads a stale entry instead of the structure.

Return whether every structure was published, and fail the bind with
VK_ERROR_OUT_OF_DEVICE_MEMORY (also reported through
VkBindMemoryStatusKHR) otherwise. This matches
vkCreateAccelerationStructureKHR, which already fails with the same error
when it cannot assign a base.

Only the failure path changes; a successful bind behaves as before.
Built for x86 with the asahi unit tests.

Builds on a476825 by Ryan Murray.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
With HK_G17P_LAUNCH_TRACE set, graphics recording printed the
descriptor bytes, texture state and sampler element of combined
samplers, the indexed heap pointers, every graphics stage's uniform
ranges, the M5 end-of-tile resources and the HAL300 background and
end-of-tile programs to stderr. These dumps served the G17P and M5
graphics launch bring-up; agxdecode (ASAHI_MESA_DEBUG=trace) decodes
the submitted command streams instead.

Remove the graphics dumps and hk_g17p_trace_line(), which only they
used. The compute launch dump in hk_cmd_dispatch.c still uses the
switch and the hexdump helper, so those stay for now.

Off by default; default behaviour does not change.

Tested with the asahi unit tests (meson test --suite asahi) on an x86
build.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The variable printed the layout and the packed sampled, read-only
storage and PBE descriptors of 3D views deeper than 2048 slices on
native graphics chips. It served one finished investigation of deep 3D
views; remove it.

Off by default; default behaviour does not change.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The 24 agx3_unpack_* decoders in agx3_pack.c have no caller anywhere in
the tree (compiler, hk, gallium, tests); only their prototypes in
agx3_pack.h reference them. The packers they mirror stay. The header
comments now say "Encode" instead of "Encode/decode".

Added by 96030f3 (DjDeveloperr) and never called since.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
ASAHI_G17P_R32_3D_ADDRESS_DIAGNOSTIC replaced, on descriptor generation
9, the lowering of R32_SINT 3D storage image loads and stores with
bounds-checked global memory accesses through the texel address, and
image-to-buffer copies of 1x1xN R32_SINT 3D images with a raw
per-slice copy shader. It was an A/B probe for 3D image addressing,
not a fix, and it made lower_descriptors drop the control flow metadata
whenever it was set.

Remove the switch, the alternative lowering and the copy shader. With
the switch unset neither path was taken, so default behaviour and the
generated shaders do not change.

Tested with the asahi unit tests (meson test --suite asahi) on an x86
build.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The variable printed one line per vkCreateDevice stage that failed (and
on entry and success) to stderr, and turned on the instance's Vulkan
debug logging. The failing paths already report through vk_error and
vk_errorf with a message, which is what the common logging shows.

Remove the variable, hk_device_init_diag() and the HK_INIT_FAIL()
wrapper, so device creation unwinds with plain gotos again.

Off by default; default behaviour does not change.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The G18G (M6) port shipped its qualification and bring-up switches in
the Gallium driver and in the shared asahi library. None of them is on
by default and none belongs in a driver that clients load:

- G18_STOP_ON_SUBMIT_ERROR made agx_retire_failed_submit() call
  _Exit(86) and so killed the client process on a recovered submit
  error. The failure path now always retires the batch as it does on
  every other chip.

- G18_TRACE_SPLIT dumped every split compute submission (CDM bytes,
  indirect grids, tessellation producer buffers) to stderr and ended
  the process with _Exit(86)/_Exit(87) on a failed or oversized split.
  It is removed with its helpers. agx_trace_data_bo() stays, since the
  empty indirect check uses it, as do the trace_mode/trace_indirect
  fields of agx_cdm_dispatch; the fields that only fed the tracer go,
  and agx_record_cdm_dispatch() loses the arguments that filled them.
  AGX_DBG_TRACE already decodes the submitted command buffers.

- ASAHI_G18_RESOURCE_TRACE printed hex dumps of texture descriptors,
  attachments, compute payloads, launches and linked shaders. It is
  removed from the environment flag table. The linked shader dump is
  kept on the existing path instead: the AGX_DBG_SHADERS hex dump in
  agx_fast_link() now covers G18G as it already covered G17P and M5.

- AGX_G18_MSAA4_EMPTY_BG and AGX_G18_MSAA4_EMPTY_EOT replaced the 4x
  background or end-of-tile program with an empty one. They rendered
  a wrong image by design.

- AGX_G18_EMPTY_CDM sent compute dispatches without their launch
  record (readback wrong by design), and AGX_G18_CODE_PAD_END filled
  unused code bytes with agx3d end instead of zero. Both are removed,
  along with the once-per-process G18_COMPUTE_KNOBS line on stderr that
  reported them.

- AGX_G18_COMPUTE_LEGACY_CONTAINER put G18G compute programs back in
  the G17P code container for A/B runs. G18G now always uses its own
  container; other chips keep the G17P one as before.

- AGX_G18_LAYERED_D16 (default on) could narrow the admitted layered
  D16 shapes back to the first capture's set. The shapes stay admitted.

- G18_PPP_PREFIX was an unfinished experiment that inserted two extra
  PPP state groups before the initial state records. Its own comment
  left open whether it had any effect. It is removed.

The manual g18-reload test notes no longer set G18_STOP_ON_SUBMIT_ERROR.

Default behaviour is unchanged on every chip: every removed switch was
off by default, AGX_G18_LAYERED_D16 was on and its path is kept, and
the only code that ran without a switch was the G18_COMPUTE_KNOBS
stderr line. Nothing here reaches shader compilation. Built for x86
with the asahi Gallium and Vulkan drivers; the asahi unit tests pass
and the precompiled libagx output is byte-identical to the base.

Builds on 44236b2 by Acelogic.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
RyanTheTide and others added 21 commits November 20, 2026 09:39
asahi: look up and build background/end-of-tile shaders under the cache lock
hk_sync_src_dep() records a barrier's source kinds against both
subqueues, so a COMPUTE -> COMPUTE barrier after a dispatch also names
COMPUTE work on the render subqueue. The resolver turns that into a wait
only once the render subqueue ran COMPUTE-kind work (resolve_prior()), but
the planner took it for an added render wait and split: command buffers
recorded as {dispatch, barrier}, the pattern packing was measured on
(242 such command buffers, 3.0 -> 0.31 ms), formed no packets.

The planner now masks a member's render waits and tail with the kinds the
render subqueue ran before it: the queue's earlier submissions
(hk_sync_queue::ever) and the render streams of the command buffers before
it in the submission. The kind rule applies only once render work ran:
before that no carried requirement can resolve to a render wait.

The planner also keeps the tail per kind, as hk_pack_fold_member() folds
it: a packet waits for a member's tail only for the kinds the packet has,
so a GFX -> GFX barrier after a dispatch no longer splits. Neither change
alters which waits are kept, only how much is packed.

Also: no compute-kick note after a submission that failed untouched, and
the comments say the static work bound limits a packet at ALU rate.

Signed-off-by: Diljit Singh <hey@djdev.me>
- The planner packs a {dispatch, COMPUTE -> COMPUTE barrier} chain into
  one packet on G16G and on G17S (M5), also after a render or on a queue
  that rendered; COMPUTE work on the render subqueue makes that barrier a
  render wait again. A render tail splits a packet only for kinds the
  packet has.
- The dependency checks build their packets through the planner, and run
  with both the legacy and the exact-prior resolver (the G16 kernel takes
  exact priors), including a later submission that waits through the
  queue's persisted tail.
- The two folds the planner's rules make redundant are pinned on packets
  built directly.
- 2000 random submissions per resolver mode are resolved packed and
  unpacked: no wait may be dropped, and no packet may wait for more render
  work than its first member (from the second review of #488).

aurora-packtest reads back the driver's packing trace and reports the
command buffers packed per case. With HK_PACK_CDM_SUBMIT=1 a case that
must pack fails when nothing was packed, and with =0 any packing fails.

Signed-off-by: Diljit Singh <hey@djdev.me>
Packing was on by chip: G17S and G16G, other M5 parts opting in.
hk_pack_boundary() now decides it from how a member's end publishes its
writes to the members after it:

- M5 streams, where the kernel takes their own completion flush
  (DRM_ASAHI_FEATURE_COMPUTE_VISIBLE_COMPLETION): every stream then ends
  with the strong memory-scoped flush a boundary keeps. G17G and G17C
  pack as G17S does.
- HAL200 streams whose strong flush has no memory-scoped form (G16): the
  kernel publishes a command's writes when it completes, and a boundary
  becomes the strong flush an in-stream compute dependency gets. G17P
  stays out: its strong flush also has a memory-scoped form, which
  memory reached through a second address needs and which no such
  boundary asks for (hk_cdm_memory_scope_form(), now shared with
  hk_cdm_flush_has_memory_scope()). G15 and AGX2 streams have no
  boundary.

Packing is on wherever a boundary is defined; HK_PACK_CDM_SUBMIT stays
for A/B rows. The member check and the copy take the boundary from the
same function. Global atomics stay packed only on G16G: the G16
kernel's whole-device ordering is not reported by any uAPI feature yet.

The planner's render kinds now come from the fields the resolver reads,
through hk_sync_queue_kinds() (hk_sync_queue::ever, or last_absolute on
exact-prior queues) and hk_sync_cmd_kinds() (cmd->sync.last). Reading
stream kinds disagreed after hk_sync_forget_stream() left a latest render
of a kind on a render of another kind. hk_pack_describe_submit() is the
one describe loop for hk_pack_runs() and the tests.

The planner and the fold now apply a member's tail to each destination
class of the packet's stream (hk_sync_full_kinds()), as the resolver
applies carried requirements: a fragment-class tail of a member of
every kind was neither checked nor folded.

Signed-off-by: Diljit Singh <hey@djdev.me>
- hk_pack_boundary(): G17G, G17S and G17C pack with visible completion
  and not without; G16G and G16S take the HAL200 boundary; G17P, G15S
  and G14G have none. A G17S stream is a member only with the feature.
- The tests plan through hk_pack_describe_submit(), the loop
  hk_pack_runs() runs.
- A render forgotten after a transfer render leaves a graphics render
  wait that the planner now sees, as the resolver does (legacy and
  exact).
- A fragment-class tail of a member of every kind splits the plan and
  is folded.
- The random harness also draws members of every kind (HK_SYNC_ALL), and
  a history harness (from the third review of #488) runs 1-2 earlier
  submissions with graphics, transfer and compute renders before
  planning a submission against the queue's state, in legacy and exact
  mode, comparing it packed and unpacked.

aurora-packtest passes the driver's stderr through as it is written,
through a pipe and a thread that counts packed command buffers, so a
case that dies keeps its driver messages. It forces HK_PACK_CDM_TRACE=1,
fails a must-pack check when no trace is available, and checks chain-all
(an ALL -> ALL barrier in each command buffer) as must-pack only before
the queue ran a render.

Signed-off-by: Diljit Singh <hey@djdev.me>
Submit packing took only command buffers whose stream ended with the
strong memory-scoped flush (visible_completion). Where memory has no
second GPU address (hk_cdm_alias_scope() false: devices without sparse,
external or imported memory, which is most applications and dEQP
devices without those features), an application barrier recorded at the
end of a command buffer leaves a strong flush without memory scope, so
dependent chains of one-dispatch command buffers were never packed: on
the M5 Pro only packtest's barrier-free cases packed, its chains did not.

Accept any member that ends with a strong flush. Between members that
flush is the dependency the application recorded; at the packet's end
the existing visibility flush strengthens the record in place to the
memory-scoped one, so the packet still completes visibly for the host
and other queues. The visible-completion boundary exists only where the
kernel accepts such a command (hk_pack_boundary()).

Only the member check for that boundary (hk_pack_run_member()) changes.
The planner bounds the new members like any other: at most one looping
stream per packet, and a member that would add a render wait or a
synchronization kind starts a new packet. The strong-flush boundary
(HAL200 without a memory-scoped form), and M5 devices whose kernel lacks
DRM_ASAHI_FEATURE_COMPUTE_VISIBLE_COMPLETION, are handled exactly as
before.

hk_pack_test checks the M5 tails: a memory-scoped or plain strong flush
at the end is a member; a weak barrier, a strong flush before the end,
or a kernel without the feature (either tail) is not. On G17S, a chain
of {dispatch, COMPUTE -> COMPUTE barrier} command buffers whose tails
lack the memory scope forms one packet, also on a queue that ran
renders and with memory-scoped tails mixed in. The boundary comments
(hk_pack.c, hk_pack.h) say what a member ends with now.

Signed-off-by: Diljit Singh <hey@djdev.me>
The two cases from PR #449 rebased onto the current tip: a narrowing
i2i must not appear for u2u8-of-i2i32-of-i2i16 and the sign extension
must survive for u2u16-of-i2i32-of-i2i8. Follow-up offered in #449;
upstream fold re-landed separately in #513.
hk: pack runs of plain compute command buffers into one command
…eck tested

With robustBufferAccess or robustBufferAccess2, nir_lower_explicit_io
checks each storage and uniform buffer access on its 32-bit byte
offset, amul(index, stride) plus member offsets, and accesses
base + u2u64(offset). The check tests that offset modulo 2^32. Address
lowering instead takes amul as a product that does not wrap: the
relaxed lea rules, the zero-extended constant fold, the index fold and
the stride rescale in fold_byte_offset all rebuild the address from the
unwrapped index. For an index whose product wraps, the address
accessed then differs from the offset checked by a multiple of 4 GiB.

amul's no-wrap promise holds only for a valid access, and an access
the check admits need not be valid. Add agx_shader_key::
checked_offsets, which Honeykrisp sets when storage or uniform buffers
are robust. agx_nir_lower_address then makes every 32-bit amul an imul
before it fuses anything, so only the exact rules apply: an index is
taken unwrapped at its scale only where range analysis proves the
product cannot wrap (scale_is_exact), and otherwise as the product
shifted back. The same holds for SSBO descriptor array indices, which
are checked against the binding's size the same way.

scale_is_exact no longer takes a no-wrap flag as that proof for checked
offsets: the flags come from the shader's SPIR-V decorations, and a
shader that breaks them still gets the checked offset.

Shaders without robust buffers are unchanged.

test-lower-address-checked-offsets.cpp lowers p + u2u64(offset) for
offsets amul(x, d), amul(x, d) + c, amul(x + k, d) and
amul(x + k, d) + c with strides 1-64, member offsets up to 0x7ff0 and
k = -1, 1, 3, for 8- to 32-bit loads and stores and 32-bit atomics
under every option set, and checks that each access names base plus
the 32-bit offset for indices across 2^28-2^32. It also checks the
forms above, that no-wrap flags do not move a checked access, and
that a range-bounded index is still taken unwrapped at the stride's
scale.

Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
fold_byte_offset turns an index amul(i + c, stride) into i * stride
plus the byte offset c * stride, with i * stride a sign-extended 32-bit
product. For c < 0 that product exceeds the valid offset by up to the
byte offset's 32 KiB range, so in the last 32 KiB of a 2 GiB buffer it
can pass 2^31 and turn negative: a byte array of 3-byte records read at
a[i - 1] = offset 0x7ffffffe went to 2 GiB below the buffer instead.
The fold excluded c < 0 only for a byte stride, but the overflow
depends on the scale, not the stride: where the access scales the index
by 2 or more, the product stays below 2^30 + 2^14. Require c >= 0 at a
byte scale instead.

LowerAddressCheckedOffsets.ValidOffsetsKeepTheirAddressUnchecked lowers
the same offset forms without checked offsets and checks every valid
offset (below 2^31), including the last elements of a 2 GiB buffer.

Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
nir/opt_algebraic: Remove some remaining i2i casts (cherry-pick of upstream 23eedf4)
nir/algebraic: test the u2u downcast split
agx_ppp_push_merged() packs into a uint8_t stack array and then hands
it to agx_ppp_push_merged_blobs(), which asserts that both sources are
4-byte aligned and ORs them a word at a time; agx_pack() also stores
into it through a uint32_t pointer. A byte array has no such
alignment. GCC happens to place it on a word boundary, clang does not,
so clang builds abort in hk-dual-source-gpl (the drm-shim test) at
agx_ppp.h:217 on the first merged FRAGMENT_CONTROL record.

Declare the scratch as uint32_t words. The record length is a multiple
of four (asserted), so the size is unchanged.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Since e86c385 every AGX3 render-start VDM barrier carries the USC
cache invalidate (0x21000968). The G15 (M3 Pro/Max) and G16 (M4) kernel
backends admit a render only when its VDM stream starts with exactly
0x21000960, so every graphics submission on those chips failed with
EINVAL and the device was lost; compute was unaffected.

Pick the word per chip: G15S, G15C and G16G keep 0x21000960, the other
chips keep the invalidate. The barrier packer and the shared VDM barrier
emitter (agx_vdm_barrier) both use agx_vdm_barrier_core_word(). The G15S
drm-shim stream gate again refuses any other root word, as the kernel
does.

Developed with Claude Code.

Signed-off-by: Erik Bourget <erik@ebourget.net>
hk: batch buffer copy regions on every native AGX3 and M5 chip
hk: pack M5 command buffers that end in a barrier without memory scope
…h-align

asahi: keep the merged PPP scratch words 4-byte aligned
agx, hk: address robust buffer accesses at the offset their bounds check tested
ci: build the drm-shim tests and run the poly suite (+2/-2)
agx: keep the plain render-start barrier word on G15S, G15C and G16G
Bring the Neo Edge Mesa up to aurora-wip 4596393 while keeping what
aurora-edge has that aurora-wip lacks:

- ef112c2 (#447, asahi: free the temporary geometry copy NIR after
  compiling) is kept. aurora-wip still leaks gs_copy, a
  nir_shader_clone(NULL, ...) that agx_compile_nir() never takes.
- 28a91e3 and 8b4604f (#421/#422) are already in aurora-wip as
  5bf141e and 1ee921d.
- 06c4609 backported #423 and #425 to the frozen Edge compiler; both
  are merged in aurora-wip (b4dbeb1, 57df4db), so their aurora-wip
  form is kept. The automatic merge doubled a G17P mesh fence check in
  agx3_pack_binary.c; aurora-wip's copy of the compiler is kept as is.

The resulting tree is aurora-wip 4596393 plus the one-line #447 fix.

Signed-off-by: Diljit Singh <hey@djdev.me>
8de38ad (#494) raised maxMeshMultiviewViewCount on G17P from 16 to
HK_MAX_MULTIVIEW_VIEW_COUNT (32). dEQP-VK.mesh_shader.ext.properties.
max_view_index draws with min(maxMeshMultiviewViewCount, 32) views and
builds its subpass view mask as (1u << count) - 1u. At 32 views that
shift is undefined; on AArch64 it shifts by count mod 32, so the mask
is 0, the render pass is not multiview and only layer 0 is drawn. Since
then the case fails on the Neo (A18 Pro): "Unexpected pixel value at
layer 1: (0, 0) is (0, 0, 0, 1) while expecting (2, 0, 0, 1)".

The Vulkan CTS gate for Aurora releases takes no expected failures, so
go back to the 16 views that c676eb2 reported and the Edge alpha.1
gate qualified, where the case checks all 16 layers. Raise the limit
again once VK-GL-CTS computes the mask without the overflowing shift
(#516). No other Mesa driver reports more than 8 here (radv 8, nvk 4,
anv and lavapipe 1).

Only G17P is affected: multiviewMeshShader is not exposed elsewhere.

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

@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.

No blockers. I compared the head (15fe501) with aurora-wip 4596393: it is 10 commits ahead, 0 behind, and the tree differs in two files, not one:

  1. src/gallium/drivers/asahi/agx_state.c: the ralloc_free(gs_copy) from #447, as described.
  2. src/asahi/vulkan/hk_physical_device.c: maxMeshMultiviewViewCount reported as 16 with the CTS view-mask comment, i.e. the #586 change. That is the fix for the max_view_index failure on the earlier Edge Mesa, so it belongs here; please add it to the description so the Edge tree is fully accounted for.

Two follow-ups: the separate PR that forward-ports the gs_copy free to aurora-wip (otherwise the next Edge sync drops it again), and the Neo qualification on this exact head, which fedora-aurora#466 is waiting on before it publishes 15fe501.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr

Copy link
Copy Markdown
Author

Neo J700 qualification of the Edge alpha.2 pair (11-20/21)

Pair: kernel-aurora 7.3.0-43 (linux e0ee46a18e33, vmlinuz 701ed7f2…, signer run 44694386531) + mesa-aurora 26.3.0-35 (mesa 15fe5010c149, libvulkan_asahi.so 767f3e17…, signer run 44832807927), the exact signed RPMs: the kernel installed for one-shot boots, Mesa signature-checked and extracted to a private prefix. Neo: A18 Pro (G17P), its own Stage 2 1.0.0b13-g5dcf62d0. CTS: vulkan-cts-1.4.7.1 (deqp-vk d3ef839a…) and the alpha.1 GL package, unpatched.

gate result
GL CTS 135,725 cases: 129,291 Pass / 6,381 NotSupported / 48 QualityWarning / 5 CompatibilityWarning / 0 Fail (same counts as alpha.1); 0 GPU kernel lines
Vulkan CTS 3,215,124 cases: 1,629,495 Pass / 1,585,624 NotSupported / 4 QualityWarning / 1 Fail = dEQP-VK.api.driver_properties.conformance_version (the release policy case); 0 GPU kernel lines. mesh_shader.ext.properties.max_view_index passes; vk-060-mesh-shader 26,568 Pass / 0 Fail
Vulkan WSI vk-195-wsi in its own chunk with the panel on and the session unlocked: 835 Pass / 36,041 NotSupported / 0 Fail (= alpha.1). The 40 present_timing/present_id_wait Fails of the 26.3.0-34 run were the panel-off + locked state: alpha.1, -34 and -35 all fail 0/40 that way and pass 40/40 with the panel on
Deep sleep 3 one-shot -43 boots x 3 firmware deep sleeps (~20 s PMU RTC alarm) = 9/9 PASS on the DRAM-kept path; after every wake: GPU smoke on the -35 Mesa (VK 118/0, GLES3 100/0), Wi-Fi, BT, panel, ALS, failed units [], 0 AOP crashes, 0 sleep-path errors; 3/3 Wake-on-LAN (30 s sleep, Wi-Fi magic packet); 5 % speaker row via speakerguardd and the desktop/VA-API (VP9+AV1 bit-exact)/camera/ANE/audio smoke 6/6
Stage 2 aura 2f487f26 (1.0.0~b13.1-3, the Stage 2 this payload ships): one-shot aura-try boots on the Neo of the prescribed pin-A build and of the shipped RPM m1n1.bin (6e462659…) both PASS: "MCC: Initialized T8140 MCCs (1 instances, 4 planes, 4 channels)", no panic (PMU f702 = 00), no new faults, then back on the committed 5dcf62d0 with the ESP byte-identical
Restoration strict: files, links, ESP, modules, packages, BLS, default, kernel and grubenv byte-identical to the pre-install baseline after removing the candidate kernel

M5 J714s: rgate35c PASSED on the same signed kernel + Mesa 26.3.0-35 (DSO 767f3e17…) with Stage 2 2f487f26 (receipt sha256 b6402244…).

Owner qualification JSON (neo_edge.verify_evidence OK): glCTS b61f919f…, vulkanCTS 32ce0ed9…, deepSleep 5eff7f26…, restoration c5178cec….

@DjDeveloperr
DjDeveloperr merged commit 6ed1eec into aurora-edge Nov 21, 2026
@DjDeveloperr

Copy link
Copy Markdown
Author

Correction to the qualification summary above: the Vulkan CTS was not unpatched.

It was cts-vk4 from the neo-cts-kit-base2-v8 release (cts-vk4.tar.zst sha256 50f4dffd7ff1aa0956b3ac0b4fbde7f18740e7a440717573543ef61f0cbcf7fe, deqp-vk sha256 d3ef839a…). That build is VK-GL-CTS 1.4.7.1 plus two patches:

  1. Driver ID 35. It adds VK_DRIVER_ID_AURORA_BOREALIS = 35 to CTS's generated known-driver-ID tables. This patch decides dEQP-VK.api.driver_properties.driver_id_match, which passes here. A stock CTS fails it, because ID 35 is not in the Khronos registry.
  2. Teardown order. When a session ends early (for example, aborted after a lost device), the patch de-initializes the test groups that were entered before the case executor is destroyed. The case executor owns the Vulkan loader, instance and device, so group teardown no longer calls into an unloaded driver. A session that completes normally is unchanged. This patch decides no verdict in this gate: every counted session completed normally, with 0 GPU recoveries and 0 lost devices. The one early stop was a time-budget stop of a run chunk inside vk-168-ray-tracing-pipeline, and that file was then rerun in full.

All other results are unchanged. That includes mesh_shader.ext.properties.max_view_index, which doesn't depend on either patch (VK-GL-CTS#661 is not in this build), and the single api.driver_properties.conformance_version Fail.

@RyanTheTide
RyanTheTide deleted the djdev/edge-neo-mesa-20261120 branch November 27, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.