Skip to content

meshlet_page: add optional Rust geometry kernels - #8808

Open
TG0000 wants to merge 1 commit into
ItsNotRexed:mainfrom
TG0000:perf/rust-meshlet-native
Open

TG0000 wants to merge 1 commit into
ItsNotRexed:mainfrom
TG0000:perf/rust-meshlet-native

Conversation

@TG0000

@TG0000 TG0000 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Claimed PERF-MESHLET-NATIVE in the coordination issue.

Changes

  • Add the optional zero-dependency tools/meshlet_native Rust cdylib. It validates ordinary meshlet groups, decodes packed positions, normals and tangents, and computes packed-block plausibility and group geometry counts. When several geometry checks are enabled, they share a single triangle walk.
  • A missing or incompatible library, native refusal, or LEONIDA_MESHLET_NATIVE=0 runs the Python implementation. Wrapped offsets, non-finite transforms, and radius comparisons close to the rounding boundary of math.dist also go through Python.
  • Add an offline release build and test step to the asset-tools CI job, including a check that the built library loads.

Benchmark

summarise_page() on one synthetic 1,130,752-byte page, eight groups, 126,976 triangles. Times are the median of seven runs per mode, with the execution order rotated and library already loaded. Every result serialized to identical JSON. Base Python is 867d922f0. The pure-Python comparison uses #7206 at 80ebbd597.

Checks Base Python #7206 Python Rust Speedup vs. base Speedup vs. #7206
Default scan 47.193 ms 48.045 ms 0.532 ms 88.67x 90.28x
Faces 620.654 ms 418.321 ms 18.456 ms 33.63x 22.67x
Centres 125.689 ms 121.339 ms 1.572 ms 79.93x 77.16x
Normals and tangents 796.795 ms 572.683 ms 5.003 ms 159.27x 114.47x
Cones 346.997 ms 345.446 ms 2.929 ms 118.48x 117.95x
All checks 1,628.974 ms 1,218.803 ms 17.618 ms 92.46x 69.18x

A separate timed pair used a 13,013,120-byte synthetic page with 256 groups and 2,031,616 triangles. All checks took 25,186.763 ms in base Python and 266.611 ms in Rust (94.47x), with byte-identical JSON.

Windows 11, Ryzen 9 5900X, CPython 3.12.10, rustc 1.100.0 (GNU). CPU only. No GPU or GPU driver was involved.

Verification

AI-assisted with GPT-6.2 Sol.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
@YordiLorenzo

Copy link
Copy Markdown

Tested a953bac on Linux, Python 3.14.4: Python side pass, Rust side not run

python3 -I tests/test_meshlet_page.py: 66 of 66 pass, the same with LEONIDA_MESHLET_NATIVE=0
python3 -I tests/test_meshlet_native.py: 3 pass, 8 skipped (no cargo here, so no library to load)
So this only shows the fallback is unchanged; the parity tests need the CI step or someone with cargo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants