Engine Performance Internals#

This page of the Technical Guide explains how the engine of the ovstage backend, which reads USD through the ovstage runtime, keeps its hot paths fast and which rules a code change must keep. It is written for maintainers of the ovstage backend (source/Ovstage*), the schedulers (source/ParallelFor.h, source/ParallelCollect.h) and the performance tests. The Architecture glossary defines the implementation terms.

Other pages own the neighboring topics:

Page

What it owns

Performance

The settings that users tune, and their defaults.

Transform evaluation internals

Transform classification, matrix windows, prefetch and broad-phase candidate order.

ovstage source extraction internals

Populations, topology recovery and instancing identity.

KPI workloads and metrics

The representative queries that KPI times against reviewed budgets, and their timing boundaries.

The benchmarks index, benchmarks/README.md

Which maintainer benchmark answers which question, and their shared conventions. Each benchmark folder’s README, such as benchmarks/backend_timings/README.md, holds its commands, options, outputs and report format.

Requirement: before you change a rule on this page, run the tests named under it and a timing comparison; see Dynamic-run cost and how to measure it.

Stage opening#

ovclash_open_stage does different work on the two backends:

Backend

Work done by ovclash_open_stage

OpenUSD

UsdStage::Open, stage registration and an empty engine scope.

ovstage

OvstageSceneReader::openFileCached() calls ensureCachedSelectionPopulation(). That checks runtime compatibility once, creates an ovstage instance, waits for a USD-default-time OVSTAGE_POPULATION_DOMAIN_RENDERING population and advances its write floor. It then reads the stage metadata and the time-code rate.

The ovstage time therefore includes the conversion into ovstage’s scene data. Mesh selection reuses that population later. Moving the population work into selection would move time from one interval to another without removing it. Compare query_wall_s and the per-step times, not stage_open_s alone.

Time-sampled dynamic runs#

A dynamic run classifies the transforms once and then runs one pipeline step per sample. executeTimeSampledSample() in source/OvstageClashPipeline.cpp runs each sample, through the broad phase and the narrow phase:

  1. refreshSelectedTransforms() reads the sample’s matrices.

  2. computeDynamicMeshData() updates the mesh poses, scales and bounds.

  3. buildBVH(), runBroadPhase() and purgeDuplicateBroadphasePairs() produce the candidate pairs.

  4. runNarrowPhase() tests the candidates. processResults() sorts the sample’s reports.

  5. accumulateCurrentTimeSample() adds one record to the group of each overlapping pair.

Steps 2 to 4 are executePreparedSample() in source/OvstageClashCollision.cpp.

These rules keep long runs fast:

  • Read transforms from the cached population. Advance the numeric population to the sample time. Never populate the stage again for one sample. Stage populations and Numeric transform reads give the population and batched-read rules.

  • Skip static meshes once the run is primed. After the first full pass, computeDynamicMeshData() leaves the pose, scale and bounds of every mesh classified static unchanged. With raw transform classification it visits only dynamic_matrix_mesh_indices.

  • Publish accumulated groups on demand. Each group owns its whole record history, so copying all groups after every sample would make the run quadratic in the sample count. Readers call ensureDynamicOverlapsPublished(), which publishes only after a sample changed the groups.

  • Move the result in the final publish. publishFinalDynamicAccumulatedOverlaps() moves the accumulated vector into overlaps. A copy would hold two complete result sets at once.

Pins: the source-shape tests test_ovstage_static_meshes_reuse_bounds_between_samples and test_ovstage_dynamic_overlaps_publish_lazily in tests/python_tests/test_ovstage_backend_source_parity.py.

The BVH rebuild#

buildBVH() in source/OvstageClashBroadPhase.cpp builds the broad-phase tree, a BVH (bounding volume hierarchy), with the PhysX function PxCreateBVH for every sample. The cost of rebuilding every leaf grows with the mesh count. It is negligible on small stages but significant at hundreds of thousands of meshes over long timelines. A dynamic run therefore keeps the static meshes in a second tree:

  • static_bvh holds the meshes classified static. It is built once per run and rebuilt only when it no longer holds exactly those meshes.

  • bvh holds the moving meshes and is rebuilt for every sample.

