RUNTIME 2324: Boxed draws: a fanned-out triangle's geometry stage is worth 24 vertex-regions, not 180
The boxing rule (RUNTIME 2318) took GEOMETRY_TRIANGLE_WORK = 180 from the pieces lane's bands frame, whose 22-by-10-pixel triangles cost 132 ns each fanned out on an Iris Xe: mostly their fragments, which every route shades, not the geometry stage boxing saves. Its 61 boxes on the patches frame (2-pixel quads, about 18 regions a box) lost on every device measured, the pass's warm piece: Iris Xe (Mesa 26.2.6) 4.64 ms fanned, 9.21 / 9.06 ms boxed (m3-max-30553) Radeon 780M (Mesa) 6.47 / 6.46 ms, 13.57 / 13.57 ms (m3-max-30687) RTX 3090 (620.70.06) 2.80 / 2.77 ms, 3.01 / 3.00 ms (m3-max-30686) On that frame, whose fragments cost little, a fanned-out triangle cost 15.4, 21.5 and 9.3 ns, a boxed vertex-region 0.59, 0.87 and 0.19 ns: 26, 25 and 49 units. The constant is the least, 24.7, rounded down, so a draw it boxes costs no more than its fan-out on each of the three; a lower constant only boxes fewer draws than 180 did. The doc and docs/FAST-PATHS.md's row carry the numbers. tests::rate_mapped_boxed_draws: the 120-by-40 strip across ten regions (50 units a triangle, the patches frame's boxes about 55) is now fanned out, and a patch across four regions' corner is boxed in its place, so the test still boxes a draw across region borders: counts [1, 0, 3, 4, 4]. At 180 the strip is boxed and the counts fail. tests::rate_mapped_boxed_rule checks the rule on the patches frame's average draw: 18 regions fanned out, 4 boxed. The lane's patches frame no longer asserts that it boxes a draw. RUNTIME 2324: an unchanged artifact's rate-mapped draw that boxed at 180 fans out at 24.
This commit is contained in:
1 parent
84dd5beebe
commit
5983bb3e72
8 files changed
+66
-35
No files matched your search
@@ -654,18 +654,22 @@ const REGION_DRAW_WORK: u64 = 512;
|
||||
/// runs, three a triangle, than the region draw a run of their own takes ([`REGION_DRAW_WORK`]).
|
||||
pub(super) const RUN_GAP: u32 = (REGION_DRAW_WORK / 3) as u32;
|
||||
|
||||
/// What a fanned-out triangle's geometry stage costs, in vertex invocations of one region, the
|
||||
/// units of [`draw_work`] (the module docs, **Fan-out**, boxed draws; [`boxes_cheaper`]). On the
|
||||
/// pieces lane (`runtime_lane::rate_mapped_pieces`: 64 commands of 918,108 indices, 306,036
|
||||
/// triangles, over 2074 regions), each warm frame's GPU time a triangle fanned out against an
|
||||
/// index for one region drawn through each region's own viewport (`RateMapRegionPolicy::Exact`):
|
||||
/// an Iris Xe's (Mesa 26.2.6) 130.7 ns against 0.262 ns, 500 times, and against the 0.352 ns of
|
||||
/// one drawn through its region-copy variant (the frame `commit` records, 670 ms), 371 times; a
|
||||
/// Radeon 780M's (Mesa 26.2.6) 91.2 ns against 0.123 ns, 739 times; a Radeon RX 7900 XTX's (Mesa
|
||||
/// 26.2.6) 23.5 ns against 0.041 ns, 570 times; an RTX 3090's (NVIDIA 620.70.06) 19.9 ns against
|
||||
/// 0.030 ns, 654 times. This is about half the least, 371: a draw boxed by it costs at most about
|
||||
/// half its fan-out on each of the four.
|
||||
pub(super) const GEOMETRY_TRIANGLE_WORK: u64 = 180;
|
||||
/// What a fanned-out triangle's geometry stage costs, in vertex invocations of one region drawn
|
||||
/// through the region-copy variant, the units of [`draw_work`] (the module docs, **Fan-out**,
|
||||
/// boxed draws; [`boxes_cheaper`]). Measured where the triangles' fragments cost little, so a
|
||||
/// piece's time is its geometry's: the pieces lane's patches frame
|
||||
/// (`runtime_lane::rate_mapped_pieces_host_step_patches`: 64 commands of 903,450 indices, 301,150
|
||||
/// triangles, each command a square patch of quads of 2 screen pixels, over 2074 regions), warm,
|
||||
/// in two rounds, the pass's one piece's GPU time with every draw fanned out against 61 of them
|
||||
/// boxed into 15,286,908 vertex-regions: an Iris Xe's (Mesa 26.2.6) 4.64 ms, 15.4 ns a triangle,
|
||||
/// against 9.21 ms and 9.06 ms, 0.59 ns and 0.58 ns a vertex-region beyond the triangles it no
|
||||
/// longer fans out, 26 and 27 times; a Radeon 780M's (Mesa 26.2.6) 6.47 ms and 6.46 ms, 21.5 ns,
|
||||
/// against 13.57 ms, 0.87 ns, 25 times; an RTX 3090's (NVIDIA 620.70.06) 2.80 ms and 2.77 ms,
|
||||
/// 9.3 ns and 9.2 ns, against 3.01 ms and 3.00 ms, 0.19 ns, 49 times. This is the least, 24.7,
|
||||
/// rounded down: a draw boxed by it costs no more than its fan-out on each of the three. A frame
|
||||
/// of larger triangles counts their fragments, which every route shades, as the geometry stage's
|
||||
/// (the lane's bands frame, 132 ns a fanned-out triangle on the Iris Xe).
|
||||
pub(super) const GEOMETRY_TRIANGLE_WORK: u64 = 24;
|
||||
|
||||
/// Whether a draw the probe flags nothing of, of `vertices` vertices or indices times its
|
||||
/// instances and at least `triangles` triangles times its instances, is drawn through its
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
//! blocks', [`run_bounds`]), as a run is, where those boxes' region draws hold no more work than
|
||||
//! its triangles' geometry stage would (`rate_mapped_pass::boxes_cheaper`,
|
||||
//! `GEOMETRY_TRIANGLE_WORK`): a draw whose triangles lie in a few regions skips the geometry
|
||||
//! stage, which costs a fanned-out triangle what hundreds of vertex invocations do. It keeps its
|
||||
//! command's place, and a pixel lies in one region, whose copies keep the draw's order of
|
||||
//! instances and primitives under either variant, so a pixel takes the same fragments in the
|
||||
//! stage, which costs a fanned-out triangle what about 24 vertex invocations of one region do. It
|
||||
//! keeps its command's place, and a pixel lies in one region, whose copies keep the draw's order
|
||||
//! of instances and primitives under either variant, so a pixel takes the same fragments in the
|
||||
//! same order; the bounds are widened as the probe's are, so a box holds every pixel a copy of
|
||||
//! its triangles would cover (`WorkCounts::rate_map_boxed_draws`). A boxed draw is never cut into
|
||||
//! ranges, as a fanned-out one is not: it rides whole in the piece it begins in, its work no more
|
||||
|
||||
@@ -585,6 +585,7 @@ mod range;
|
||||
mod rate_map;
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
mod rate_mapped_boxed_draws;
|
||||
mod rate_mapped_boxed_rule;
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
mod rate_mapped_depth_equal;
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
|
||||
@@ -4,13 +4,17 @@
|
||||
//! probe's bounds, not fanned out, where those regions' draws hold no more work than its
|
||||
//! triangles' geometry stage (`rate_mapped_pass::boxes_cheaper`). Four commands draw a grid of
|
||||
//! small triangles, twice, over a small patch of the screen: one inside a square of 10 screen
|
||||
//! pixels, one over a strip of 120 by 40 that crosses the borders between regions, one of two
|
||||
//! instances, and one without indices; two others are fanned out, a grid over the whole target
|
||||
//! and one quad, twice, over a square of 60 pixels, whose region draws would cost more than their
|
||||
//! geometry stage. Each command blends its own colour at half alpha over what the commands before
|
||||
//! it drew, so a copy drawn twice, left out of its region, or drawn out of the commands' order
|
||||
//! changes the pixels: the target's bytes are those of the same commands drawn on the encoder,
|
||||
//! every one through its region-copy variant into every region.
|
||||
//! pixels, one over a square of 25 by 30 across the corner where four regions meet, one of two
|
||||
//! instances, and one without indices; three others are fanned out, whose region draws would cost
|
||||
//! more than their geometry stage: a grid over the whole target, one quad, twice, over a square of
|
||||
//! 60 pixels, and a strip of 120 by 40 across ten regions, shaped as the boxed draws of the pieces
|
||||
//! lane's patches frame were, which took twice their fan-out on an Iris Xe and a Radeon 780M (their
|
||||
//! boxes' region draws about 55 vertex-regions a triangle, the strip's 50, against the 24 a
|
||||
//! triangle's geometry stage costs, `GEOMETRY_TRIANGLE_WORK`). Each command blends its own colour
|
||||
//! at half alpha over what the commands before it drew, so a copy drawn twice, left out of its
|
||||
//! region, or drawn out of the commands' order changes the pixels: the target's bytes are those of
|
||||
//! the same commands drawn on the encoder, every one through its region-copy variant into every
|
||||
//! region.
|
||||
//!
|
||||
//! A device test: compiled only under the validation crate's GPU safety cfgs (`m2v_gpu`,
|
||||
//! `m2v_cpu_icd`), on the kind of device the cfg selects. The functions are `tob_triangle` and
|
||||
@@ -50,9 +54,11 @@ struct Patch {
|
||||
indexed: bool,
|
||||
}
|
||||
|
||||
/// The commands, in order: boxed, boxed across region borders, boxed of two instances, fanned out
|
||||
/// over the whole target, fanned out of four triangles, boxed without indices.
|
||||
const PATCHES: [Patch; 6] = [
|
||||
/// The commands, in order: boxed, fanned out across ten regions, boxed of two instances, fanned
|
||||
/// out over the whole target, fanned out of four triangles, boxed without indices, boxed across
|
||||
/// four regions. The map's 12 segments of each axis begin at screen pixels 0, 68, 122, 166, 204,
|
||||
/// 237, 269, 302, 339, 382, 434 and 499 (y from the top, a patch's `y` from the bottom).
|
||||
const PATCHES: [Patch; 7] = [
|
||||
Patch {
|
||||
at: [100.0, 140.0, 10.0, 10.0],
|
||||
quads: PATCH,
|
||||
@@ -89,6 +95,12 @@ const PATCHES: [Patch; 6] = [
|
||||
instances: 1,
|
||||
indexed: false,
|
||||
},
|
||||
Patch {
|
||||
at: [225.0, 227.0, 25.0, 30.0],
|
||||
quads: 2 * PATCH,
|
||||
instances: 1,
|
||||
indexed: true,
|
||||
},
|
||||
];
|
||||
|
||||
/// The commands the host step boxes.
|
||||
@@ -380,7 +392,7 @@ fn counts(before: &WorkCounts, after: &WorkCounts) -> [u64; 6] {
|
||||
}
|
||||
|
||||
/// Under `FanOut` the host step probes once, flags nothing, boxes the four patches and fans out
|
||||
/// the whole target's grid and the wide quad; the boxed draws reach fewer regions than
|
||||
/// the strip, the whole target's grid and the wide quad; the boxed draws reach fewer regions than
|
||||
/// the table holds and at least one each. The pixels are the encoder's, which draws every command
|
||||
/// through its region-copy variant into every region. Under `Exact` nothing is boxed.
|
||||
#[test]
|
||||
@@ -399,12 +411,12 @@ fn a_host_step_boxes_the_draws_whose_triangles_lie_in_few_regions() {
|
||||
// Each command's vertices or indices times its instances.
|
||||
let vertices = |patch: &Patch| u64::from(6 * patch.quads * patch.quads * 2 * patch.instances);
|
||||
let all: u64 = PATCHES.iter().map(vertices).sum();
|
||||
let boxed_vertices: u64 = [0, 1, 2, 5].map(|k| vertices(&PATCHES[k])).iter().sum();
|
||||
let boxed_vertices: u64 = [0, 2, 5, 6].map(|k| vertices(&PATCHES[k])).iter().sum();
|
||||
match boxes(&workload.device) {
|
||||
true => {
|
||||
let table = whole / all;
|
||||
assert!(table > 1 && whole == all * table, "the encoder's {whole}");
|
||||
assert_eq!(seen[..5], [1, 0, 2, BOXED, BOXED], "{seen:?}");
|
||||
assert_eq!(seen[..5], [1, 0, 3, BOXED, BOXED], "{seen:?}");
|
||||
assert!(
|
||||
(boxed_vertices..boxed_vertices * table).contains(&seen[5]),
|
||||
"the boxed draws' vertex work {} of at most {} into every region",
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//! The rule that draws a rate-mapped draw through its region-copy variant into the boxes of the
|
||||
//! regions its triangles reach rather than fanning it out (`rate_mapped_pass::boxes_cheaper`,
|
||||
//! `render/fan_out.rs`, **Boxed draws**), on the draws whose times set it.
|
||||
|
||||
use crate::rate_mapped_pass::boxes_cheaper;
|
||||
|
||||
/// The pieces lane's patches frame (`GEOMETRY_TRIANGLE_WORK`): its 64 commands' 903,450 indices
|
||||
/// over 2074 regions, a command's 14,116 indices and 4705 triangles, the 61 it boxed about 18
|
||||
/// regions a box (15,286,908 vertex-regions), took twice their fan-out on an Iris Xe and a
|
||||
/// Radeon 780M. Such a draw is fanned out; boxed where its box holds 4 regions.
|
||||
#[test]
|
||||
fn a_draw_boxed_into_as_many_regions_as_the_patches_frames_is_fanned_out() {
|
||||
let (vertices, triangles) = (903_450 / 64, 903_450 / 64 / 3);
|
||||
assert!(!boxes_cheaper(18, vertices, triangles));
|
||||
assert!(boxes_cheaper(4, vertices, triangles));
|
||||
}
|
||||
@@ -538,11 +538,9 @@ fn pieces_frame_of(
|
||||
(true, true) => {
|
||||
assert_eq!(probes, 1, "the host step probed the pass once");
|
||||
assert!(fanned + boxed > 0, "no draw was fanned out or boxed");
|
||||
assert_eq!(
|
||||
boxed > 0,
|
||||
triangles == Triangles::Patches,
|
||||
"draws boxed: {boxed}"
|
||||
);
|
||||
if triangles != Triangles::Patches {
|
||||
assert_eq!(boxed, 0, "draws boxed");
|
||||
}
|
||||
assert_eq!(
|
||||
flagged > 0,
|
||||
triangles == Triangles::Wide,
|
||||
|
||||
Vendored
+1
-1
@@ -94,7 +94,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 523;
|
||||
/// changes no behaviour, and then updates that hash alone with the commit saying why, or changes
|
||||
/// behaviour and also bumps this version. The commit that bumps it says what changed; this comment
|
||||
/// keeps no history.
|
||||
pub const RUNTIME_VERSION: u32 = 2323;
|
||||
pub const RUNTIME_VERSION: u32 = 2324;
|
||||
|
||||
/// The digest of the sources this build of the crate was compiled from: SHA-256, as lowercase hex,
|
||||
/// of the manifest, the build script, and exactly the files the crate roots' module tree compiles
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ three consumer pipelines: A2X (`a2x-s4`, `a2x-s96`), Xgc14 (`xgc14-bgra8`) and X
|
||||
| An attachment (not memoryless) that a pass loads `DontCare` and does not store, in a pass whose draws reach a tile, is cleared over the render area (`clear_reach.rs`) on a driver measured to run that clear no slower than its `DONT_CARE` load (`DriverFact::UnstoredClearNoSlower`: MoltenVK on the M3 Max, RADV on the Radeon 780M), and left `DONT_CARE` on every other driver; an aspect of separate depth and stencil textures likewise, each aspect apart, in the scratch image of the combined format the pass renders them through (`depth_stencil_scratch.rs`). Metal's draws read zero (a colour) or the pass's clear value (depth, stencil) of such an attachment wherever they read it, never its earlier texels (an M3 Max under macOS 27.0.1: an `RG16Float` second colour a framebuffer fetch reads and a `Stencil8` a stencil test reads, in passes split and whole; a separate `Depth32Float` and `Stencil8` read by a depth and a stencil test, each aspect so loaded alone or both; `runtime_lane::dont_care_unstored`); Vulkan's `DONT_CARE` load leaves the contents undefined. | `unstored_dont_care_loads = UnstoredDontCarePolicy::Driver` | `unstored_dont_care_loads = UnstoredDontCarePolicy::Cleared`: cleared on every device, by the pass's first render pass instance's load operation, or before the pass where that instance leaves the attachment out (separate depth and stencil textures: by the scratch image's load operation of the aspect); Metal's answer wherever a draw reads it | On a driver without the fact, the draws read what its `DONT_CARE` load leaves (lavapipe: the attachment's earlier texels). An image the runtime makes to stand for an attachment (the scratch image of separate depth and stencil textures, a stand-in, a backing: `Device::new_planned_texture`) starts at zero on such a driver, never as its memory lies, which may hold a released texture's texels: a clear as it is made. `DontCareUnstoredLoad` (`dont-care-unstored-load`), once per device; `runtime_lane::dont_care_unstored` (both values: Metal's answer under `Cleared` and on a driver with the fact, lavapipe's earlier texels under `Driver`; separate depth and stencil textures alike, but what lavapipe's `DONT_CARE` leaves in the scratch image is printed, not checked) | Measured, `CLEAR` against `DONT_CARE`, the GPU's span per pass, medians of 15 frames in each of two rounds, eight 3648x2038 passes a frame (a `BGRA8Unorm` colour loaded and stored, an `RG16Float` colour and a `Depth32Float_Stencil8` loaded by the form and stored `DontCare`, one draw over the whole target writing all three; a probe whose runtime still left such a load `DONT_CARE`, without the validation layer): lavapipe (Mesa 26.2.6, llvmpipe on LLVM 23.1.4) 10480 and 10744 µs against 7280 and 7259, 3.2 to 3.5 ms more, its clear a write of every texel; ANV (Mesa 26.2.6) on the Iris Xe (RPL-P) 1936 and 1936 µs against 1907 and 1151, slower in both rounds; RADV (Mesa 26.2.6) on the Radeon 780M 861 and 865 µs against 1147 and 988, faster; MoltenVK 1.4.2 on the M3 Max 218 and 218 µs against 224 and 217, apart by less than one form's two rounds; NVIDIA's 615.71.09 on the RTX 5080 Laptop GPU 74.4 and 74.6 µs against 71.2 and 71.4, 3.2 µs more. Memory: none |
|
||||
| A linear sample of a two-plane YCbCr texture whose planes a function reads in place (`YCBCR8_420_2P`, `YCBCR10_420_2P` through a uniform texel buffer over their codes, on an integrated GPU or a CPU device; `lower::sampler::in_place`), through a sampler that addresses no border on either plane axis, with no texel offset placed by a parent's size, is Vulkan's Y′CbCr model of the codes, as the device's own conversion with a linear chroma filter computes it: the four luma codes around the point and the four chroma pairs around the same point of the chroma plane (Metal's midpoint siting) blended bilinearly, then the surface's range and matrix (Metal's coefficients) in `float`, each channel clamped into `[0, 1]`: eight fetches. A runtime sampler's word decides as the function runs. A nearest sample, a border mode, a parent-placed offset and a gather are Metal's under either value. | `ycbcr_in_place_reads = YCbCrInPlacePolicy::Model` | `ycbcr_in_place_reads = YCbCrInPlacePolicy::Exact`: every tap Metal's texel (its chroma weighted 9/3/3/1 and rounded to a code, the fixed-point conversion), and the sample Metal's sum of the four taps' steps on the grid `2048`: twenty fetches and four conversions | The model reconstructs each channel at the point where Metal converts four taps and sums them: within the `float` arithmetic's rounding of the model (checked against an `f64` model on the CPU interpreter, `engine_ycbcr_in_place`), it differs from Metal's by the chroma the taps reconstruct, by Metal's roundings to a code and to `1/2048`, and where a tap's channel leaves `[0, 1]`, which Metal clamps before it sums. `HalfSampleFilter` / `FloatSampleFilter` under the bound converted 4:2:0 format, announced `ycbcr-filter-not-exact` | Radeon 780M (RADV): a 3840 x 2160 `YCBCR10_420_2P` frame sampled linearly into a 3840 x 2160 `BGRA8Unorm` target, GPU time per frame (median of 60): 6.4-6.9 ms under the exact form (`runtime_lane::video_frames`) |
|
||||
| A vertex buffer layout a draw fetches in fixed function, on a driver whose fixed-function vertex input takes an element's displacement modulo `2^32` (`RuntimeDriverDefect::VertexFetchWrapsPast4GiB`: lavapipe), where the draw's indices (`uint` indices, a per-vertex layout) or its indirect arguments (any layout but a constant one) state how far it fetches: the layout keeps the fixed-function fetch, so an element `2^32` bytes or more past the buffer's bind offset reads the bytes at its displacement's low 32 bits, where Metal reads zero past a buffer that ends before them (`render/vertex_reach.rs`). A layout whose reach the draw's own values bound (its last vertex without indices, `65535` plus its base vertex with `ushort` indices, its base instance plus its last instance over the step rate) is pulled where that reach passes `2^32`, under either value, and reads zero. Other drivers read zero (RADV on the 780M, MoltenVK 1.4.2: `runtime_lane::far_vertex_fetches`). | `vertex_reach = VertexReachPolicy::Bounded` | `vertex_reach = VertexReachPolicy::Exact`: such a layout is pulled too, wherever its stride and furthest attribute could reach past `2^32` from the largest index or argument (on lavapipe, every `uint`-indexed draw's per-vertex layout of a stride above 0, and every indirect draw's layout but a constant one), the plan's pulled-vertex-buffer variant (`WorkCounts::far_vertex_fetch_pulled_draws`) | Under `Bounded`, on lavapipe, an element of such a draw at or past `2^32` reads the wrapped bytes: the conformance case `vertex-fetch-past-4gib-small-buffer` replayed under the default policy differs in 8 elements (its two far `uint`-indexed draws at stride 4), and passes under `Exact`. `VertexFetchMayWrap` (`vertex-fetch-may-wrap`), once per device, for a draw left so; `runtime_lane::far_vertex_fetches` (both values) | Measured on lavapipe (Mesa 26.2.4, LLVM 23.1.1) on a Core Ultra 9 275HX shared with other jobs (`runtime_lane::far_vertex_fetches::far_reach_costs`): a state drawn without indices and then with `uint` indices makes one pipeline under `Bounded` and two under `Exact`, the pulled variant made at the first `uint`-indexed draw; a pass of one draw of 65,536 `uint`-indexed points, from the encoder's making to the wait's return, takes 2.3 to 2.8 times as long pulled (medians of 20 passes: 0.94 against 2.41 ms beside two builds, 3.5 to 4.8 against 9.7 to 12.0 ms at a load average of 59 on 24 threads). On every other driver neither value changes a draw |
|
||||
| A draw of triangles in a rasterization-rate-mapped pass that a host step records (an execution whose records the GPU writes or whose range a buffer holds), filled, of one amplification, without a compensation or a band, whose pipeline chooses no slice or viewport and writes no memory from its vertex function, over a map whose layers are alike and whose plan is a grid of at most 128 columns and rows, on a device that enables `geometryShader`, `shaderClipDistance` and `vertexPipelineStoresAndAtomics`, is drawn once and fanned out to the regions its triangles touch (`rate_mapped_pass.rs`, **Fan-out**): its variant's geometry stage emits a copy of each triangle for each region it touches, at most the copies the device's `maxGeometryTotalOutputComponents` allows up to 16, through one viewport over the render area, four clip distances keeping each copy to its region's pixels, where Metal shades each region through its own viewport. A probe recorded before the pass, submitted and waited for, flags a draw a triangle of which crosses `w = 0` or touches more regions than the copies, with the first and the last such triangle: a flagged list of triangles of one instance whose pipeline reads no `[[primitive_id]]` and writes no memory is drawn in parts in its place, its runs of blocks of 64 triangles that hold a flagged one region by region (the probe sets each flagged triangle's block's bit, `bind::fan_out::BLOCK_TRIANGLES`), each run only into the regions its blocks' bounds reach (the probe raises in a block's word the buckets of segments, 16 an axis, that each of its triangles' widened bounds reach, a triangle crossing `w = 0` by its part where `w` is positive: its vertices of positive `w`, unbounded on each side an edge crosses `w = 0`, a subgroup's triangles raising each word once where the device runs subgroup operations in the geometry stage, else each triangle its own; `bind::fan_out::PROBE_BOUNDS_AT`), cut to the first and the last flagged triangle, runs fewer than 170 triangles apart joined (`rate_mapped_pass::RUN_GAP`, what a region draw costs beyond its vertices) and at most four a draw, the nearest joined first, and the triangles before, between and after them fanned out (`render/fan_out.rs`, **Parts**), and another flagged draw region by region; a direct draw to fan out, or a flagged draw's part, whose region draws into the boxes its triangles reach by the probe's bounds hold no more work than its triangles' geometry stage is boxed instead, drawn through its region-copy variant into those boxes (`render/fan_out.rs`, **Boxed draws**: the boxes' regions times its vertices and 512 a region draw against 180 a triangle, `rate_mapped_pass::GEOMETRY_TRIANGLE_WORK`, about half the least a fanned-out triangle cost on the four devices measured); and marks a draw a triangle of which it does not flag touches more than four (`bind::fan_out::FEW_COPIES`): a draw it marks none of, and a flagged draw's parts fanned out, is drawn through the variant of four copies, whose geometry stage declares the output of fewer vertices, the three variants (the probe's, four copies and the most) begun at `commit`; it stops at a command's barrier and after a draw that writes memory. On such a device that also enables `shaderOutputViewportIndex` and `shaderDrawParameters`, every other draw of the pass the variant takes (the encoder's own, the commands `commit` records, those the probe does not probe or whose step does not probe, a flagged draw's runs and a flagged draw drawn whole) is drawn region by region through its region-copy variant (`render/fan_out.rs`, **Region-copy variant**): no geometry stage, its vertex function putting each vertex in its region by the instructions that put a fanned-out copy's (`pipeline::link::fan_out::region_copy`), decorated `NoContraction`, its `Position` and `ClipDistance` `Invariant` (no rounding mode is forced), over boxes of the table's regions (a run's the boxes its bounds reach, any other draw's the whole table), a recording per region or, for a direct draw on a device with the multi-draw commands, per as many regions of a box as one `vkCmdDrawMultiEXT` takes (one below `maxMultiDrawCount`), its rows in order, each pushing its box's first region and columns (`PushField::RegionBox`), the recording setting one viewport, the fan-out's over the render area, which the vertex function stores 0 as `ViewportIndex` to select, and its box's scissor, the union of its regions' (`bind::fan_out::scissors`): the four clip distances keep each copy to its region, and a border between two regions of a recording holds no sample where the device samples at Vulkan's standard locations at up to 8 samples or the pass's own positions put none on a pixel's edge across it, the box else recorded a column or a row at a time (`render/fan_out.rs`, `folds`; `tests::rate_mapped_region_boxes` compares a box's recordings with one region's each, texel for texel, additively blended and under an `Equal` pass), so every route of the paLine truncated
|
||||
| A draw of triangles in a rasterization-rate-mapped pass that a host step records (an execution whose records the GPU writes or whose range a buffer holds), filled, of one amplification, without a compensation or a band, whose pipeline chooses no slice or viewport and writes no memory from its vertex function, over a map whose layers are alike and whose plan is a grid of at most 128 columns and rows, on a device that enables `geometryShader`, `shaderClipDistance` and `vertexPipelineStoresAndAtomics`, is drawn once and fanned out to the regions its triangles touch (`rate_mapped_pass.rs`, **Fan-out**): its variant's geometry stage emits a copy of each triangle for each region it touches, at most the copies the device's `maxGeometryTotalOutputComponents` allows up to 16, through one viewport over the render area, four clip distances keeping each copy to its region's pixels, where Metal shades each region through its own viewport. A probe recorded before the pass, submitted and waited for, flags a draw a triangle of which crosses `w = 0` or touches more regions than the copies, with the first and the last such triangle: a flagged list of triangles of one instance whose pipeline reads no `[[primitive_id]]` and writes no memory is drawn in parts in its place, its runs of blocks of 64 triangles that hold a flagged one region by region (the probe sets each flagged triangle's block's bit, `bind::fan_out::BLOCK_TRIANGLES`), each run only into the regions its blocks' bounds reach (the probe raises in a block's word the buckets of segments, 16 an axis, that each of its triangles' widened bounds reach, a triangle crossing `w = 0` by its part where `w` is positive: its vertices of positive `w`, unbounded on each side an edge crosses `w = 0`, a subgroup's triangles raising each word once where the device runs subgroup operations in the geometry stage, else each triangle its own; `bind::fan_out::PROBE_BOUNDS_AT`), cut to the first and the last flagged triangle, runs fewer than 170 triangles apart joined (`rate_mapped_pass::RUN_GAP`, what a region draw costs beyond its vertices) and at most four a draw, the nearest joined first, and the triangles before, between and after them fanned out (`render/fan_out.rs`, **Parts**), and another flagged draw region by region; a direct draw to fan out, or a flagged draw's part, whose region draws into the boxes its triangles reach by the probe's bounds hold no more work than its triangles' geometry stage is boxed instead, drawn through its region-copy variant into those boxes (`render/fan_out.rs`, **Boxed draws**: the boxes' regions times its vertices and 512 a region draw against 24 a triangle, `rate_mapped_pass::GEOMETRY_TRIANGLE_WORK`, the least a fanned-out triangle's geometry cost of a boxed vertex-region on the three devices measured, on a frame of small triangles whose fragments cost little (`rate_mapped_pieces_host_step_patches`, warm, two rounds, the pass's piece): an Iris Xe's (Mesa 26.2.6) 15.4 ns a triangle against 0.59 ns and 0.58 ns, 26 and 27 times; a Radeon 780M's (Mesa 26.2.6) 21.5 ns against 0.87 ns, 25 times; an RTX 3090's (NVIDIA 620.70.06) 9.3 ns against 0.19 ns, 49 times; the lane's 61 draws boxed at 180 took their pieces from 4.64 ms to 9.21 ms, 6.47 ms to 13.57 ms and 2.80 ms to 3.01 ms); and marks a draw a triangle of which it does not flag touches more than four (`bind::fan_out::FEW_COPIES`): a draw it marks none of, and a flagged draw's parts fanned out, is drawn through the variant of four copies, whose geometry stage declares the output of fewer vertices, the three variants (the probe's, four copies and the most) begun at `commit`; it stops at a command's barrier and after a draw that writes memory. On such a device that also enables `shaderOutputViewportIndex` and `shaderDrawParameters`, every other draw of the pass the variant takes (the encoder's own, the commands `commit` records, those the probe does not probe or whose step does not probe, a flagged draw's runs and a flagged draw drawn whole) is drawn region by region through its region-copy variant (`render/fan_out.rs`, **Region-copy variant**): no geometry stage, its vertex function putting each vertex in its region by the instructions that put a fanned-out copy's (`pipeline::link::fan_out::region_copy`), decorated `NoContraction`, its `Position` and `ClipDistance` `Invariant` (no rounding mode is forced), over boxes of the table's regions (a run's the boxes its bounds reach, any other draw's the whole table), a recording per region or, for a direct draw on a device with the multi-draw commands, per as many regions of a box as one `vkCmdDrawMultiEXT` takes (one below `maxMultiDrawCount`), its rows in order, each pushing its box's first region and columns (`PushField::RegionBox`), the recording setting one viewport, the fan-out's over the render area, which the vertex function stores 0 as `ViewportIndex` to select, and its box's scissor, the union of its regions' (`bind::fan_out::scissors`): the four Line truncated
|
||||
| A `Managed` buffer's range that `did_modify_range` names, on a device without unified memory (two copies: the runtime's own host copy, or the caller's pages through their import, `managed.rs`, `managed_copy.rs`), is copied into the GPU's copy by the GPU as the submission of the next command buffer committed that uses the buffer runs, from the host copy as it holds the range then: no copy on the CPU and no staging (pages no import of their own maps are staged by the CPU at the commit under either value, but those a guest RAM's chunk imports hold all of, which the GPU copies from those imports: `WorkCounts::managed_bytes_copied_in_from_ram`, `managed_bytes_staged_in`). Macs differ on a CPU write of the range after the commit, before the GPU runs the command buffer: an AMD Radeon Pro 5300M (two copies, macOS 26.7.1) read the bytes at the commit, an Intel UHD Graphics 630 (one copy) read the later write (steps A,B,B,A,B against A,B,B,B,B; `runtime_lane::device_copies`), so the cheaper answer is the default. | `managed_copy_in = ManagedCopyInPolicy::AtSubmission` | `managed_copy_in = ManagedCopyInPolicy::AtCommit`: the commit takes the range as the host copy holds it then, by a CPU copy into staging buffers of host-cached system memory, freed once the submission that copies them in completed (at most 256 MiB staged ahead); a write after the commit reaches no command buffer committed before it, the 5300M's answer | A CPU write after the commit, before the GPU runs the command buffer, may be read. No notice: both answers are a Mac's. `tests::managed_copy_device`'s `ranges_named_*` (the default: each round reads its own bytes or those written after its commit, never an earlier round's; `AtCommit`: its own alone) and `runtime_lane::device_copies`'s `a_did_modify_range_reaches_the_bytes_the_next_commit_finds` (step 4 reads either answer) and `exact_answers_take_a_did_modify_range_at_the_commit` (step 4 reads the bytes at the commit) | A CPU copy of each range at the commit into system memory, which the commit waits for. `tests::managed_copy_device::managed_copy_in_bench` (`MANAGED-COPY-IN`, medians of 40 commits of 32 MiB each, two rounds, over the runtime's own buffer and the caller's pages): RTX 3090 (an eGPU, NVIDIA 620.70.06) `AtSubmission` commit 0.034 to 0.045 ms and 17.3 to 17.7 ms to the completion, `AtCommit` 1.8 to 2.9 ms and 19.2 to 20.2 ms; RX 7900 XTX (RADV, Mesa 26.2.6) `AtSubmission` 0.012 to 0.036 ms and 5.1 to 5.5 ms, `AtCommit` 1.9 to 2.2 ms and 7.1 to 7.5 ms. Memory: the staged ranges until their submission completed, in buffers the device parks and takes again |
|
||||
| An indirect command buffer's records, and the slots past them, on a device that imports host pointers and whose own check found that a held pointer import costs every submission (`submit_check.rs`'s import tax: RADV, ANV on i915), lie in pooled host-visible memory, as every other buffer of the runtime's own does there (`buffer.rs`'s `Device::records_take_own_pages`), not in pages of the runtime's own imported by their pointer and held for the buffer's life. On RADV such an import is an amdgpu userptr listed in every kernel submission (RADV lists every imported memory in each), whose every page the kernel gets again in each, and the kernel's compaction or `khugepaged` migrating one of its pages waits for every fence of the import, all the process's work in flight, while every submission of the process waits behind it or fails with `EAGAIN` and is made again at once. On every other device, and before the check answers, the records lie in the runtime's own pages under either value. | `indirect_records = IndirectRecordsPolicy::Untaxed` | `indirect_records = IndirectRecordsPolicy::Carried`: the records lie in the runtime's own pages wherever the device imports host pointers, whatever a held import costs, as before | A recovery of such a device loses the records with the `VkDevice` and writes them again as a new buffer's (its header, every command reset, its slots past them zero), where Metal keeps a buffer's records across its GPU's restart: as on a device that imports no host pointer and for records in device-local memory on a discrete GPU. The recovery's notice counts such buffers (`device-recovered`: "N indirect command buffers, M of them whose records were lost"). `tests::icb_records_policy` (records in pooled memory under the default where the tax is forced to hold, in the runtime's own pages under `Carried` and where it is forced to fail, and a recovery's carry `Lost` against `Kept`) | A held pointer import for each live indirect command buffer in every submission. Measured on a Radeon 780M (RADV, Mesa 26.2.6, Linux 7.3.3), a guest desktop beside a guest game whose indirect command buffers' records were the process's only pointer imports (3 buffers, 19.6 MB): 5 windows of 65 to 140 ms in 12 s in which the submission thread's every `amdgpu_cs_ioctl` waited in `mmu_interval_read_begin` or returned `EAGAIN` (373 of the run's 382 failed calls), behind `kcompactd`, `khugepaged` and the runtime's own block allocation compacting memory, each waiting in `amdgpu_hmm_invalidate_gfx` for the import's fences. The probe of `submit_check.rs`: 10.3 us more a submission for one 16 MiB pointer import on the 780M, 45.8 on the RX 550 |
|
||||
|
||||
|
||||
Reference in new issue
Block a user