Pathway: x86 macOS / Linux Vulkan. Probe only; no device code.
Four driven macos-13 boots of one binary put numbers on the three dials, and
one of them does not do what the probe was written to make it do.
dials duty draws/s gather regions/s
(sustained-animation probe, for scale) 0.83 26 800 427 000
layers=24&boxes=6 0.68 11 525 270 807
layers=16&boxes=6&verts=30000&tex=512 0.14 1 390 34 976
layers=8&boxes=6&verts=60000 0.11 1 017 26 592
**Any WebGL at all collapses the guest to ~1 000 draws a second at duty 0.11.**
The device is then idle seven eighths of the time and the boot measures
Safari's WebGL path rather than this device — the exact failure the probe
exists to avoid, one layer further out. The dial is kept and documented as not
usable for ranking, because the collapse is worth being able to reproduce in
one command; it is not quietly left looking like a working axis.
Two fixes went in first, so the reading above is not measuring the page:
- the vertex array is built once and only re-uploaded. The first version
rewrote all `verts * 2` floats per frame, which at verts=90000 gave 1 329
draws/s at duty 0.12 — indistinguishable from the collapse above, and
caused by the page rather than the guest. `bufferData` re-uploads the whole
array regardless, so eight mutated entries per frame keep the device
traffic and stop a browser eliding the call.
- the 2D canvas draws two fills rather than twenty-five, for the same reason:
the upload is `tex * tex` either way and the rest was guest paint time
bought at the device's expense.
`layers` is the axis that works, and its value is the *shape* rather than the
size: at 24 layers it drives 23.5 gather regions per draw against the sustained
probe's 15.8, so it is the heavier arm for anything about the guest buffer
gather despite the lower absolute draw rate. Nothing here beats the
sustained-animation probe for total device load, and the doc now says so.
Verification performed:
- the four driven macos-13 boots above, quiesced host, `bash -n` on the script
- each boot's dials are recorded in its own `load-url.txt`
Not verified: `tex` has not been measured on its own, and no rail but macos-13
has run this probe.
Co-Authored-By: Claude <noreply@anthropic.com>
208 lines
9.1 KiB
HTML
208 lines
9.1 KiB
HTML
<!doctype html>
|
|
<!--
|
|
A guest workload with a dial on each of this device's three big rails, served
|
|
from the HOST.
|
|
|
|
Why this exists, and why it is not just `anim.html` with more boxes.
|
|
`sustained-animation-probe` is a compositing load, and on a macos-13 rail it
|
|
has **saturated**: the guest produces ~26 800 draws a second and ~76 presented
|
|
frames whatever the device does underneath. Three consecutive device changes
|
|
measured against it — a 3.9 us/chain pipeline saving among them — moved
|
|
`draws_s` by less than 0.1 %, because the drain worker sits at duty 0.83 and
|
|
spends the time it saves waiting for guest work rather than doing more of it.
|
|
A probe a device cannot fall behind cannot rank a device change.
|
|
|
|
So this page is built to be *heavier per frame* rather than to ask for more
|
|
frames. The guest's frame rate is capped by its own display cadence and no
|
|
page can raise it; what a page can raise is what each of those frames costs.
|
|
|
|
Three axes, dialled independently by query string, because they land on three
|
|
different rails and a change that helps one can hurt another:
|
|
|
|
?layers=N N separately composited full-width bands. Each is a surface
|
|
the window server composites and this device writes back, so
|
|
this is the `store` / `render_writeback` rail — the one the
|
|
compute scatter serves.
|
|
|
|
?verts=K A WebGL canvas that re-uploads a K-vertex buffer every frame
|
|
and draws it. This is the **guest buffer gather** rail:
|
|
`buffer_guest_gather_bytes` and `buffer_guest_gather_regions`,
|
|
which on a compositing load is 5.8 GB/s over 427 000 transfer
|
|
regions a second and is the largest GPU cost left in the
|
|
device. A CSS load barely touches it; nothing else here does.
|
|
|
|
?tex=W A 2D canvas of W x W repainted every frame, so the guest
|
|
uploads fresh texture content — the sampled-image rail.
|
|
|
|
Defaults are the *light* end of each, so a caller always states the load it
|
|
asked for and a boot's URL is the record of what it measured.
|
|
|
|
Determinism, same rule as `anim.html` and for the same reason: every step is
|
|
per *frame* and nothing in the content reads the clock, so a slow boot and a
|
|
fast boot draw identical content per frame and differ only in how many frames
|
|
they get through. The on-screen counter is display only and is excluded from
|
|
the geometry.
|
|
-->
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<title>reims-vgpu gpu load</title>
|
|
<style>
|
|
html, body { margin: 0; padding: 0; background: #08080c; overflow: hidden; }
|
|
/* Promotion is forced, not hinted — `will-change` alone is advisory and the
|
|
compositor declines it often enough to split boots of one binary into two
|
|
clusters with a 24 % present-rate gap. `backface-visibility` here plus the
|
|
3D transform the tick applies take it out of the compositor's discretion.
|
|
This rule cannot carry a `transform`: the tick overwrites the inline one
|
|
every frame. See `sustained-animation-probe/anim.html`, which found this. */
|
|
.band {
|
|
position: absolute; left: 0; width: 100%;
|
|
will-change: transform;
|
|
backface-visibility: hidden;
|
|
}
|
|
.box { position: absolute; top: 6%; height: 88%; border-radius: 10px; }
|
|
#hud {
|
|
position: absolute; right: 10px; bottom: 6px; z-index: 20;
|
|
font: 14px -apple-system, Helvetica, sans-serif; color: #9f9;
|
|
}
|
|
#gl, #tex { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
|
|
#tex { opacity: 0.35; }
|
|
</style>
|
|
<body>
|
|
<canvas id="gl"></canvas>
|
|
<canvas id="tex"></canvas>
|
|
<div id="hud">warming up</div>
|
|
<script>
|
|
const P = new URLSearchParams(location.search);
|
|
const num = (k, d) => Math.max(0, parseInt(P.get(k) ?? d, 10) || 0);
|
|
const LAYERS = num('layers', 8);
|
|
const BOXES = num('boxes', 6);
|
|
const VERTS = num('verts', 0);
|
|
const TEX = num('tex', 0);
|
|
|
|
// ---------------------------------------------------------------- layers ----
|
|
// Each band is its own composited surface moving at its own rate, so no two
|
|
// frames repeat an earlier pair and the compositor cannot elide one.
|
|
const bands = [];
|
|
for (let b = 0; b < LAYERS; b++) {
|
|
const el = document.createElement('div');
|
|
el.className = 'band';
|
|
el.style.top = (b * (100 / Math.max(LAYERS, 1))) + '%';
|
|
el.style.height = (100 / Math.max(LAYERS, 1)) + '%';
|
|
for (let i = 0; i < BOXES; i++) {
|
|
const box = document.createElement('div');
|
|
box.className = 'box';
|
|
box.style.left = (i * 100 / Math.max(BOXES, 1)) + '%';
|
|
box.style.width = (80 / Math.max(BOXES, 1)) + '%';
|
|
box.style.background = `hsl(${(b * 37 + i * 11) % 360} 80% 55%)`;
|
|
el.appendChild(box);
|
|
}
|
|
document.body.appendChild(el);
|
|
bands.push(el);
|
|
}
|
|
|
|
// ------------------------------------------------------------------ webgl ---
|
|
// The point of this axis is the **buffer upload**, not the shading: a fresh
|
|
// `bufferData` every frame is what makes the guest hand this device a large
|
|
// buffer window it has to gather into device-local memory. The shader is
|
|
// deliberately trivial so the cost lands on the gather and not on fragments.
|
|
let gl = null, glBuf = null, glData = null, glCount = 0;
|
|
if (VERTS > 0) {
|
|
const c = document.getElementById('gl');
|
|
c.width = 1024; c.height = 768;
|
|
gl = c.getContext('webgl', { antialias: false, depth: false, alpha: false });
|
|
}
|
|
if (gl) {
|
|
const vs = gl.createShader(gl.VERTEX_SHADER);
|
|
gl.shaderSource(vs, 'attribute vec2 p;varying vec3 v;void main(){v=vec3(p*0.5+0.5,0.6);gl_Position=vec4(p,0.0,1.0);}');
|
|
gl.compileShader(vs);
|
|
const fs = gl.createShader(gl.FRAGMENT_SHADER);
|
|
gl.shaderSource(fs, 'precision mediump float;varying vec3 v;void main(){gl_FragColor=vec4(v,1.0);}');
|
|
gl.compileShader(fs);
|
|
const prog = gl.createProgram();
|
|
gl.attachShader(prog, vs); gl.attachShader(prog, fs); gl.linkProgram(prog);
|
|
gl.useProgram(prog);
|
|
glCount = VERTS - (VERTS % 3); // whole triangles only
|
|
// Built once. The per-frame cost has to be the upload and not the fill —
|
|
// see the tick, which explains what rebuilding it cost.
|
|
glData = new Float32Array(glCount * 2);
|
|
for (let i = 0; i < glCount; i++) {
|
|
glData[i * 2] = (((i * 7) % 2048) / 1024) - 1;
|
|
glData[i * 2 + 1] = (((i * 13) % 2048) / 1024) - 1;
|
|
}
|
|
glBuf = gl.createBuffer();
|
|
gl.bindBuffer(gl.ARRAY_BUFFER, glBuf);
|
|
const loc = gl.getAttribLocation(prog, 'p');
|
|
gl.enableVertexAttribArray(loc);
|
|
gl.vertexAttribPointer(loc, 2, gl.FLOAT, false, 0, 0);
|
|
gl.viewport(0, 0, 1024, 768);
|
|
} else {
|
|
const c = document.getElementById('gl');
|
|
if (c) c.style.display = 'none';
|
|
}
|
|
|
|
// -------------------------------------------------------------- texture -----
|
|
let tctx = null;
|
|
if (TEX > 0) {
|
|
const c = document.getElementById('tex');
|
|
c.width = TEX; c.height = TEX;
|
|
tctx = c.getContext('2d');
|
|
} else {
|
|
const c = document.getElementById('tex');
|
|
if (c) c.style.display = 'none';
|
|
}
|
|
|
|
// ----------------------------------------------------------------- tick -----
|
|
let frame = 0;
|
|
function tick() {
|
|
frame++;
|
|
// Bands. `translate3d` keeps the layer promoted; the per-band rate is a
|
|
// different integer per band so the set never repeats.
|
|
for (let b = 0; b < bands.length; b++) {
|
|
const x = ((frame * (b + 3)) % 400) - 200;
|
|
bands[b].style.transform = `translate3d(${x}px,0,0)`;
|
|
}
|
|
|
|
if (gl) {
|
|
// Hand the whole buffer over again every frame — that is this axis — but
|
|
// do **not** rebuild it in JavaScript first.
|
|
//
|
|
// The first version of this page rewrote all `glCount * 2` floats per
|
|
// frame. At verts=90000 that made the *guest* the bottleneck rather than
|
|
// the device: a driven boot fell to 1 329 draws a second at drain duty
|
|
// 0.12, against 26 800 at 0.83 on the far lighter CSS-only probe. A probe
|
|
// that starves the device measures the guest's JavaScript engine, which is
|
|
// the exact failure it was written to fix, one layer further out.
|
|
//
|
|
// Mutating a few entries is enough: `bufferData` re-uploads the whole array
|
|
// regardless, so the device sees the same traffic, and the touched entries
|
|
// stop a browser from proving the contents constant and eliding the call.
|
|
for (let k = 0; k < 8; k++) {
|
|
const i = (frame * 7 + k * 251) % glCount;
|
|
glData[i * 2] = (((i * 13 + frame) % 2048) / 1024) - 1;
|
|
}
|
|
gl.bufferData(gl.ARRAY_BUFFER, glData, gl.DYNAMIC_DRAW);
|
|
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
gl.drawArrays(gl.TRIANGLES, 0, glCount);
|
|
}
|
|
|
|
if (tctx) {
|
|
// Two fills rather than the twenty-five the first version drew, for the
|
|
// reason above: the *upload* is the load on this axis and it is `TEX * TEX`
|
|
// either way, so anything more elaborate is guest paint time bought at the
|
|
// device's expense.
|
|
const s = TEX;
|
|
tctx.fillStyle = `hsl(${frame % 360} 60% 30%)`;
|
|
tctx.fillRect(0, 0, s, s);
|
|
tctx.fillStyle = `hsl(${(frame * 5) % 360} 85% 60%)`;
|
|
tctx.fillRect((frame * 3) % s, 0, s / 4, s);
|
|
}
|
|
|
|
if ((frame & 63) === 0) {
|
|
document.getElementById('hud').textContent =
|
|
`f=${frame} layers=${LAYERS}x${BOXES} verts=${glCount} tex=${TEX}`;
|
|
}
|
|
requestAnimationFrame(tick);
|
|
}
|
|
requestAnimationFrame(tick);
|
|
</script>
|