broadPhaseCanSplitStaticTree() in source/OvstageClashContext.h allows the split only when all of these hold:

  • The static purge is armed (dynamic_skip_static_pairs): its setting is on and the run is not duplicate-only.

  • The run is primed, so the static bounds are final.

  • No point clouds are active. The point-cloud query reads a single tree.

  • The build has no validation observer.

buildBVH() also needs at least one static and one moving mesh, and exact leaves (isExactTreeLeaf()): a finite extent, and every coordinate zero or a normal float. Over exact leaves, a box query reports exactly the meshes whose bounds pass its inclusive min/max test, whichever tree holds them. The split therefore leaves the candidate set unchanged. When any condition fails, bvh holds every mesh.

Queries over a split tree:

  • A moving mesh queries both trees.

  • At zero tolerance a static mesh runs no query. Its pairs with moving meshes come from the moving meshes’ queries, and its pairs with static meshes are dropped anyway.

  • At a positive tolerance a static mesh queries only bvh.

releaseStaticBVH() discards static_bvh whenever the cooked geometry or the selection changes, and at the start and end of every dynamic run. The split pays off when few meshes move. When most meshes move, the queries dominate the time and the split saves little.

Pins: verifyStaticBroadPhaseTree and verifyBroadPhaseShortcuts in tests/native/TestDynamicFailureRecovery.cpp (ovclash.dynamic_failure.test) check the tree reuse and the candidate set.

No refit path#

bvh is always rebuilt, never refitted. A refit path that rewrites only the moved leaves (getBoundsForModification() and refit()) would have to handle one trap: processResults() clears world_bounds after every sample. A guard such as world_bounds.size() == meshes.size() is then always false, and the code silently falls back to a full rebuild. Prove that the refit path runs before you time it. test_ovstage_static_meshes_reuse_bounds_between_samples asserts that no refit code exists, so change that test together with the code.

Dynamic-run cost and how to measure it#

The cost model of a dynamic run:

  • It is one classification pass plus one step per sample.

  • The narrow phase costs time in proportion to the number of triangle pairs it tests.

  • Correct static classification is a major lever. A static/static pair that is not classified static is tested at every sample; see Raw authored-transform classification.

  • Per-sample transform reads stay cheap only while the copied matrix window, or the sampled fallback’s whole-timeline cache, holds the frames. kDynamicMatrixCacheDefaultByteLimit in source/DynamicMatrixCacheLimit.h caps both at a fixed 1 GiB. Dynamic runs lists the window sizes and the cache switch. The Python switch, ClashRuntime.set_ovstage_dynamic_matrix_cache(), calls ovclash_ovstage_set_dynamic_matrix_cache(), an ovstage export that no shipped header declares.

Read the phase log#

With logging on, ovstage prints one line per phase to stdout. The lines are diagnostics, not a stable format. This example runs three samples of a test stage with two static and two animated meshes. Run it from the ovclash directory of a source checkout, with an ovstage build of the ovclash packages importable (Running the module from a source checkout). The keyword arguments are RunSettings fields, which ovclash Python in the settings reference lists:

from ovclash import ClashRuntime

with ClashRuntime() as runtime:
    runtime.open_stage("tests/data/constant_animation_static_purge.usda")
    runtime.set_run_settings(enable_log=True, set_times=True, start_time=0.0, end_time=2.0, time_codes_per_second=1.0)
    runtime.run_pipeline()
    print("overlaps:", runtime.get_overlap_count())

Output on ovstage, shortened. Each time measures your machine and run, so the example shows <ms> in its place:

