Keep the Iris Xe's depth fast: DontCare stores, sampled usage for hierarchical depth, multisampled depth held out of GENERAL

Three measured cost facts for ANV (Mesa 26.2.4) on the Iris Xe of RPL-P (0xa7a0), each a pure fast
path that keeps every texel and the order of every use: no policy switch, notice or ledger row.

What changes:
- DriverFact::DontCareStoreIsOneOfMetals gains a row for this GPU: an attachment a pass stores
  DontCare is Vulkan's DONT_CARE there, as on the UHD 770 and the Radeon 780M.
- New DriverFact::SampledDepthKeepsHiZ. ANV turns off a single-sample depth image's hierarchical
  depth and compression in GENERAL (the layout every runtime image rests in) for an image of
  transfer-source usage, but keeps its write-through form on for one of sampled usage. Where the
  fact holds, a single-sample depth attachment plan the device samples takes SAMPLED too
  (image_plan::hiz_candidate), heap textures and the runtime's own depth images included; the heap
  size answer comes from the same plan. Memory size and alignment are equal with and without it.
- New DriverFact::MultisampledDepthFasterOutOfGeneral. A multisampled depth image renders very
  slowly in GENERAL on this GPU, since the write-through hierarchical depth is single-sample only.
  Where the fact holds:
  - each render pass instance holds a multisampled depth attachment in
    DEPTH_STENCIL_ATTACHMENT_OPTIMAL, moved from GENERAL by a barrier before it and back after
    it (the feedback-loop mechanism, generalized to moved images; WorkCounts
    depth_attachments_moved);
  - the device's own Private multisampled depth texture stays in the attachment layout between
    encoders that only render it (texture/held_depth.rs). The scheduler moves it at encoder
    boundaries, before any encoder that uses it otherwise, as a tracked write of the whole image so
    the hazard tracker orders it against every use on every queue. A pass holds only when nothing
    else in its encoder touches the image; a later use breaking a hold fails the encoder's end
    with a visible internal error. WorkCounts depth_instances_held and held_depths_released.
  - An instance an execution of render commands joins, inline instances and the resolve-after
    instance stay in GENERAL. Layout transitions preserve contents unless the old layout is
    UNDEFINED (Vulkan, Synchronization, Image Layout Transitions).
- New measurement runtime_lane::depth_costs (ignored by default).

Why: in GENERAL these depth attachments lose the hierarchical depth test, so the depth test
rejects no fragment a block at a time; and moving back to GENERAL after every pass costs a full
hierarchical-depth resolve, about 1.95 ms a pass at 1080p with 4 samples.

Verified, release, on the Iris Xe:
- runtime_lane::dont_care_stores: every texel of its twelve kept cases was the earlier or the
  stored one, none other.
- A 1080p heap Depth32Float at 32 layers: 4.72-5.66 -> 0.82-0.87 ms with sampled usage. A 4x
  Depth32Float at 32 layers: 12.14 -> 1.44-1.52 ms moved per instance; held between encoders, 1
  layer 2.56 -> 0.62 ms and 32 layers 4.35 -> 2.38 ms (GPU clock fixed at 300 MHz). Batches that do
  not name the depth showed no CPU difference above noise.
- runtime_lane::msaa_depth_moves 9 of 9 under the validation layer with the counters checked (a
  blit between passes, a resolve in its pass, frames, reads after each pass, two queues ordered by
  an event, a split pass, an argument-buffer read with useResource, an encoder that also binds its
  depth, an indirect-command-buffer execution); the depth, resolve, snapshot, clear-reach,
  memoryless and fence-stage lanes passed. On the Radeon 780M and RTX 3090: msaa_depth_moves 9 of
  9 with the fact off and every counter 0. Runtime unit filters 134 passed.
- The RTX 3090 measured neutral for both depth facts, and the RX 7900 XTX keeps DontCare as STORE
  (not a measured identity), so neither is listed.
- Unaudited: no lane covers a tile dispatch in a held pass.
This commit is contained in:
Anees Iqbal committed 2026-10-19 00:15:59 +03:00
1 parent 86b5d6faf3
commit 2423b8de61
26 files changed
+2135 -146

No files matched your search

@@ -165,6 +165,7 @@ impl State {
let Replayed {
raws,
summary,
held,
retained,
executions,
keys,
@@ -209,6 +210,7 @@ impl State {
let record = &mut self.ended[at];
record.executions = first.start..first.start + count;
record.keys = keys;
record.held = held;
record.taken = taken;
if let Some(residency) = residency {
if let Some(first) = record.residency.replace(residency) {