Add per-phase render profiling and scene statistics - #118
Merged
Conversation
A single wall-clock number hides which part of a render actually cost anything. This separates the phases -- parse USD stage (open, traverse, load assets, commit acceleration structure), render, write output -- and reports them the way Guerilla Render's "Profiling And Statistics" does: a statistics block, then the profile by execution tree, then by time. Two primitive views are reported because for an instanced scene they answer different questions. The top-level view is what the root BVH traverses; the unique view descends into instances and counts each distinct prototype once, so it is what actually occupies memory. Without it the interesting counts stay hidden behind "N instances". Collection is one Instant per phase and never per ray, so nothing touches the integrator's inner loop and measuring costs the same whether or not the report is printed; only printing is gated, behind --stats. On the complete Moana island this reports 113M primitives resident (56.8M triangles, 17.2M cubic curve spans) at 119.77 GiB, with parsing at 75.3% of runtime against rendering's 24.7%. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
--stats: a per-phase profile and scene-statistics report, so it ispossible to see which part of a render cost the time and the memory
rather than inferring it by subtracting wall-clock numbers.
Structure follows Guerilla Render's "Profiling And
Statistics"
— a statistics block, then the profile by execution tree, then by
time.
Phases separated: Parse USD stage (→ open stage, traverse prims, load
assets, commit acceleration structure), Render, Write output.
Example — the complete, unmodified Moana island
Parsing is 75% of the runtime against rendering's 25% — not obvious
before, and the kind of thing this exists to surface.
Design notes
Instantper phase,never per ray, so nothing touches the integrator's inner loop.
Collection is always on; only the report is behind
--stats.different questions.
top-levelis what the root BVH traverses;primitives in memorydescends into instances counting each distinctprototype once (deduplicated by
Arcpointer), so it tracks memory.Without it the interesting counts stay hidden behind "N instances" — on
samples/curves.usdathe top-level view shows onlyinstances 3.Displaythe host chooses toprint, consistent with crust-core's UI-free rule. The report goes to
stdout rather than through
tracing, so the log level cannot swallow itand it is not interleaved with per-prim messages.
Testing
phases, both profile views list every phase, percentages, zero-count
omission, and a kernel test pinning that a prototype shared by four
placements is counted once).
scripts/test_simd_matrix.sh -p crust-rtbit-exact across all fourcodegen configurations.
samples/curves.usda, an instancedcurve-heavy probe scene, and the full island.
Not included
Per-ray counters (Guerilla's Trace/Occlusion/Shading categories).
Those need plumbing into the integrator hot path; a shared atomic
incremented per ray would contend badly across 48 threads. Feasible via
per-work-unit accumulation — the Rayon loop already returns per-unit
tuples — but it is a separate change and did not belong bundled here.
🤖 Generated with Claude Code