--ovstage: Computed mesh keys in <ms> ms (4 geometry blocks for 4 meshes) using 4 worker(s)
--ovstage: Cooked 1 meshes in <ms> ms on 1 thread(s)
--ovstage: classified 4 meshes from raw transform update records (2 dynamic)
--ovstage: computed poses & bounds in <ms> ms using 4 worker(s)
--ovstage: Built BVH for 4 meshes in <ms> ms
--ovstage: Found 1 box overlaps in <ms> ms using 1 worker(s)
--ovstage: Found 52 triangle overlaps in <ms> ms on 1 thread(s)
--ovstage: Processed and sorted 1 reports in <ms> ms
--ovstage: computed poses & bounds in <ms> ms using 2 worker(s)
--ovstage: Built BVH for 4 meshes in <ms> ms
--ovstage: Found 1 box overlaps in <ms> ms using 1 worker(s)
--ovstage: Reused 52 triangle overlaps for identical narrow-phase inputs in <ms> ms
--ovstage: Processed and sorted 1 reports in <ms> ms
...
overlaps: 1

The mesh, overlap and report counts are the work each phase handled. They repeat for the same stage and settings on any machine. The times and the worker counts depend on the machine.

What the log shows:

  • The first sample computes poses and bounds for all four meshes. Later samples update only the two animated meshes, so the phase gets two workers.

  • The four meshes have identical geometry, so only one mesh is cooked, on one thread.

  • Later samples reuse the whole narrow-phase answer, because their inputs repeat bit for bit; see Narrow-phase result reuse.

  • Built BVH for 4 meshes counts every selected mesh, also when bvh holds only the moving ones.

Use the measurement tools#

Do not judge a change with ad hoc timers. Time it with tools that verify the results first, and read the phase log to see where the work goes:

  • benchmarks.backend_timings runs a workload matrix on an ovstage and an OpenUSD install, one fresh process per attempt. It checks the complete result fingerprints and the work volume of both backends before it compares any time. Its report holds the intervals of each attempt, such as stage_open_s, pipeline_execute_s, query_wall_s and result_capture_s, and the time of every native pipeline step. For a dynamic row, the step table shows the fixed setup steps and the total, minimum, median and maximum of the sample steps, so you can see whether setup or the per-sample work dominates.

  • KPI (python -m benchmarks.kpi) times the representative product workloads against reviewed budgets for the CPU model it runs on; see the KPI maintainer guide.

  • The phase log (enable_log=True) counts the work in each ovstage phase: meshes classified, cooked and bounded, box overlaps, triangle overlaps and reused narrow-phase answers. Use it to find the phase a change affects, and benchmarks.backend_timings or KPI to time the change.

Before you begin, build both backends from the same checkout state: build_ovstage.* --release --validate, which also creates the Python test environment _build/deps/venv/python_tests, and build_openusd.* --release. Then, from ovclash/:

Linux:

out=$(mktemp -d)
_build/deps/venv/python_tests/bin/python3 -m benchmarks.backend_timings \
  --ovstage-install-root _build/install/ovstage \
  --openusd-install-root _build/install/openusd \
  --repeats 4 --json-out "$out/BackendTimings.json" --out "$out/backend_timings.md"

Windows:

_build\deps\venv\python_tests\Scripts\python.exe -m benchmarks.backend_timings --ovstage-install-root _build\install\ovstage --openusd-install-root _build\install\openusd --repeats 4

Without --json-out and --out, the reports go to _build/benchmark-reports/.

A passed run prints wrote <path> for the JSON report and the Markdown summary and exits with 0. When a gate fails, for example because the backends disagree, it prints backend timing comparison failed; see JSON errors, writes only the JSON report and exits with 1. A configuration failure, such as an unusable install root or matrix, prints backend timing configuration failed: <reason> and exits with 2.

The report gives each attempt these intervals, among others:

Field

Type

Required

Default or values

Description

stage_open_s

number

Yes

Seconds, finite and nonnegative

runtime.open_stage() only

pipeline_execute_s

number

Yes

Seconds, finite and nonnegative

The sum of one timed run_pipeline_step() call per step

query_wall_s

number

Yes

Seconds, finite and nonnegative

Stage opening, settings, scope, pipeline creation and execution: the comparison metric

result_capture_s

number

Yes

Seconds, finite and nonnegative

