Repository navigation
drm/asahi: g16: advertise RENDER_RAY_QUERY only where render SCS is supported - #4184
DjDeveloperr wants to merge 1 commit into
Conversation
…upported RENDER_RAY_QUERY tells userspace that a queue takes render_scs_layout, the scratch its render stages' ray queries run on. The g16 runtime sets the bit on every GPU from generation 15 on, but reserve_render_scs() refuses a nonzero layout with EOPNOTSUPP on a configuration whose supports_render_scs is false: T6030 and T6031. Userspace that trusts the bit fails to create the queue of its first render with a ray query in a graphics stage, and reports a lost device. Set the bit from supports_render_scs. BOUNDED_AS_BUILD keeps its generation check: AS builds are compute commands with a longer allowance and reserve no scratch. T8132 and T8122 report the same feature word as before. The host test checks that a configuration advertises the bit exactly when its queues take the reservation, for every configuration in hw.rs. It fails with the old condition. Fixes: cc04c5d ("drm/asahi: g16: admit ray queries and bounded AS builds on G15") Signed-off-by: DjDeveloperr <hey@djdev.me>
RyanTheTide
left a comment
There was a problem hiding this comment.
The render feature now reflects the same scratch capability used by queue creation. Bounded acceleration builds remain independently advertised. The shim shows the reported queue failure turns into an unavailable feature. Mesa also withdraws compute traversal on these identities because it shares the bit, as documented. That trade-off and T6030 hardware qualification remain visible.
There was a problem hiding this comment.
Independent review of f0259abfefbc by a reviewing agent that didn't write it. The code does what it says, but I don't think this should merge. Measure the other direction first.
What fails today on T6030 (main, flag false): a vertex, geometry or fragment ray query makes Mesa create a queue with a nonzero render_scs_layout; reserve_render_scs() returns EOPNOTSUPP and Mesa marks the device lost. Nothing is submitted, and mesa#1585 reports no recovery from it. Compute and ray-tracing-pipeline queries need no reservation, so the kernel accepts them. That is from the code: I found no J516s run that shows their results are right.
Why not this PR: Mesa uses the same bit for all native ray tracing, so it also removes compute ray queries and ray-tracing pipelines, which the kernel accepts today, to avoid a failure that only graphics stages are known to have. #3132 gave no measurement for the false, and #3756 set true on T8122 from J615 runs and left T6030 "until measured".
What true would change, read from the code: QUEUE_CREATE takes the reservation; a stage with scratch gets two more records (0x017e1 = 1, 0x017d9 = 1; TA 74 to 76, FS 82 to 84), START_SCS = 1, and the size / window / stack / tail / table words, on a larger UMA pool. T8122 runs the same lists and words.
A limit to know before flipping it. With Mesa's layout (989 pages per core) the pool window holds two stages only up to 11 active cores. At 14 or 18 cores required_seeds() (compiled from this tree) gives one stage 22528 or 26624 seeds, which fits, and both stages E2BIG. So on a 12+ core part a queue that runs a vertex and then a fragment ray query still loses the device. SCS_POOL_WINDOW would have to grow for that. A CTS run that mixes the two in one process would look like a failure of the flip.
Row that decides it (one boot, J516s): main plus only the flip and the two tests that pin the old value (check-abi-26b123.rs, test-ray-tracing.py); read the active core count from dmesg first; ray_query.builtin.flow and watertightness for frag, vert and geom each in its own process, then a vert + frag process as the predicted E2BIG case, then a sample of the AS fragment and vertex cases. Pass: all pass, no new recovery, fault or quarantined slot, and the mixed case as predicted.
Please keep this one as a draft until that row. If it passes, the flip plus a larger window replaces this PR, and the change here to tie the bit to the flag is still right as a follow-up.
Run on the merge with main dbfe45ac89b6: asahi-m4 1/1, g16 2/2.
|
Keeping this PR in draft until the remaining hardware decision row runs. What is left before leaving draft (or closing as superseded)
Merge status
|
|
J516s (MacBook Pro 14-inch M3 Pro, Stack under test
Results
Conclusion
|
|
The decision row above passed with the flag alone except the vertex + fragment process, which lost the device at QUEUE_CREATE (E2BIG: 44544 seeds for both stages at 18 cores, 31744 in a 128-MiB window). #4254 takes render scratch on T6030 together with 256-MiB SCS pool windows, so both stages fit; its host test fails on the flag-only tree at After it lands, tying |
What: On T6030 (and T6031) the g16 runtime advertises
RENDER_RAY_QUERY, then refuses the render scratch reservation the bit promises:DRM_IOCTL_ASAHI_QUEUE_CREATEwith a nonzerorender_scs_layoutfails withEOPNOTSUPP, and the first ray query in a vertex, geometry or fragment shader becomesVK_ERROR_DEVICE_LOST. Set the bit from the samesupports_render_scscapability the queue checks, so it is only offered where it works. See aurora-silicon/mesa#1585.Cost on T6030 until
supports_render_scsis measured there: current Mesa uses this one bit to decide on all native ray tracing, so T6030 losesVK_KHR_ray_queryandVK_KHR_ray_tracing_pipelinecompletely: ray queries in compute and ray-tracing pipelines too, not only in graphics stages.VK_KHR_acceleration_structurestays. If T6030 passes a row withsupports_render_scs: true, that flip is the better fix, and with this patch the bit comes back by itself.Tested: no hardware run. Host tests and the arm64 build of
drivers/gpu/drm/asahi/pass; the Mesa side was checked offline (Evidence).Risk: two-way · M3 Pro, M3 Max
Not yet: hardware row on J516s; a J516s run with
supports_render_scs: trueDetails
Why T6030 has
supports_render_scs: false. It was never measured; nothing in the history says it fails.reserve_render_scs()refused every GPU below generation 16. The commit turned that into a capability, true on T8132 and false on T6030, and accepted empty reservations "on hardware without render scratch slots". No measurement is given.RENDER_RAY_QUERYfrom generation 15 on, for T6030 too. b75edb7 in the same PR fixed this exact failure on T8122 by setting its flag to true after J615 runs, and says "T6030 (M3 Pro) keeps supports_render_scs false until measured on hardware". The review of drm/asahi: g16: admit G15 ray queries, bounded AS builds, and T8122 render SCS #3756 listed the T6030 mismatch as a follow-up.The change.
ray_tracing_features(cfg)givesRENDER_RAY_QUERYforsupports_render_scsandBOUNDED_AS_BUILDfor generation 15 and up, as before. No chip check. T8132 and T8122 report the same feature word as before.BOUNDED_AS_BUILDis independent.DRM_ASAHI_COMPUTE_AS_BUILDonly gives a compute command the longer allowance (rt::as_build(),rt::select()); it reserves no scratch, render or compute.What Mesa does without the bit (read and run at mesa 484e42c96e9c,
aurora-wipone merge behind its tip, which touches none of these files):hk_g17p_rt_enabled()needsEXACT_PRIOR_BARRIERS | RENDER_RAY_QUERY; it goes false.hk_gen1_as_only_enabled()(EXACT_PRIOR_BARRIERS | BOUNDED_AS_BUILD) stays true, so the device keepsVK_KHR_acceleration_structurewithout traversal state. This is the existing path for kernels without traversal, with its own shim identity (g16s-as) and unit tests.rayQuery/rayTracingPipelinefeatures disappear, so an application cannot create a pipeline that uses them: nothing is refused at pipeline creation or at submit. There is no software fallback on AGX3 (it is for the AGX2 ISA).VK_KHR_ray_query,VK_KHR_ray_tracing_pipeline,VK_KHR_ray_tracing_maintenance1,VK_KHR_ray_tracing_position_fetch,VK_EXT_ray_tracing_invocation_reorder,VK_EXT_pipeline_library_group_handles.scs_layout, intersection tables) on T6030, and none of it needs render SCS. Keeping ray-tracing pipelines there would need a separate kernel bit for compute traversal and a Mesa change to read it;VK_KHR_ray_queryneeds the graphics stages.hk_native_rq_profile()), as on every kernel without the bit.What enabling
supports_render_scson T6030 takes. Set it true on J516s and run what #3756 ran on the J615: the vertex, geometry and fragment ray-query probes,dEQP-VK.ray_query.builtin.flowandwatertightness(vert, geom, frag),ray_query.acceleration_structures.*fragment_shader*and*vertex_shader*, with 0 GPU faults and 0 firmware recoveries. Both chips run the G15 26B123 protocol and register lists. The differences to watch are two clusters and up to 18 cores:required_seeds()andpool_seeds()scale the pool with the active cores, and the largest layout has to fit the SCS pool window (E2BIG otherwise).Not changed:
validate_render_entry()still takes a render stage's intersection words from generation 15 on. Without a reservation it refuses scratch (EINVAL), as before.Evidence
Head
f0259abfefbcca3166635fd2aaa2d506fda178baona05d99c9dbc2(main has moved 10 commits since, none in these files).Host tests in the hosted-CI image (ubuntu 24.04, rust 1.96.0),
tools/asahi/run-host-tests.py --only:asahi-m41/1 (the whole asahi-m4 suite),g162/2,g15-display-order1/1,m3-recovery2/2.test-ray-tracing.py: 24 passed.The new test takes each configuration in
hw.rsand generations 13 to 16 with both flag values, and checks that the bit is set exactly whenreserve_render_scs()takes the reservation:gpu_generation >= 15) in the helperleft == right failed: 15 falseBOUNDED_AS_BUILDfollowing the flagarm64
LLVM=1 W=1 drivers/gpu/drm/asahi/(asahi profile,DRM_ASAHI=m, G15 and G16 on, clang 23, rustc 1.100): builds, no new warning. Base and head print the same 39 warnings of that newer toolchain, line for line;asahi_core.odiffers between them. checkpatch on the diff: 0 errors, 0 warnings.Mesa 484e42c96e9c (x86, asserts on) with the noop drm-shim as "Apple M3 Pro (G15S B1)", reporting the g16 feature word with and without bit 15 (
0x81026001c001/0x810260014001on top of the shim's G15S bits). The shim copy was patched to refuserender_scs_layoutlike T6030 and to skip its old-backend G15S packet rules. It runs no GPU work, so "Fail" below only means "submitted, no pixels".accelerationStructure/rayQuery/rayTracingPipelineray_query.builtin.flowcompute and ray-tracing stagesray_query.builtin.flow.frag.aabbsVK_ERROR_DEVICE_LOSTray_query.{misc,builtin.flow,watertightness}ray_tracing_pipeline.{misc,builtin,watertightness}Without ray tracing the two arms agree:
geometry(200),tessellation(1,114),clipping(308),api.info(10,490),info,transform_feedback.simple.basic*,pipeline.monolithic.stencil(58,496): 0 crashes or lost devices in either. Threetessellation.tess_io.level_iocases flipped once under load (the shim's memory is not initialised) and were equal in 4 of 4 reruns. Insubgroups.basiconly the 5ray_tracing.*cases change, to NotSupported.