perf(rt): high-water-mark growth for TLAS host-input buffers (#64) #98
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics!98
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-64"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
RenderingElement3D::BuildTLASreallocated the host-visibleinstanceBufferandmetadataBufferon every topology change (instance-count or build-flag change). Those buffers only ever need to hold at leastprimitiveCountentries — the AS build reads exactlyprimitiveCountof them viatlasRangeInfo, and the copy loop writes[0, primitiveCount)— so a shrink, or any growth that still fits the previous capacity, can reuse the existing allocation.This gates the two
Resizecalls behind a high-water-mark check, removing two of the four reallocations on a count change. The AS storage + scratch rebuild (the dominant cost on this path) is unchanged, since it is tied to the AS itself.Correctness
primitiveCountinstances regardless of buffer capacity, so an oversized instance buffer is spec-correct — verified with the validation layer (zero errors).Tests
Adds
tests/TLASHighWaterMark, driving the real hardware AS-build path (cube BLAS +BuildTLASat a sequence of instance counts). It asserts:>not>=);builtInstanceCountunchanged;builtInstanceCounttracks the live count across every build;crafter-build test— all 14 tests pass (run with--jobs=1; the parallel runner has a pre-existinggit pullrace on the shared external-dep cache, unrelated to this change).Resolves #64