Statistics, step validation and fingerprint capture after the query timers stop

To time a stage of your own, write a matrix for it instead of editing the default one. benchmarks/backend_timings/README.md owns the commands, options, matrix format and the rest of the report schema.

Read a timing result#

A timing ratio, for example between the two backends, is evidence only when all of these hold:

  • Both runs use verified installs with the same source revision, source tree, dirty state, build type and ovclash version (Build provenance).

  • Every attempt runs in a fresh process.

  • The complete semantic fingerprints of the overlap and duplicate payloads are equal. Equal overlap counts do not prove it.

  • The recorded work volume is equal. A cache, classification or static-purge setting that reduces the work, or a different sample count, is not a scheduler speedup. Compare the work volume before you credit a gain.

When you read the intervals:

  • Stage opening, pipeline execution and result capture are separate intervals. Faces and outlines are built when a report is read, so a client that reads details pays that cost outside the pipeline timer.

  • A result describes the machine that measured it. Compare runs from one machine with the host otherwise quiet, and never carry a time or a ratio to other hardware as a threshold.

Dynamic-result indexing#

On OpenUSD, the shared clash engine keeps the dynamic overlap groups in a PxHashMap. Its getDynamicRecords() finds group i by walking the map from the start. Reading every group by index therefore costs time quadratic in the group count on OpenUSD. This is reference behavior and stays unchanged, because the OpenUSD backend is the unchanged parity reference. Time result capture separately from pipeline execution. Group order is not part of the contract on either backend; see Overlap report ordering.

Instanced stages share geometry#

Every instance-proxy placement expanded from a prototype mesh points at the prototype’s immutable ClashSourceMeshGeometry block (source/ClashSourceMesh.h). computeInitialMeshData() triangulates and hashes each block once, keyed by the block’s address, and shares the resulting TriangulatedGeometry between the placements. Memory and pre-cook CPU therefore scale with the unique geometry, not with the placement count.

Each placement still costs its RuntimeMesh record, its pose and bounds, and its share of the broad and narrow phase. A flattened stage pays that cost too. InstancedGeometrySharingTests (tests/python_tests/test_instanced_geometry_sharing.py) checks that an instanced stage gives the same results as its flattened twin, which places the same geometry through plain references.

Rules:

  • Never copy a placement’s points or indices. A per-placement copy costs memory for every proxy triangle, plus a triangulation and a hash pass for every proxy.

  • Keep prototype-root membership an O(depth) lookup. PrototypeRootIndex (source/OvstageSceneReaderInternal.h) answers it once per collected path and once per loaded mesh. A scan of the root list would cost O(meshes x prototypes).

  • Do not extract geometry again for step 5. The static pipeline keeps the default-time selection geometry and reads the requested transforms from a separate numeric population. StaticPopulationReuseTests pins this.

  • Validate face counts before you allocate. triangulateMeshFaces() (source/MeshTriangulation.h) checks the whole face-count buffer against the available indices before it reserves triangle storage. The reservation excludes hole faces and respects the UINT32_MAX / 3 triangle limit. A huge authored count on a tiny malformed mesh must not become a multi-gigabyte allocation request.

Parallel cooking and narrow phase#

These ovstage phases run on the selected scheduler:

Phase

Function

One work item

Geometry preparation

computeInitialMeshData()

One unique geometry block.

Cooking

cookMeshes()

One mesh with unique geometry.

Poses and bounds

computeDynamicMeshData()

Up to 64 meshes, about eight claims per worker.

Mesh broad phase

runBroadPhase()

64 meshes.

Mesh narrow phase

runNarrowPhase()

One candidate pair.

Point-vs-mesh narrow phase

runNarrowPhase()

One point-cloud candidate pair.

Numeric population updates and indexed hierarchy composition stay sequential on each source. Eligible dynamic playback overlaps a future matrix window with the collision work on the current window; see Reusing transform setup.

Scheduler and worker budget#

The code selects the scheduler like this:

  • ovclash_context_t::workerCount() (source/OvstageClashContext.h) passes the settings to parallelWorkerCount() (source/ParallelFor.h).

  • single_threaded, or fewer than two work items, gives one worker. Nothing is spawned, and Carbonite is not bootstrapped.

  • Under the new scheduler, Carbonite tasking (new_task_manager on), taskingWorkerCount() (source/Tasking.cpp) uses the configured tasking thread count, or the hardware concurrency when none is configured. It caps the result at the work-item count and ignores nb_tasks.

  • Under the legacy scheduler, std::thread workers (new_task_manager off), the budget is min(max(nb_tasks, 1), hardware concurrency, work items), and the calling thread counts as one of the workers. ovclash_set_nb_tasks clamps nb_tasks to 256. While the transform prefetch callback runs, this budget reserves one slot for it.

  • availableHardwareConcurrency() reads Carbonite’s CPU-count utility, which includes supported container CPU quotas, without initializing tasking. An unknown count is treated as one.

  • parallelFor() hands out indices from one shared counter.

getCarboniteTasking() (source/CarboniteBootstrap.cpp) bootstraps ovclash’s own statically linked Carbonite when parallel work first needs it. ovclash never uses the scheduler inside the ovstage package. Once acquired, the tasking interface stays valid for the process lifetime, across context destruction and recreation. A bootstrap failure throws, so the phase fails with the bootstrap error as the context error; no other scheduler is substituted. A failure is not cached, and the next call retries.

What the three threading controls govern on ovstage:

  • The phases in the table of Parallel cooking and narrow phase, eligible sampled-matrix prefetch (Matrix prefetch) and Suite face and outline report preparation.

  • Point-cloud preparation and the point-cloud broad phase stay serial.

  • No control governs the helper std::thread that opens the numeric population of a file-backed static run (Earliest-topology recovery). Only single_threaded turns it off. While it populates, it holds the process-wide lifecycle lock, so stage creation, populations and owner operations of other contexts wait for it. It can outlive the selection step. The runtime joins it before those transforms are read, and before the selection is replaced, reset or released.

Cooking#

  • cookMeshes() cooks each mesh with unique geometry through PxCreateTriangleMesh (cookTriangleMeshWithRetry()). Each call uses its own descriptors and the stateless standalone insertion callback. Nothing is inserted into a shared PxPhysics mesh factory.

  • PhysX’s allocator and error-callback contracts still apply. This is not a general thread-safety claim for PhysX.

  • Each worker writes its own output slot. After the workers drain, cookMeshes() folds the outcomes in mesh order. The counts, the first failure path and the error text therefore match a serial run.

  • Cooking allocates heavily, so the CRT (C runtime) heap behind PxDefaultAllocator limits how far it scales.

Narrow phase#

runNarrowPhase() in source/OvstageClashCollision.cpp runs in this order:

  1. Schedule. With more candidate pairs than workers, one in-place bucket pass groups the pairs by the bit width of their triangle-count product, widest first. Costs within one group differ by less than 2x. Large queries therefore start early, and their arithmetic does not change. The pass is not a comparison sort, because every worker waits for it. Its triangle-count table holds one uint32_t per selected mesh.

  2. Collect. parallelCollect() (source/ParallelCollect.h) feeds all pairs to one shared queue, one pair per claim. The range has no barrier, so a worker can start later pairs while an earlier, expensive pair still runs. Each worker keeps at most 64 successful overlaps and then appends them to pending_overlaps under the collector mutex. Misses need no result storage. One expensive mesh-pair query stays indivisible.

  3. Restore the order. MeshPathOrder::sortPairsInPlace() returns the mesh results to canonical path order. It is a bounded in-place radix sort: it moves complete owning records, keeps path and index ties, and allocates no result-sized scratch.

  4. Point clouds. The point-vs-mesh narrow phase then runs under the same scheduler and worker budget. Its results return to candidate order and are appended.

  5. Capture. A reuse-eligible sample captures its reuse data; see Narrow-phase result reuse.

