Performance testing
EBGeometry keeps a third set of programs beside Examples/ (which show how to use the library) and
Tests/ (which check that it is correct): Performance/, which measures what it costs. Every pull
request is compared against its base branch with these programs, and its figures are carried in the
pull request.
What a pull request does
While it is a draft, after a change to the library or the probes, run a quick look at the probes the change can reach: one round, judged by nobody, for example
Scripts/run-performance.sh compare origin/<base> 'PointCloud*' --rounds 1.Once the code is final, run the full comparison against its base on the committed branch, with
--record(and with--gpu cudawhen it touches device code), and commit the receipt it writes,Performance/receipts/<branch>-<fingerprint>.md(see The performance receipt).Act on the verdict (see Reading the verdicts): a minor regression is explained or fixed, a major one fixed or explicitly accepted by the maintainer, and a changed answer explained.
Summarize the verdicts in the pull request’s Performance section, pointing to the receipt.
A new public structure or query comes with its cases (see Adding cases).
What is in Performance/
Performance/
PointCloud/main.cpp PointCloudBVH and PointCloudHashGrid
PointCloudBVHBuild/ PointCloudBVH's build and rebuild where its pool is
PointCloudHashGridBuild/ PointCloudHashGrid's build and rebuild where its pool is
SphereCloudBVH/main.cpp SphereCloudBVH: its build and rebuild, and the closest sphere
SphereContacts/main.cpp SphereCloudBVH's contacts between spheres
SphereCloudRays/main.cpp SphereCloudBVH's rays, alone, fused and in a tape
Mesh/main.cpp TriMeshSDF and MeshSDF
MeshIngest/main.cpp reading a mesh file into a soup, a DCEL mesh and triangles
MeshReconcile/main.cpp reconciling a moved DCEL mesh where its pool is
BVH/main.cpp PackedBVH::traverse() itself
BVHRefit/main.cpp refitting a PackedBVH where its pool is
BVHUnion/main.cpp BVHUnion
BVHUnionMixed/main.cpp BVHUnion of several types
Shapes/main.cpp the analytic shapes EllipsoidSDF to WedgeSDF
Tape/main.cpp Tape's signed distance
TapeBVHUnion/main.cpp a Tape's union through a BVH on request
Fused/main.cpp fused compositions (Fused::)
Ray/main.cpp ray queries on meshes and compositions
RayCSG/main.cpp ray tracing a composition from its parts' spans
RayCrossing/main.cpp the first crossing without its normal (firstCrossing())
RayShell/main.cpp ray tracing a shell with a corner cut away
RayParticles/main.cpp particles colliding with a boundary
Render/main.cpp one frame of the renderer
MeshCSG/main.cpp a mesh in plain and smooth unions: rays and frames
MeshClosestPoint/main.cpp a mesh's closestPoint() and gradient()
ClosestPrimitive/main.cpp a tape's closestLeaf()
ClosestSurface/main.cpp a tape's closestSurface(), drilled into a collection
SurfaceParts/main.cpp parts and labels of a tape's surfaces, and firstSurface()
Regions/main.cpp a tape's regions, their functions, and a domain's labels
Domain/main.cpp a domain with many subdomains and surface groups
DomainObject/main.cpp a domain compiled on its own, against the whole object
ConnectedComponents/main.cpp the connected components of a model's regions
MeshTape/main.cpp a mesh in a tape and in a view of regions, against the mesh
QueryOrder/main.cpp queries in Morton order: the order, and queries run in it
EBGrid/main.cpp a mesh's distances at a grid's cell centers, as an EB generator asks
LaunchTuning/main.cpp GPU::transform()'s launch settings (device only)
Common/ the harness every probe includes (PerfHarness.hpp includes it all):
Format.hpp units, padding, terminal style, tables (shared with PerfCompare)
Statistics.hpp quantiles, summaries, the bootstrap interval (shared with PerfCompare)
Schema.hpp the JSON field names, writer and reader (shared with PerfCompare)
Environment.hpp the commit, compiler, SIMD level, CPU, host threads
Case.hpp one case: its name, timing and records
Inputs.hpp random points with named seeds, Morton order, the mesh files
Report.hpp the table on the terminal and the JSON lines
Suite.hpp the command line, which cases a build keeps, the run loop
Device.hpp device timing and the host/device pairs
Probe.hpp what the probes share: queries, checksums, agreement, timing helpers
Tools/PerfCompare.cpp compares two sets of results
Tools/BuildCost.cpp the compiler launcher that records what each compile costs
Tools/BuildCompare.cpp compares two builds' costs
RunPerformance.cmake the logic of Scripts/run-performance.sh
Compare.cmake builds two commits, runs both, reports
Receipt.cmake writes the performance receipt
CheckReceipt.cmake CI's check of the receipt
TestReceipt.cmake checks that the receipt writer keeps a report whole
TestBuildCost.cmake checks the build-cost tools
receipts/ the performance receipts, one per pull request
CMakeLists.txt
Each folder with a main.cpp is a probe: one program per component, holding many cases. A case is
named from general to specific, component/input/operation/precision/side, for example
PointCloudBVH/uniform/all1nn/double/host or MeshSDF/query-morton/float/hostdevice. A case sets up its
inputs untimed, runs the measured operation once to warm up and then a number of times, and reports:
the median time, its interquartile range, and, for queries, the time per item;
a checksum of its results, so that a change in speed is only compared for equal answers (a build or refit, whose result is a structure, checksums queries at 1,000 fixed points against what it built, untimed; the point clouds also record an exact hash of the points their queries found, since a sum of distances cannot show a different point at the same distance);
the bytes the structure occupies in its
Pool, where it has one (deterministic, so it needs no statistics);the parameters it used (branching factor, SIMD width, leaf and cell sizes, point count). Cases spell these out rather than inheriting
DefaultBranchingRatio,DefaultWidthor a constructor’s default arguments, so a change to a default changes which case measures it, not what an existing case means.
A build is timed the way a program builds its geometry once. Each probe fixes how memory is served at
its start (on glibc, with mallopt): every allocation comes from the heap, so a build’s temporaries
reuse memory freed earlier in the same build, as in a real program; and before every repetition,
untimed, the memory freed so far goes back to the system (malloc_trim), so that each repetition’s
pool starts on fresh pages and pays their page faults, as a first build’s does. Without this, glibc
decides by a size threshold, which it moves as the program runs, whether a repetition’s pool comes as
fresh pages or as memory already touched, so a pool slightly larger or smaller could change a
build’s time markedly with no change to the build itself. Each run records its allocation policy, and a
comparison shows each side’s beside its commit.
Inputs are fixed: every point set comes from the harness’s own generator with a fixed seed, so that
every platform and standard library draws the same points, and the mesh is armadillo.obj from the
common-3d-test-models submodule. A case whose input is missing, or that throws, is reported as
skipped; a comparison in which a case ran in the baseline but not in the candidate fails (see Reading
the verdicts).
Where the results go
Scripts/run-performance.sh prints a table per probe and saves every result as JSON lines in
build/performance/results/<date>-<commit>-<host|cuda|hip>.jsonl, one file per run. Each JSON line
holds every repetition’s time, the median, minimum and interquartile range, the checksum, pool bytes,
parameters and, for a paired case, the host/device figures; each probe’s first line describes the build
(commit, compiler, SIMD level, GPU backend, CPU). Results accumulate there until deleted.
A comparison keeps its working files under build/performance/compare/: base.jsonl and
head.jsonl (every run of every case, appended round by round), report.md (the comparison as
Markdown, the text a pull request carries), and the two source trees and builds, so a case can be rerun
by hand. The next comparison replaces them. With --record, the comparison also writes its
receipt into the source tree (see The performance receipt).
Host and device
A probe is a single source file that compiles for the host, for CUDA or for HIP, and which cases run depends on the build:
A host build runs the
hostcases, on one core (pinned): builds, refits, the batched queries and the per-point queries, vectorized for the host. These are the host’s numbers, and what a host comparison judges.A CUDA or HIP build runs only the
hostdevicepairs, and only with a visible GPU: every query that runs on a device, with the same inputs on both sides. Its host side is not what to read host times from (in a CUDA build it is not vectorized: with any host SIMD macro set, GCC’simmintrin.hpulls in headers thatnvcccannot parse), so host-only operations are left to the host build.
Queries are written as trivially copyable functors, as in the examples. In a pair, the inputs are
divided into chunks of as many consecutive points as the case’s block size (GPU::DefaultBlockSize
unless the case gives another, as LaunchTuning’s do): on the device each chunk is one block of threads (GPU::transform() over arrays already in device memory, so the device time is the
kernel’s alone), and on the host the chunks are shared among OpenMP threads, one on every hardware
thread but one, so that the device is compared with the whole CPU rather than one core.
(OMP_NUM_THREADS overrides the count. Hyperthreads make the heavier queries faster than one thread
per core; a thread on every hardware thread, though, leaves nothing for the GPU runtime and the
operating system, so the loop keeps losing whole scheduler ticks to a preempted thread, which is why
one hardware thread is left spare.) Each pair runs once with the points in Morton order (SFC::order<SFC::Morton>, the order
in which a caller querying a box of cells presents them, which keeps neighboring queries in the same
part of a tree) and, for external queries, once in random order. Besides the device time, a pair records
host_ms,host_threadsandhost_over_device: the host’s time, its thread count, and the device’s speedup over the host (host time / device time) on this machine;max_diffandmismatches: how far apart the host and device answers are, and how many inputs they disagree on (a different sign, or a difference beyond a thousand ulps; for the point clouds, a squared distance beyond a thousand ulps, whichever points were found, since equal distances to different points are ties).
The speedup is machine-specific, so it means something on one machine, from one commit to the next: a
change that speeds up one side and slows down the other shows as a shift in it. In a CUDA build it is
measured against scalar host code; the host build’s host cases show what vectorization is worth on
one core, so against a vectorized host the device’s lead would be correspondingly smaller. In double a consumer GPU (whose
double precision runs at a small fraction of its single precision’s rate) is little faster than the CPU’s cores. OpenMP is on by default
for CUDA builds (EBGEOMETRY_PERF_OPENMP); a HIP build’s clang host side would need the LLVM OpenMP
runtime, which is not tested, so it is off there unless turned on, and the host side then runs on one
thread. A HIP build compiles its host side with AVX2 and FMA (EBGEOMETRY_PERF_GPU_HOST_FLAGS).
Running the probes
Everything goes through one script, run from the repository root. It needs only CMake, git and a C++
compiler (nvcc or hipcc for a GPU); its logic is Performance/RunPerformance.cmake, and
--help lists every option.
Scripts/run-performance.sh # build if needed, run every host case
Scripts/run-performance.sh 'PointCloudBVH/*' # a subset: one or more globs (* and ?)
Scripts/run-performance.sh '*/double/*' --reps 10 # every double case, 10 repetitions
Scripts/run-performance.sh list 'Mesh*' # the case names
Scripts/run-performance.sh --smoke # every case at tiny sizes: checks they run
Scripts/run-performance.sh --gpu cuda --gpu-arch 86 --cuda-compiler /path/to/nvcc # the pairs
Scripts/run-performance.sh --gpu cuda 'TriMeshSDF/*'
The probes are built in Release for the host’s full instruction set, with every function aligned to a cache
line under GCC and Clang (Performance/AlignFunctions.cmake), incrementally, in
build/performance/<host|cuda|hip>/; each probe with a selected case then runs in a process of its own.
A host run is pinned to one core when taskset is available; a GPU run is not, since its host side
uses every hardware thread but one (--core <n> or --no-pin changes a host run’s pinning; a GPU run refuses --core, since pinned to one core its host side would run on one thread). The output is one table per probe,
grouped by component and input. A host build shows each case’s number of items (for queries), median,
spread, time per item and pool bytes (the figures in these samples are made up):
EBGeometry performance · git c2f2cdb · gcc 13.3.0 · GPU none · host: 1 thread, SIMD avx2
times are medians of 3 repetitions; spread = interquartile range / median
━━ Mesh ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3 cases ━━
operation precision items median spread per item pool
MeshSDF
build float 110 ms 1.6% 21.0 MB
refit float 69.9 ms 19.3%
query float 100,000 891 ms 0.8% 8.91 µs 21.0 MB
A GPU build shows, for each pair, the number of inputs, the host’s and the device’s time per item (so pairs of different sizes compare; the totals are in the JSON), the device’s speedup, the device’s spread and whether the answers agree (made-up figures again):
EBGeometry performance · git c2f2cdb · gcc 13.3.0 · GPU CUDA · host: 23 threads, SIMD none (nvcc cannot compile host SIMD code)
host and device run the same inputs; times per item are medians of 3 repetitions; device spread = the device's interquartile range / median
━━ Mesh ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2 cases ━━
operation precision items host/item device/item speedup device spread answers
TriMeshSDF · w4
query-morton float 262,144 382 ns 23.0 ns 16.6x 5.6% agree
query-random float 262,144 497 ns 42.3 ns 11.8x 1.4% agree
The facts every probe shares (the commit, compiler, GPU backend, host threads and SIMD level, and how to
read the columns) are printed once per run; each probe is then a rule with its name and number of cases,
its column header and its groups. In a terminal, probe and group names are bold, the banner and column
headers dimmed and host/device disagreements red; piped or redirected output, or NO_COLOR set, gives
plain text.
CMake takes the nvcc on the PATH (or CUDACXX) unless --cuda-compiler names one. CUDA
12.0’s nvcc cannot compile the library (it rejects a braced argument list in
EBGeometry_TapeImplem.hpp); pass a newer one, and the script reconfigures when the compiler changes.
Under the script, each probe is an ordinary program (build/performance/host/bin/<Probe>.ex) taking
--list, --case <glob>, --reps <n>, --smoke, --json (JSON
instead of the table) and --json-out <file> (the table, and the JSON appended to a file). The perf
and perf-cuda CMake presets build the same probes inside the project, which is what ctest --preset
perf and CI’s smoke run use. That ctest run also checks the receipt writer (PerfReceipt,
Performance/TestReceipt.cmake): a yellow or red report, semicolons and all, is written whole.
Comparing two commits
Scripts/run-performance.sh compare # the working tree against the default baseline
Scripts/run-performance.sh compare origin/<base> my-branch # two commits
Scripts/run-performance.sh compare origin/<base> 'PointCloudBVH/*' --rounds 10
Scripts/run-performance.sh compare origin/<base> 'PointCloud*' --rounds 1 # times only, while developing
Scripts/run-performance.sh compare origin/<base> --gpu cuda --gpu-arch 86 --cuda-compiler /path/to/nvcc
Scripts/run-performance.sh compare origin/<base> --smoke # a quick check, about a minute
Scripts/run-performance.sh compare origin/<base> --gpu cuda --test-builds # also the heaviest tests' builds
Scripts/run-performance.sh compare origin/<base> --no-skip # also probes whose code is unchanged
Scripts/run-performance.sh compare origin/<base> --no-cache # build both sides afresh
Here <base> is the branch the pull request targets. The first two arguments that git resolves to
commits are the baseline (by default, the branch pull requests merge into) and the
candidate (default: the working tree, uncommitted changes included); anything else is a glob. Each side
is exported with git archive and built from its own Performance/ folder, so a pull request that
changes an API the probes use updates the probes and is still compared case by case; the report names
any probe that differs between the sides. (A baseline from before Performance/ existed is measured
with the candidate’s probes.) Both sides are built with the candidate’s function alignment, so that code
added anywhere in a probe cannot change the time of unchanged code by moving it across a cache line.
A probe that compiles to the same code on both sides can only measure noise, so its cases are not run,
and the report lists the probe as not run; a pull request that changes one component then runs only the
probes that component reaches. --no-skip runs them anyway, and a smoke comparison always runs every
case. When no probe changed, nothing runs and the verdict is green. A side whose code, compilers and
settings match one of the last few comparisons’ is not built again: its programs and build costs are
taken from build/performance/cache (the baseline, until the base branch’s code moves on, and both
sides when a receipt is recorded again after a change to the documentation only). --no-cache builds
both sides afresh.
Every case then runs in a fresh process, so that one case cannot leave the heap or the caches in a state
that favors the next, alternating between the two sides for --rounds
rounds (default 2) of --reps repetitions (default 3). These defaults are the least that gives a
verdict, and keep a comparison of every case to about eight minutes on a desktop, builds included; one
round (--rounds 1) shows the times without judging them, a quick look while a change is developed. A host comparison compares the host cases,
pinned to one core; with --gpu it compares the pairs, by their device time (each with its speedup
beside it), unpinned. The comparison itself is Performance/Compare.cmake,
whose variables (listed at its top) also set the thresholds.
The report is printed to the terminal and written to build/performance/compare/report.md, followed by
the command that repeats the comparison and those that rerun a single case by hand (with made-up
figures here):
Performance comparison: 0 major, 0 minor, 0 faster, 0 differ, 0 lost, 2 cases
base 000723d (gcc 13.3.0, simd avx2, gpu host)
head 646c1f1 (gcc 13.3.0, simd avx2, gpu host)
thresholds: minor >= 3%, major >= 10% slower, and outside the 95% bootstrap interval over the runs
case base head change 95% interval pool verdict note
PointCloudBVH/uniform/build/double/host 89.5 ms 89.9 ms +0.5% [-8.6%, +9.8%] +0.0% ~
PointCloudBVH/uniform/closest-random/double/host 93.7 ms 100 ms +7.0% [-7.1%, +10.2%] - ~
Nothing flagged.
A smoke comparison (--smoke) is a check, not a measurement: one round of one repetition at the
--smoke sizes, in about a minute, most of it building. It reports, for every case, whether it ran on
each side, whether the two sides’ checksums match and, for a pair, whether the host and device answers
agree, and judges no timings: one repetition of microseconds of work is mostly start-up and kernel
launch overhead, runs with everything in cache and trees of one leaf, and has no spread to tell a change
from noise. Its times are shown for information only, with a note when a case’s time changes more than
tenfold (a case that hangs or degenerates). It fails if a case crashed, is missing or was skipped on one side, or if a
pair’s answers differ; a checksum that changed between the commits is reported but does not fail it,
since a change to a kernel may change a result’s last bits. Run it before a long comparison, or after
changing the probes themselves.
Reading the verdicts
Every comparison ends with one line that answers whether there is a regression, colored in a terminal,
and report.md starts with the same line:
VERDICT: no regression (0 major, 0 minor across 88 cases) (green)
VERDICT: 2 minor regressions; look at them before accepting (see Flagged above) (yellow)
VERDICT: MAJOR regression in 1 case; do not merge until it is fixed or accepted (see Flagged above) (red)
VERDICT (smoke): passed; all 88 cases ran on both sides with the same answers (green)
A red verdict (a major regression, host and device answers that differ, a run that crashed, or a case
that ran in the baseline but not in the candidate; for a smoke comparison, a case that failed or is
missing on either side) also makes the script exit with status 2. A comparison that cannot reach a verdict at all (PerfCompare reports
a usage error or an unreadable results file, or crashes) fails too, with a non-zero status of its own;
it never ends green. The per-case verdicts behind it work as follows.
Each run of a case is a fresh process that times several repetitions. The repetitions of one process
share its luck (where its memory landed, the clock speed, what else ran on the machine), so they are not
independent measurements, and the noise that matters is the one between processes. PerfCompare
therefore reduces each run to the median of its repetitions and works with those: for each case it takes
the median over each side’s runs, their ratio, and a bootstrap 95% confidence interval for the ratio,
resampling the runs. A change counts only when the interval excludes no change at all, and is only
judged with at least two runs on each side. With the default two rounds, that means a change is
flagged only when both of the candidate’s runs are slower than both of the baseline’s: a coarse
screen. So every case flagged minor or MAJOR after them runs --confirm-rounds more rounds (default
8), and is judged on all of them; the report lists the cases confirmed this way. A flag from one noisy
round then rarely survives, and one that does is a change. (The first rounds still decide which cases
get the second look: a change they miss is not looked at again.) --confirm-rounds 0 judges the first
rounds as they are. With one round, every time is shown and none is judged, and the verdict says so.
|
ran in the baseline, but was skipped or is missing in the candidate: a red flag |
|
a pair whose host and device answers disagree, a new one included: a red flag, and its times are not comparable |
|
at least 10% slower ( |
|
at least 3% slower ( |
|
at least 3% faster, and no more pool bytes |
|
within the thresholds, or within the noise |
A differing checksum, or a differing hash of the points found, is noted beside the verdict: the two
sides did not compute the same answers, so the times may not be comparable. It is flagged and makes the
verdict yellow (as in a smoke comparison), not red: a change to a kernel may legitimately change a
result’s last bits. Like any yellow verdict, it passes CI only once accepted in the receipt, with the
reason the answers changed (see The performance receipt). A case whose pool bytes shrink by 3% or more is noted as such (it is never a regression). A
paired case shows the device’s speedup over the host, with the baseline’s beside it when the two differ
by 3% or more. A case that names another with Case::relativeTo() (the same answers computed another
way, in any probe) shows that case’s time over its own (tape/fused, say), with the
baseline’s beside it when the two differ by 3% or more; it is noted, never judged. Flagged cases are
listed again under the table.
The cases of the interpreted Tape (the Tape probe, and the tape cases of the others) depend on how
the compiler lays out the evaluator, not only on the work it does. A change to the evaluator’s own code, even
to a clause these tapes never run or a new kind of clause, is a new draw of that layout: on the host, its
tape cases can move by several percent either way for that reason alone, and on a device, a kernel that
evaluates a tape can change its register count. Aligning loops and jumps does not prevent it, and Clang does
the same. So before reading a Tape verdict as a change’s cost, check whether the code a plain tape compiles
changed: compare the out-of-line evaluator functions of both sides’ PerfTape (nm -C -S) and the
ptxas figures of the tape kernels. Where neither changed, a moved Tape case is a real cost, or noise; where
the evaluator changed, a move of a few percent is expected, and a larger one, or one that the other tape
cases do not share, is worth a look before it is accepted. The measurements behind this are in the comments
of the tape’s header, Source/EBGeometry_Tape.hpp.
Build costs
A comparison also reports what each side cost to build, after the timings: a section Build costs, in the report and in the receipt. It reports and does not judge: its flags do not enter the verdict, and CI does not check them.
Every compile goes through Performance/Tools/BuildCost.cpp, set as CMake’s compiler launcher. It records
each compile’s CPU time (user and system time of the compiler and every process it ran) and peak memory,
and, for nvcc, the statistics ptxas prints for every kernel (-Xptxas -v, which changes no code):
registers, cumulative stack, and the bytes spilled to local memory. Performance/Tools/BuildCompare.cpp
then compares the two sides:
Per translation unit (a probe, or a test file): CPU time and peak memory, base against head, flagged
minorat 10% more andMAJORat 25% more (BUILD_MINORandBUILD_MAJORinCompare.cmake), if the growth is also at least 2 s or 100 MB, so that small units do not flag on noise; and the total.Per device kernel: every kernel whose registers, stack or spills differ, flagged when its registers change, its spills grow, or its stack grows by more than 10% and 256 bytes. More registers can cost occupancy, spills cost local-memory traffic, and a larger stack more local memory per thread.
CPU time rather than wall time, because the builds run in parallel; but a compile’s CPU time still depends
on the core it runs on. So on Linux the compiles run on one hardware thread of each core, pinned with
taskset (of each fast core, on a CPU with fast and slow cores), and two builds of the same code then
agree closely. As many compiles run at once as there are such cores, but no more than the memory holds
(--jobs sets the number). The section’s first line names the machine and how it compiled.
With --test-builds, a comparison also builds the heaviest test targets (TestRay*, TestTape* and
TestRender*) in Debug with assertions on, as a developer and CI’s device
lanes build them, and reports their costs in a second section. It takes several minutes more; run it for a
pull request that changes the tape or the rays.
The performance receipt
CI does not time anything: a shared runner is too noisy to judge performance, and has no GPU. What CI requires instead is that the comparison was run, locally, on the pull request’s own code, once the pull request is ready for review (a draft is not checked). The comparison’s result is committed with the pull request as its receipt:
Scripts/run-performance.sh compare origin/<base> --record # writes Performance/receipts/<branch>-<fingerprint>.md
git add -A Performance/receipts && git commit -m "Performance receipt"
The receipt is one file per pull request, Performance/receipts/<branch>-<fingerprint>.md: the branch it is
recorded on (so it is recorded on the pull request’s branch, checked out) and the start of the fingerprint
of the code it measured. Pull requests therefore never write the same receipt and never conflict over one.
Writing a receipt deletes the other receipts in the directory, those of pull requests merged before, so the
directory holds only the few merged since a receipt was last recorded, and git add -A commits the
deletions with the new receipt. Deleting them never conflicts either: only its own pull request writes a
receipt, and that one has merged, while two pull requests deleting the same receipt merge cleanly. CI
checks the one receipt a pull request adds or changes; a pull request that adds or changes two fails. A
receipt has a section per comparison: the host comparison,
which --record writes and CI requires, and, when the change touches device code, a device
comparison, which --record --gpu cuda (or hip) adds. Each section holds its verdict, the two
commits compared, the machine and the comparison’s table. --record refuses anything that could not
stand for the pull request: a smoke check, a subset of the cases (a glob), a working tree whose
library or probes have uncommitted changes, or a run in which a case was skipped on either side (it
checks for the common-3d-test-models submodule before building, since every mesh case needs it). Recording one section keeps the others only if they
measured the same code against the same base, and drops them otherwise, so the file never carries a
section that measured other code.
Each section names the code it measured by two fingerprints: hashes of git’s tree entries for what a
comparison measures, the library (Source/, EBGeometry.hpp) and the probes (Performance/,
except its README.md and the receipt). CI’s Performance-receipt job
(Performance/CheckReceipt.cmake) recomputes them for the pull request and for the base it is built on. It
requires the host section, checks every section present (a device section is optional, but once
recorded it must pass like the host one), and passes only when, for each,
the pull request’s code is the code the section measured. A receipt names the commit before the one that adds it, so a later commit that changes only documentation or CI keeps it valid, while any change to the library or the probes makes it stale. An old receipt never stands for new code: a pull request that changes code and keeps the receipt it inherited fails;
the base the pull request is built on (where it forked from the base branch) is the base the section measured. The base branch moving on (another pull request merged) leaves the receipt valid, since the pull request’s code is still built on what it measured; a rebase onto a base whose library or probes changed moves its base, and the comparison is recorded again;
the verdict is green, or a yellow or red verdict is accepted: the reason replaces the
-on the**Accepted:**line under that section’s heading (the reason may wrap over several lines, up to the next blank line) (a minor regression that is expected, answers that changed for a reason, a major regression the maintainer explicitly accepts), where a reader of the rendered receipt sees it. Every verdict is recorded; only green passes on its own, and CI’s check then shows a warning with the reason rather than a plain pass. Who accepted it is in git history: the commit that wrote the reason, and the account that pushed it.
A pull request that changes neither the library nor the probes needs no new receipt. Each merged pull
request’s receipt is in the base branch’s history, so git log -p -- Performance/receipts is the
performance history of the branch, one comparison per change. Device sections appear where a change
was measured on a GPU; regular device measurement is left to a future nightly run.
What a receipt proves is limited. Its fingerprints tie it to the code it names, so it cannot be
carried over to other code by mistake, and CI computes them from git, not from the receipt. CI cannot
check the figures themselves: the receipt records that its author ran the comparison and what it found,
and it is trusted the way a review is trusted to have been done. It makes the local comparison a
required, visible part of every change that needs one; it is not a proof that the numbers were measured.
The same holds for an acceptance: CI cannot tell who wrote the reason on an **Accepted:** line.
Git history records the commit that wrote it and the account that pushed it, which identifies an
outside contributor, but not whether an agent working under the maintainer’s account wrote it on the
maintainer’s say-so; that rests on the rule that an agent writes a reason only on the maintainer’s
explicit acceptance (CLAUDE.md).
Two pull requests built on the same base are each measured against that base, never with each other.
Once both have merged, the base branch holds a combination no receipt measured; a slowdown that comes
from the two together would then become the base every later comparison starts from. When that happens,
the combination is compared once against the shared base,
Scripts/run-performance.sh compare <shared base> origin/main, on a quiet machine, and judged like a
pull request’s comparison.
In continuous integration and in pull requests
Two jobs in .github/workflows/CI.yml cover Performance/:
Performance-smokebuilds the probes with warnings as errors and runs every case at its smoke size, on every push and pull request. The GPU lanes also compile the probes for their device.Performance-receiptchecks the pull request’s receipt, as above, and puts the result in the job summary. It builds and times nothing. On a draft pull request it only notes that the receipt is checked once the pull request is ready for review.
A minor regression is a question for the author and the reviewer: is it expected, and is it worth investigating? It, a changed checksum and a major regression are all merged only once fixed (and recorded again) or accepted in the receipt, the major one only by the maintainer’s explicit decision. The pull request’s Performance section shows the receipt’s table, and the device comparison when the change touches device code.
Adding cases
The probes cover each public structure where its cost lives: its build, its queries, and any update in place (a refit), in both precisions, on the host and, where the operation runs there, on the device. Some rules of thumb:
A new public structure or query, or a new device path for an existing one, comes with its cases in the same pull request: a new probe folder, or new cases in the probe of its component.
A case measures one operation on one input. Use the sizes users meet (hundreds of thousands of points or triangles), so that one repetition takes at least a few milliseconds, and give it a
--smokesize that runs in well under a second.Spell out every parameter that selects code (
K,W, the precision, the construction method) and record it withparam(); record a checksum that depends on every result, andpoolBytes()where there is a pool. A case that computes the same answers as another case by other means (fused and through a tape) names it withrelativeTo(), so that the comparison notes the ratio of their times.Prefer a new case to changing an existing one: a changed case cannot be compared with its old results (the report names the probe files that differ between the sides, not the cases).
Keep the whole set to about eight minutes for a comparison with its defaults on a desktop, builds included, so it is run. A case that duplicates another’s code path (the same kernel at another size) earns its place only if it has behaved differently.
The probes, one by one
This section is a reference: what each probe measures, case by case.
Every family below runs in float and double unless noted (the precision is the next-to-last
part of the name). A host build runs the host cases; a CUDA or HIP build runs only the
hostdevice pairs (the side is the last part of the name; see Host and device). A query’s
operation ends in the order its inputs are presented, -morton or -random (as drawn), on both
sides alike, so a host case and a pair with the same operation measure the same thing. Sizes are the
full ones; --smoke uses a few thousand points or the dodecahedron. Scripts/run-performance.sh
list prints the exact names.
PointCloud (Performance/PointCloud): PointCloudBVH (K = 4, W = 4) and PointCloudHashGrid,
each over 500,000 points, either uniform in the unit cube or on the unit-sphere surface.
Family |
Build |
Measures |
|---|---|---|
|
host |
building the structure; also its pool bytes |
|
host |
the batched k-nearest-neighbor graph
( |
|
host |
|
|
host |
|
|
GPU |
|
|
||
|
GPU |
|
|
GPU |
the 8 nearest points, per point |
|
PointCloudBVHBuild (Performance/PointCloudBVHBuild): PointCloudBVH’s build() and rebuild()
over the same 500,000 uniform points, at K = W = 4 and 64 points per leaf, with the same cases as
PointCloudHashGridBuild below: a rebuild on the host, and a build and a rebuild on the GPU against the
host’s. A BVH with room for a rebuild holds arrays sized for any cloud of its size, so the rebuild cases’ pool
bytes are larger than the one-off build’s.
PointCloudHashGridBuild (Performance/PointCloudHashGridBuild): PointCloudHashGrid’s build() and
rebuild() over the PointCloud probe’s 500,000 uniform points, at one point per cell. A rebuild alternates
between the points and the same points shifted and stretched, so that each finds a new box. The GPU cases compare
the two sides’ grids by their closest points at the build checks’ queries.
Family |
Build |
Measures |
|---|---|---|
|
host |
a rebuild in place, nothing reserved (the host’s
one-off build is PointCloud’s |
|
GPU |
a one-off build in device memory, from positions there, against the host’s build in host memory |
|
GPU |
a rebuild in place in device memory, against the host’s rebuild in host memory |
SphereCloudBVH (Performance/SphereCloudBVH): SphereCloudBVH (K = 4, W = 4, 64 spheres per leaf) over
500,000 polydisperse spheres, centers uniform in the unit cube and radii uniform in [0.002, 0.006]. A rebuild
alternates between the spheres and the same spheres moved and grown. The closest-sphere queries are drawn in and
around the cloud, some inside a sphere.
Family |
Build |
Measures |
|---|---|---|
|
host |
building the BVH; also its pool bytes |
|
host |
a rebuild in place, nothing reserved |
|
host |
|
|
GPU |
|
|
||
|
GPU |
a one-off build in device memory, from spheres there, against the host’s build in host memory |
|
GPU |
a rebuild in place in device memory, against the host’s rebuild in host memory |
SphereContacts (Performance/SphereContacts): the same 500,000 spheres and BVH as SphereCloudBVH. Each
query is one particle: its contacts within a gap of 0.004 (forEachContact), counted, and the force of those it
overlaps, summed. The particles are taken in Morton order of their centers, as a particle code keeps them.
Family |
Build |
Measures |
|---|---|---|
|
host |
every particle’s contacts and contact force |
|
GPU |
the same, one particle per thread, against the host on every hardware thread but one |
SphereCloudRays (Performance/SphereCloudRays): the same 500,000 spheres and BVH as SphereCloudBVH. Each
query is a ray from a random point in the unit cube, in a random direction (many start inside a sphere), and its
first crossing (firstHit): of the union of the spheres (polydisperse), and of a box with the spheres cut out
of it, fused (bed-in-box-fused, whose cases name the tape’s for the ratio of their times) and through a tape
holding the cloud (bed-in-box).
Family |
Build |
Measures |
|---|---|---|
|
host |
the first crossing of every ray |
|
GPU |
the same, one ray per thread, against the host on |
|
every hardware thread but one; the starts in Morton and in random order |
Shapes (Performance/Shapes): the analytic shapes EllipsoidSDF to WedgeSDF, one input each
(ellipsoid, capped-cone, round-cone, polygon-prism, tube, capped-torus, cut-sphere,
cut-hollow-sphere, wedge), queried at random points in the shape’s box grown by a quarter on every side; and
ray-forms, a fused union of the six with closed-form ray forms side by side, with rays from random points in the
scene’s box in random directions.
Family |
Build |
Measures |
|---|---|---|
|
host |
the shape’s signed distance at every point |
|
GPU |
the same, one point per thread, against the host on every hardware thread but one |
|
host |
the first crossing of every ray ( |
|
GPU |
the same, one ray per thread |
Mesh (Performance/Mesh): the armadillo, 99,976 triangles.
Family |
Build |
Measures |
|---|---|---|
|
host |
building a |
|
host |
signed distance at 100,000 random points in the mesh’s box grown 1.5 times, in the order drawn |
|
host |
the same at the host-tuned width 8 ( |
|
||
|
GPU |
signed distance at 262,144 such points |
|
||
|
host |
building a |
|
host |
10 refits of its BVH |
|
host |
as for |
|
GPU |
as for |
|
BVH (Performance/BVH): PackedBVH::traverse() itself. The BVH holds the boxes of the probe
mesh’s triangles (the armadillo, about 100,000; K = 4, four boxes per leaf, built bottom up), and the leaf
work is one box test per primitive, so the cases measure the walk: the query’s child test, the sort and
the stack. Queries start at random points in the BVH’s box grown to twice its size about its center; a
ray points at the center, so neighboring origins give side-by-side rays.
Case |
Build |
Measures |
|---|---|---|
|
host |
the nearest box each of 200,000 rays enters
( |
|
host |
whether each ray enters any box ( |
|
host |
the squared distance from each of 200,000 points to the
nearest box ( |
|
GPU |
the same at 262,144 queries, in Morton and in random |
|
order |
BVHRefit (Performance/BVHRefit): BVH::refit() of a BVH of 1,000,000 point ids (K = 4, four per
leaf, built bottom up), whose points are kept in the pool, uniform in the unit cube. A repetition is 10
refits, alternating between the points and the same points shifted and stretched. The GPU case compares
every node’s box on the two sides.
Case |
Build |
Measures |
|---|---|---|
|
host |
10 refits in a host pool ( |
|
GPU |
10 refits in device memory, a launch per tree level, against the host’s in host memory |
MeshIngest (Performance/MeshIngest): reading the armadillo’s OBJ file (49,990 vertices, 99,976
triangles), on the host. Each repetition reads the file afresh.
Case |
Build |
Measures |
|---|---|---|
|
host |
|
|
host |
|
|
host |
|
|
host |
|
MeshReconcile (Performance/MeshReconcile): reconciling the armadillo mesh after its vertices were
stretched. A repetition is 4 reconciles. reconcile-scheduled notes its time relative to reconcile.
The GPU case compares every vertex normal and face area on the two sides.
Case |
Build |
Measures |
|---|---|---|
|
host |
|
|
host |
|
|
GPU |
|
BVHUnion (Performance/BVHUnion): unions of about 100,000 objects on a 46 × 46 × 46 lattice, in
three families. The spheres (unit spheres, spacing 3) fill about half their boxes (\(\pi/6\)), and the
boxes do not overlap. The capsules-diagonal (length 3, radius 0.2, along (1, 1, 1), spacing 1.8) are
the worst case for an axis-aligned box: each fills about 5% of it, and every box overlaps its
neighbors’, so a query point lies in many leaf boxes. The cylinders-random (finite cylinders of the
same size and spacing, in directions drawn from a fixed seed) have a dearer distance than a capsule (two
flat caps) and a mix of fills, as in a geometry of fibers; neighbors intersect, which a union handles.
Family |
Build |
Measures |
|---|---|---|
|
host |
building the union’s BVH |
|
host |
signed distance at 200,000 random points in its box, in the order drawn |
|
GPU |
signed distance at 262,144 such points |
|
BVHUnionMixed (Performance/BVHUnionMixed): one union of the three types of BVHUnion at once,
about 100,000 objects on the same lattice, one type per point in turn (spheres of radius 0.8, diagonal
capsules and random cylinders, spacing 1.8), so that each leaf’s type is tested as it is evaluated. Its
cases are those of a BVHUnion family, as spheres-capsules-cylinders/build, /query-random and the
GPU pairs.
Tape (Performance/Tape): Tape::signedDistance() at random points around each object (its box
grown by a quarter on every side), against the same solid written by hand. The
sphere and chain16 cases take a gap between the two apart: a cost paid once per device thread
(signedDistance-x16 evaluates 16 times per query), and one paid per clause.
Family |
Build |
Measures |
|---|---|---|
|
host |
the classic CSG solid compiled into a |
|
host |
the same solid written by hand (the reference) |
|
host |
two smooth unions of spheres, smoothly cut by a box |
|
host |
a union of 64 spheres, through the tape’s BVH union |
|
host |
one sphere as a one-clause tape (and |
|
host |
the same, evaluated 16 times per query (per device thread) |
|
host |
a union of 16 spheres evaluated clause by clause (31
clauses, no BVH; and |
|
GPU |
each of the above at 1,048,576 points on both sides |
TapeBVHUnion (Performance/TapeBVHUnion): a tape’s union of 64 shapes under point maps (rotated boxes
and scaled spheres, each moved into place on a 4 × 4 × 4 lattice), maps64-bvh through a BVH asked for
with Accelerate::BVH, whose leaves evaluate the shapes directly, and maps64-as-written operand by
operand, which reports its time over the BVH’s. Each is a host case and a GPU pair, as in the Tape probe.
Fused (Performance/Fused): the Tape probe’s solids as fused compositions (Fused::, see
Fused composition), at the same points as the Tape probe’s cases, and a mesh drilled through by a
cylinder, fused and through a tape. They have a probe of their own, since cases added to a probe’s
translation unit can change how the compiler inlines that probe’s existing code, and so its timings. Each fused case names its tape counterpart (Tape/csg/... for Fused/csg/..., and
drilled-mesh-tape for drilled-mesh), and a comparison notes tape/fused beside it: the tape’s
time over the fused composition’s, on that side (see Where the results go). The ratio is what
interpreting the composition through a tape costs, and it is tracked from one pull request to the next.
Family |
Build |
Measures |
|---|---|---|
|
host |
the classic CSG solid, fused, at 400,000 points |
|
host |
the smooth solid, fused |
|
host |
the union of 16 spheres, fused |
|
host |
the armadillo ( |
|
GPU |
each of the above at 1,048,576 points on both sides (262,144 for the drilled mesh) |
Ray (Performance/Ray): the ray queries (see Ray queries). Rays start at random points
in the object’s box grown to twice its size about its center and point at the center, as in the BVH
probe. The mesh is the armadillo (TriMeshSDF, K = W = 4), ray traced exactly; its firstHit case
names the hand-written walk (traverse() with a RayQuery and the probe’s own leaf callback),
and a comparison notes hand/api beside it: what firstHit() costs over code a user writes. The
same mesh as a MeshSDF (K = 4, SAH, three faces per leaf) is traced through its polygon faces; its
firstHit case names the TriMeshSDF one and notes triangles/polygons. The
classic CSG solid is traced from its parts’ spans, fused and through a tape; the fused case notes
tape/fused. A host and a device crossing agree when both miss, or both cross within 1e-3.
Case |
Build |
Measures |
|---|---|---|
|
host |
the first crossing of each of 100,000 rays |
|
host |
the same from a hand-written walk |
|
host |
whether each ray crosses (the walk ending at the first crossing) |
|
host |
the same as a |
|
polygons |
|
|
host |
the first crossing of each of 50,000 rays with the CSG solid, fused, traced |
|
host |
the same through a |
|
GPU |
each of the above at 262,144 rays, in Morton and in |
|
random order |
RayCSG (Performance/RayCSG): ray tracing a composition from its parts’ spans (see
Compositions). The scene is 25 balls and 25 boxes in \([-1, 1]^3\), less 10 balls, from random
points; the rays start as in the Ray probe. It is fused and through a tape (whose union of 50 is a BVH
union), traced and marched (RayOptions::m_march); each traced case names its marched one and notes
marched/traced. A crowd of 4,096 small balls (radii 0.02 to 0.04) in the same cube, one BVH union
through a tape, is traced only: a hit there finds its ball among 4,096 operands. A host and a device
crossing agree as in the Ray probe, and also when the ray only grazes the surface: where a ray touches it
without going deeper inside than the march’s tolerance (a marched ray) or a rounding error (a traced one),
one side may round to a crossing and the other to a miss, and both answers are valid.
Case |
Build |
Measures |
|---|---|---|
|
host |
the first crossing of each of 50,000 rays, traced |
|
host |
the same, marched |
|
host |
the same through a |
|
||
|
host |
the first crossing of each of 50,000 rays with the crowd |
|
GPU |
each of the above at 262,144 rays, in Morton and in |
|
random order |
RayShell (Performance/RayShell): ray tracing a difference of a shell and a box, the shell traced from
the mesh’s offset faces (see Offsets and shells), or marched only within the box’s spans (see
Compositions): a shell (Annular) around the armadillo (a TriMeshSDF, the dodecahedron under --smoke), with a half-thickness of 0.5% of its box diagonal,
with the corner above its center in \(x\) and below it in \(z\) cut away by a box, as in
Shell extraction. The rays start in the shell’s box grown to twice its size and point at its
center. It is through a tape (with the mesh as a user primitive type), traced and marched, the traced case
naming the marched one, and fused. A host and a device crossing agree when both miss or both cross within
twice the march’s tolerance times the box diagonal; a ray grazing the shell may come within the tolerance
on one side only, and is counted as differing.
Case |
Build |
Measures |
|---|---|---|
|
host |
the first crossing of each of 20,000 rays, traced |
|
host |
the same, marched |
|
host |
the same fused, traced |
|
GPU |
each of the above at 65,536 rays, in Morton and in |
|
random order |
RayParticles (Performance/RayParticles): particles colliding with a boundary, one short step each, the
first crossing of the boundary on it (firstHit() over the step’s length). Each particle starts at a random
point outside the boundary, in its box grown by a tenth of its diagonal, and moves a hundredth of the diagonal
in a random direction. The boundaries are a shell (Annular) around the armadillo (the dodecahedron under
--smoke), with a half-thickness of 0.5% of its box diagonal, as in Shell extraction but without the cut:
through a tape (with the mesh as a user primitive type), traced from the mesh’s offset faces (see
Offsets and shells) and marched, the traced case naming the marched one, and fused; the solid armadillo,
for the cost of a mesh’s own crossing; and a box’s shell through a tape, for an analytic shape’s. Host and
device crossings agree as for RayShell.
Case |
Build |
Measures |
|---|---|---|
|
host |
the crossing of each of 50,000 steps, traced |
|
host |
the same, marched |
|
host |
the same fused, traced |
|
host |
the same against the solid mesh |
|
host |
the same against a box’s shell, traced |
|
GPU |
each of the above at 262,144 steps, the starts in |
|
Morton and in random order |
Render (Performance/Render): one whole frame of the renderer (see The renderer),
with shadows and ambient occlusion and one ray per pixel, from the camera Render::Camera::fit()
places for the shape: the classic CSG solid through a Tape, and the armadillo as a TriMeshSDF.
The ray queries themselves are timed by the Ray and RayCSG probes; this measures what the renderer adds
to them, the shadow and occlusion rays and the shading. A host and a device pixel agree when every color
channel is within a tenth of its range; a ray grazing the silhouette can hit on one side and miss on the
other.
Family |
Build |
Measures |
|---|---|---|
|
host |
a 192 x 192 frame on one thread, through
|
|
GPU |
the pixels of a 512 x 512 frame through
|
|
both |
the same frames of the CSG solid with an orthographic camera (parallel rays from a plane) |
MeshCSG (Performance/MeshCSG): a mesh in a composition, as in CSG with a mesh: the armadillo
(a TriMeshSDF, the dodecahedron under --smoke) scaled to 2.4 along its longest side and standing on a
table (a rounded box on four cylinders). Three ways of joining them: the plain union through a tape; the
smooth union (blend length 0.3) through a tape, which marches it; and the smooth union fused, which traces the
plain union and marches only where the blend can change it (see Smooth unions and intersections). Each tape holds the mesh
as a user primitive type. The fused case names the tape’s (tape/fused). Each is
timed as ray queries, with the rays and the agreement rule of RayCSG, and as whole frames of the renderer, as in
Render. The plain union’s frame is the device render kernel of a tape that holds a mesh.
Family |
Build |
Measures |
|---|---|---|
|
host |
the first crossing of each of 20,000 rays |
|
host |
a 128 x 128 frame on one thread, through
|
|
GPU |
the rays at 65,536, in Morton and in random order |
|
||
|
GPU |
the pixels of a 512 x 512 frame through
|
The inputs are union-tape, smooth-tape and smooth-fused.
RayCrossing (Performance/RayCrossing): firstCrossing(), the first crossing without its normal or
primitive, against firstHit() on the same rays, both timed in this probe (the comparison notes
hit/crossing): the armadillo (the dodecahedron under --smoke), the CSG solid through a tape, and two tapes
holding the mesh, where the normal costs the most: the mesh drilled through its center along each axis, traced
exactly, and the mesh smoothly joined to a ball at the top of its box, marched.
Family |
Build |
Measures |
|---|---|---|
|
host |
the first crossing of each ray, without its normal |
|
host |
the same rays through |
|
GPU |
the same, in Morton and in random order |
|
The inputs are mesh, csg-tape, drilled-mesh-tape and smooth-mesh-tape.
MeshClosestPoint (Performance/MeshClosestPoint): the mesh distance functions’ closestPoint() and
gradient() (see The closest point and the gradient) on the armadillo, with signedDistance() at the same points as
the reference the closest point is compared with. A host and a device closest point agree when their distances
do: at a point equally near two faces, the two sides may name different faces.
Family |
Build |
Measures |
|---|---|---|
|
host |
a |
|
both |
the closest point, its face and pseudonormal |
|
||
|
host |
the closed-form gradient |
ClosestPrimitive (Performance/ClosestPrimitive): a tape’s closestLeaf(), the deciding
leaf (see The deciding leaf), of the classic CSG solid, of a scene of fused parts and of the
drilled mesh. Each query also evaluates the leaf at its local point, so that the checksum depends on
both; a host and a device answer agree when they name the same leaf or two leaves whose values tie.
Family |
Build |
Measures |
|---|---|---|
|
host |
the classic CSG solid through a |
|
host |
a scene of eight fused copies of it, each one leaf of
a |
|
host |
the drilled armadillo through a |
|
GPU |
each of the above at 1,048,576 points on both sides (262,144 for the drilled mesh) |
ClosestSurface (Performance/ClosestSurface): a tape’s closestSurface() (see Surfaces: inside a cloud, a union or a nested tape),
for a box with 65,536 spheres cut out of it, the spheres a SphereCloudBVH (cloud) or a BVHUnion
of analytic spheres (union). Each query also reads the deciding sphere’s distance at the local point, so
that the checksum depends on both. Each input’s closestLeaf case, which stops at the collection, names its
closestSurface case, and a comparison notes the ratio of their times (what the drilling costs).
Family |
Build |
Measures |
|---|---|---|
|
host |
the surface, at 200,000 points in the box |
|
host |
the leaf alone, at the same points |
|
GPU |
each of the above at 1,048,576 points on both sides |
SurfaceParts (Performance/SurfaceParts): the parts of a tape’s surfaces and their labels (see
Parts: a face of a shape): closestSurface() on a union of 4,096 boxes (drilled into the union, each box reporting
its face) and on the drilled armadillo with its faces labeled in eight groups (each point’s face found by a
second search of the mesh), and firstSurface() along rays at that mesh. Each closestLeaf case names its
closestSurface case, and the firstHit case its firstSurface case, so that a comparison notes what
the parts cost.
Family |
Build |
Measures |
|---|---|---|
|
host |
the surface and its face, or the leaf alone, at |
|
200,000 points around the boxes |
|
|
host |
the surface, its face and its group’s label, or the |
|
leaf alone, at 20,000 points around the mesh |
|
|
host |
the crossing with its face and label, or the crossing |
|
alone, along 20,000 rays at the mesh’s center |
|
|
GPU |
each of the above at 1,048,576 points (262,144 for the mesh) on both sides |
Regions (Performance/Regions): the regions of a tape (see Regions, materials and domains), for a matrix
holding 32 particles, each a shell around a grain, one Overlay of 65 regions. The regionByRegion case computes
what regionDistances does by asking signedDistance(point, region) for each region, names it, and a comparison
notes the ratio of their times (what the one pass saves). An assembly of one region, 512 spheres in a union through a
BVH with no Overlay, is traced too: firstRegionChange(), what a view of its regions traces per camera ray, and
firstHit() of the same rays, which names it (what naming the region and the surface costs).
Family |
Build |
Measures |
|---|---|---|
|
host |
the region of each of 20,000 points in the matrix |
|
host |
every region’s function in one pass, at the same points |
|
host |
the same, region by region |
|
host |
a domain’s label functions (the matrix and the shells; the grains excluded) |
|
host |
where 50,000 rays at the assembly first change region, |
|
with the surface; or where they first cross it |
|
|
GPU |
each of the above at 262,144 points or rays on both sides |
Domain (Performance/Domain): a domain (see Regions, materials and domains) with many subdomains and surface
groups, over the Regions probe’s matrix of 32 particles: the matrix and every shell a subdomain of its own (33
subdomains, the grains excluded), and 33 selectors (each shell’s interface with its grain, and the remaining surfaces)
dealt into 8 surface groups, so that a surface facing the matrix tries every selector before the remaining surfaces
hold it.
Family |
Build |
Measures |
|---|---|---|
|
host |
every subdomain’s function at each of 20,000 points in
the matrix ( |
|
host |
the subdomain of each of those points
( |
|
host |
the surface group of the surface of each point’s region closest to it (found untimed) |
|
GPU |
each of the above at 262,144 points on both sides |
DomainObject (Performance/DomainObject): a domain compiled on its own (regionNeighborhood(), see
Regions and domains), against the whole object. An assembly of 216 balls on a grid in a box of air, each ball
a region, and a domain computing in the middle ball: the whole object’s tape evaluates every ball, the domain’s own
keeps the ball and the air around it. Each case runs at points in a shell around the ball, where the two tapes give
the same values; each partsOwn case is noted relative to its partsWhole one.
Family |
Build |
Measures |
|---|---|---|
|
host |
the domain’s functions at each of 20,000 points
( |
|
host |
the subdomain of each of those points
( |
|
host |
the same, on the domain’s own tape |
|
||
|
GPU |
each of the above at 262,144 points on both sides |
ConnectedComponents (Performance/ConnectedComponents): connectedComponents() (see
Regions and domains) of every region of a box of air holding 27 hollow shells on a grid (one under
--smoke), each shell a region whose hollow is a cavity of the outside, on the host, at two resolutions. The
search refines down to the resolution near every surface, so its cost grows with the surfaces’ area over the
resolution squared, and with the number of regions each evaluation visits.
Family |
Build |
Measures |
|---|---|---|
|
host |
the components at a resolution of 1/64 of the box |
|
host |
the same at 1/128 |
MeshTape (Performance/MeshTape): a mesh in a tape against the mesh alone: the armadillo (the dodecahedron
under --smoke) as a TriMeshSDF (input mesh), as a Tape holding only it (tape), and as a
RegionView of that tape (view), which is what ebgstudio draws of a model read through the language. They
give the mesh’s answers, so each tape and view case is noted relative to its mesh case (the comparison
notes mesh/tape and mesh/view): the cost of reaching a mesh through a tape. The rays start at random points
in the mesh’s box grown to twice its size and point at its center.
Family |
Build |
Measures |
|---|---|---|
|
host |
the first crossing of each of 100,000 rays, with its normal |
|
host |
the same rays through |
|
normal |
|
|
host |
one 192 x 192 frame on one thread, with shadows and ambient occlusion |
|
GPU |
the rays at 262,144 on both sides, and the pixels of a
512 x 512 frame through |
QueryOrder (Performance/QueryOrder): queries run in Morton order (see Running queries on a GPU):
GPU::mortonOrder() over a million random points in the unit cube, and the armadillo’s signed distance (a
TriMeshSDF) at 100,000 random points in its box, run as the points were drawn and through the ordered
GPU::transform(). The ordered case names the other and notes arrived/ordered. On the host, the order is
computed for a pool in host memory; in a pair, the device computes it for a pool in device memory and the two orders
must agree element for element.
Case |
Build |
Measures |
|---|---|---|
|
both |
the order of a million points |
|
both |
the distances, the points as drawn |
|
both |
the same distances, in the points’ Morton order |
EBGrid (Performance/EBGrid): an embedded-boundary workload: the armadillo’s signed distance, as a
TriMeshSDF and as a MeshSDF, at the cell centers of a uniform grid on a cube around it, the domain split into
boxes of cells and visited box by box and, in a box, cell by cell with x fastest, as AMReX and Chombo generate an
embedded boundary. The same points run in three orders: the grid’s, their Morton order (GPU::mortonOrder()) and
shuffled from a fixed seed. The grid order is the workload; Morton order bounds what reordering can still give on it,
and the shuffled order what the grid’s coherence is worth. The Morton and shuffled cases name the grid’s and note
grid/morton and grid/shuffled. Each case puts its results back in grid order before its checksum, so the three
orders of one function share it. A pair runs a grid of 64 x 64 x 64 cells in boxes of 32 x 32 x 32 (in grid order a
warp takes one row of a box); the host, on one core, a grid of 32 x 32 x 32 cells in boxes of 16 x 16 x 16.
Case |
Build |
Measures |
|---|---|---|
|
both |
the distances, box by box and cell by cell |
|
both |
the same distances, in the points’ Morton order |
|
both |
the same distances, shuffled |
LaunchTuning (Performance/LaunchTuning): the launch settings of GPU::transform() (see
Running queries on a GPU), the block size and the threads a CUDA kernel is asked to keep resident on a
multiprocessor, which fixes its register budget. Three kernels whose best settings differ, each at the
defaults (b128-r384) and at three other settings that name it: no minimum (b128-r0, the compiler
picks the budget), a larger one (b128-r768, at most 80 registers) and wider blocks (b256-r384).
Device only: a host build has no cases here. Every other device case records its launch settings as the
parameters blockSize and minResidentThreads.
Case |
Build |
Measures |
|---|---|---|
|
GPU |
the armadillo’s signed distance (a |
|
GPU |
the first crossing of 262,144 rays with the classic CSG
solid through a |
|
GPU |
the closest of a million points in a |