Skip to content

Add native Permuto and multilevel LoD encodings - #538

Draft
shsolanki-1 wants to merge 4 commits into
NVlabs:masterfrom
shsolanki-1:codex/permuto-lod-native
Draft

Add native Permuto and multilevel LoD encodings#538
shsolanki-1 wants to merge 4 commits into
NVlabs:masterfrom
shsolanki-1:codex/permuto-lod-native

Conversation

@shsolanki-1

@shsolanki-1 shsolanki-1 commented Aug 18, 2026

Copy link
Copy Markdown

Summary

  • Add native Permuto training, parameter-gradient, input-gradient, and supported double-backward paths.
  • Generalize Permuto construction across input dimensions 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 16, 24 and features per level 1, 2, 4, 8.
  • Generalize MultiLevelEncodingLoD to wrap multilevel encodings with hard or soft level selection.
  • Preserve base layouts, matrix strides, parameter ownership, CUDA streams, gradient modes, empty batches, and serialized configuration.
  • Document the public configuration, execution, and derivative contracts.

Motivation

The existing Permuto factory exposes one fixed specialization, and the existing level-of-detail wrapper is tied to Permuto and hard level selection. This change exposes the existing native implementation over a defined configuration matrix and provides one native multilevel LoD wrapper for Permuto and Grid encodings.

Compatibility

The existing five-dimensional configuration with two features per level retains its parameter order, lattice tables, outputs, gradients, and serialized hyperparameters. n_features and n_grid_features are accepted as total-feature aliases and serialize to canonical n_levels and n_features_per_level fields.

The LoD ratio is scheduler state. Its input gradient remains zero. Nested LoD wrappers are rejected because their mutable level state does not compose consistently.

Validation

  • Configured and built Release tests with CUDA 12.8, GCC 12.3, and TCNN_CUDA_ARCHITECTURES=89.
  • Passed test_permuto with 29 test cases and 425,577 assertions on an RTX 4090.
  • Passed the focused non-JIT FullyFusedMLP double-backward test with 141,383 assertions.
  • Verified the PR range with git diff --check.

Build Impact

The complete native matrix creates 104 Permuto specializations: 13 input dimensions, four feature widths, and two scalar types. In the measured Release build, clean build time increased by 1.2155x, encoding.cu.o increased by 2.6306x, and libtiny-cuda-nn.a increased by 1.6015x. The retained five-dimensional, two-feature specialization kept the same generated device-code size.

Generated inference is intentionally excluded from this PR and is provided by stacked follow-up #539. Generated backward and generated double backward remain unsupported.

Dispatch the existing native implementation over the public dimension and
feature-width matrix. Canonicalize aliases and validate configuration
before template construction while preserving the existing 5D/two-feature
artifact contract.

Cap AoS transpose geometry so wide outputs stay within CUDA block-size
limits.
Wrap any multilevel encoding so Grid and Permuto share one hard or soft
LoD path. Preserve base layouts, strides, parameters, streams, and double
backward by staging incompatible matrices through the preferred layout and
retaining unweighted soft outputs.

Expose level counts through the minimal base interface and align Grid
derivative cutoffs with the forward predicate at the epsilon boundary.
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.

1 participant