processResults() then calls sortOverlaps(). It compares mesh path ranks for mesh-vs-mesh pairs and path strings otherwise. It sorts only when the results are not already in order, and the mesh results of the narrow phase already are.

The scheduling pass reorders broadphase_pairs. Only a reuse-eligible sample whose key fits the budget (narrowReuseKeyCanFit()) needs the canonical order back, because the whole-sample key stores the ordered candidates:

  • When the pairs fit in 1 MiB, a copy taken before the scheduling pass is swapped back.

  • Otherwise, or when that copy cannot be allocated, rememberNarrowPhase() sorts its own copy, and only after the capture has passed its budget. A sample whose capture cannot fit pays for no second sort.

  • Every other run discards the cost-ordered pairs in processResults().

Shared state stays synchronized:

  • checkCancelled() is an atomic read, and setError() takes a mutex.

  • Workers fill private buffers. The triangle-pair counters are atomic.

  • Canonical sorting, reuse capture and the phase log lines run on the calling thread after the workers drain.

With enable_log, the cooking and narrow-phase lines print their thread count, and the other phases print their worker count. Besides allocation, pairs of very unequal cost limit the narrow-phase scaling.

Failures, cancellation and floating-point controls#

  • Both schedulers finish or drain all submitted work before they report cancellation or rethrow the first callback failure on the calling thread.

  • Each worker saves its floating-point control state (MXCSR on x86, FPCR on Linux AArch64), installs the caller’s state for the callbacks and restores its own state on exit, also after an exception. Rounding and flush-to-zero modes therefore match a serial run. Restoring matters because Carbonite reuses its worker threads.

  • ovclash_run_pipeline_async() captures the launching thread’s controls as a value before it starts its std::thread. The background worker installs that snapshot and restores its previous controls on exit, also on cancellation and failure. Its parallel phases inherit the snapshot. Later changes to the caller’s controls do not affect the running query, and the launch leaves the caller’s controls unchanged.

  • In the std::thread runner, if creating another worker throws std::system_error or std::bad_alloc, the workers already started finish the range and are joined. If reserving the thread storage fails before any launch, the calling thread runs the range serially. An allocation failure inside the work itself still propagates.

Pins:

  • ovclash.parallel_for.test (tests/native/TestParallelFor.cpp, tests/native/TestParallelCollect.cpp) covers worker-launch and reservation failures, later-work availability, sparse and dense collection, cancellation, failure draining and floating-point controls on both schedulers.

  • ParallelPhaseResultsTests (tests/python_tests/test_parallel_phase_results.py) compares complete ordered reports from more than 16,384 candidate pairs across schedulers.

  • testThreadingControlsDoNotChangeOverlapSet (ovclash.native.test) checks on both backends that the threading controls never change the overlap set.

Narrow-phase result reuse#

This section shows where the reuse rules live in the code.

Both reuse paths require narrowReuseEligible() in source/OvstageClashContext.h: a dynamic run with point clouds, duplicate-only search and maximum local depth all disabled.

Whole-sample reuse. rememberNarrowPhase() in source/OvstageClashCollision.cpp keeps one private result template, which may be empty. Its key holds:

  • the selection generation, the matrix decomposition mode and the floating-point controls;

  • every public setting (NarrowPhaseSettingsInput);

  • the ordered candidate pairs;

  • each mesh’s NarrowPhaseMeshInput: the cooked and queried mesh, the geometry type and flags, the world matrix, the pose and the scale.

On a match, runNarrowPhase() copies the template and assigns the current time and outline controls.

Positive-pair reuse. When the whole sample does not match, testMeshPair() looks up each candidate in a sorted vector of 64-bit, path-ordered mesh-pair keys. accumulateCurrentTimeSample() in source/OvstageClashPipeline.cpp publishes that vector after the previous sample succeeds.

  • A hit needs a bit-identical NarrowPhasePairInput under the same settings, selection generation, decomposition mode and floating-point controls.

  • The pair input is translation-rebased and holds no world matrices, so two meshes that move together still match.

  • A hit shares the earlier triangle payload in a fresh record with the current time and matrices.

  • The duplicate test runs before the lookup. Negative answers are not cached per pair.

