An Automatic heap's make asks the device for its texture's size first, a
call to the host, then makes the texture. To split the bloom chain's makes
into that query and the rest, the tool now asks the device's
heapTextureSizeAndAlignWithDescriptor: alone after its measured window, as
many times as the window's bloom makes, and adds their count, p50, p90 and
worst to the GAMELOAD calls line. Nothing in the window changes.
The heap shape makes 10 objects a frame (two stream slots and the 1 MiB
vertex buffer placed in the placement heap, the 7 bloom textures in the
frame's automatic heap) and lets 10 go. To tell whether the calls themselves
hold the frame's extra time or what they cause later does, the tool now
times each make in the measured frames, and prints a GAMELOAD calls line:
their count, p50, p90, the worst and their time a frame.
Releases happen where the last reference goes, most of them as a command
buffer that holds them completes, off the encoding thread. -r holds each
frame's heap objects until the frame FRAMES_IN_FLIGHT + 1 frames later
starts, after its command buffers completed, and releases them there one at
a time, each timed; the line then gives the same numbers for them, and how
many another reference still held. Without -r every object goes where it
went before, and every other output line is unchanged.
gameload made the ICB pass's pipeline (supportIndirectCommandBuffers on the
scene's variant 0) and its encode kernel's pipeline, and the compute ICB's
encode kernel and its supportIndirectCommandBuffers pipeline, whatever --off
said. So `--off icb,cicb` still made pipelines for indirect command buffers,
and a device that builds no ICBs refused the first one and the run ended.
Now each of those is made only when its shape is on, beside the ICB, its
argument buffer and the compute ICB's buffers, which already were. With both
on, the tool makes the same objects in the same order as before, and every
other shape's work and output lines are unchanged. The header says what --off
now leaves out.
A discrete GPU reads gameload's Shared buffers in system memory: the frame's
constants and the materials' argument buffers, which every vertex and fragment
reads, and the ICBs' argument buffers, which each encode thread reads. On the
RTX 3090 behind a Thunderbolt link, gameload's frame takes 46 ms of GPU time
against the RX 7900 XTX's 9.9 ms, and the link carries many small reads a
frame. --private frame,materials,args puts each in a Private buffer instead,
copied from its Shared one by a blit at the start of the frame (once where the
CPU writes it once), so a run with it measures what those reads cost.
G1, the host's replay of GPU-encoded indirect command buffers, has a compute
half that gameload's icb shape (draws only) never reaches. cicb is that shape:
a kernel encodes CICB_COMMANDS concurrent dispatches into a compute indirect
command buffer, every fifth reset, and a later compute encoder sets the
pipeline and its buffers at non-zero offsets and executes it. The commands
inherit the pipeline, and the encoder's buffers unless -b, where the kernel
sets each command's three buffers itself.
The dispatches sum their input into one word for each frame in flight, which
the CPU checks against its own sum as the frame slot comes back. A replay that
drops a command, a grid or an offset then fails the run (exit 1, cicb_bad)
instead of only running slower. -c sets the command count (512 by default),
which the frame constants carry in what was their pad word. The tools' README
names the new shape.
The perf ledger's AAA rows (heap shadows, format views, chunk imports, heap
compression, per-draw cost) each wait on a run that makes the load an AAA
Metal port makes, and none of our walks makes it. gameload is that load, our
own code: offscreen, a fixed number of frames, each frame's CPU, wait,
frame-to-frame and GPU times printed with their p50, p90 and mean, and the
measured window's start and end on the wall clock so a host's logs of the same
span can be cut to it.
A frame holds placement-heap streaming (slots made again at their offsets and
uploaded, BC7 where the device has it, a placed vertex buffer, transient
textures from an automatic heap made aliasable), render targets placed in a
heap, a 4x MSAA scene with depth resolved, composited through an sRGB view and
with a UI pass into a BGRA view, a GPU-encoded indirect command buffer, 4000
CPU draws and 1000 shadow draws over argument buffers, compute
post-processing and a blit stream with a read-back. Each of the eight shapes
turns off by name, so a run with one off measures its share; -b makes the
indirect command buffer inherit no buffers.
make -C guest/bundle/tools/gameload builds one universal binary (arm64 and
x86_64) for an Apple-silicon Mac, the Intel oracle and both guests. It has a
Makefile of its own because guest/bundle/Makefile is a source the prebuilt
guest sets record, and a target there would mean rebuilding both sets. The
tools' README gives the command lines the measured runs used.