Budget and invalidation:

  • Keys compare fields bitwise, never with an epsilon and never as padded PhysX objects.

  • NarrowPhaseReuseBudget in source/NarrowPhaseReuse.h charges both paths against one 8 MiB limit (kByteLimit). The charge includes spare vector capacity and the face arrays that a report may build later.

  • When the budget rejects a cache, or an allocation fails, the normal query runs instead.

  • clearNarrowReuse() discards both caches on geometry preparation, sharing and cooking, on a selection or query reset, after a failed or cancelled sample, and before the final publication.

Reuse skips only the triangle queries. Transform refresh, poses and bounds, the broad phase and the accumulation still run for every sample. The gain depends on how often exact inputs repeat, for example a held pose or a rigidly translating assembly. In the phase log, Reused N triangle overlaps for identical narrow-phase inputs marks a whole-sample hit, and Reused N unchanged pair queries counts the pair hits; see Read the phase log.

Pin: tests/native/TestNarrowPhaseReuse.cpp (ovclash.native.test) compares complete per-sample reports with forced recomputation.

Static duplicate contact representatives#

Example: static meshes A and B are duplicates, with the same cooked geometry and matrices equal within poseEpsilon. Both touch the moving mesh C.

  • With ovclash_set_ignore_redundant_overlaps(context, true), one of the pairs A-C and B-C is reported, also when the static purge is on. The reported pair is an actual eligible pair and keeps its own sampled records.

  • With redundant-overlap filtering off, both pairs are reported.

How the duplicate relationship survives the static purge:

  • The static purge removes the pair A-B from the broad phase, but that relationship still decides which moving contacts are redundant. Both backends recover it from the static classification. They use the same predicate (the same cooked mesh, and sameMatrix() on the source matrices) and union-find roots at the minimum selected index.

  • On OpenUSD, the shared clash engine (ClashDetectionCore::purgeDuplicates()) recovers it for every sample and keeps no state between samples.

  • ovstage (purgeDuplicateBroadphasePairs() in source/OvstageClashBroadPhase.cpp) recovers it once per dynamic run, after priming, and copies the union-find state on later samples. The copy is keyed on the selection generation, the poseEpsilon bits and the caller’s floating-point controls, because sameMatrix() rounds under those controls. A stepwise caller that changes rounding or denormal controls between samples therefore gets a fresh recovery. The copy is cleared at the start and end of the run and whenever the geometry or the selection is replaced.

  • Exact static matrix copies are merged first. Distinct matrices are then compared at poseEpsilon along the widest finite matrix component, which prunes dispersed placements before the full predicate. This keeps transitive unions without storing static/static pair edges. Clustered distinct matrices can still need pairwise comparisons.

  • With a negative poseEpsilon, ovstage skips that comparison sweep for groups whose matrices are all finite.

  • The recovery needs O(mesh count) storage. It adds nothing to the candidate list or to the broadphaseLimit count.

How a redundant pair is dropped:

  • A redundant pair is dropped only when its root pair passes a replay of the broad-phase admission test: scopes, subcomponents, the static purge and the tolerance-inflated bounds. A contact class whose root pair was excluded keeps its candidates.

  • A per-mesh flag marks meshes whose root has bitwise-identical broad-phase inputs. A pair of two such meshes skips the replay. With a positive tolerance it also needs the root pair’s index order, because the broad phase inflates the lower index’s bounds.

  • The purge keeps no per-pair or per-class hash state. At billions of candidate pairs, a per-class map would exceed the 32-bit entry count of PxHashMap.

  • Same-root duplicate reporting is handled separately. Dynamic runs never enumerate duplicate meshes.

Pins: testStaticDuplicatesSuppressMovingContacts and testStaticDuplicateRepresentativesRespectFilters (ovclash.native.test), and test_static_duplicates_suppress_redundant_moving_contacts (tests/python_tests/test_engine_review_regressions.py). They cover the flag interaction, the actual representatives, sampled changes and scheduler invariance.