Skip to content

docs(spec): add 007-native-fault-kernel - #430

Merged
lachlangrose merged 1 commit into
masterfrom
docs/spec-007-native-fault-kernel
Nov 26, 2026
Merged

lachlangrose merged 1 commit into
masterfrom
docs/spec-007-native-fault-kernel

Conversation

@lachlangrose

Copy link
Copy Markdown
Member

Summary

Adds spec 007, native fault application (specs/007-native-fault-kernel/spec.md), and an index row in specs/README.md. Documents only; no code.

Restoring points through the faults of a feature is about 90 % of the evaluation time of a faulted model. A proof of concept (a Rust port of the fault application, wrapped for Python) was 6.5–16× faster on one thread and 60–150× faster on 20 threads than the Python path of spec 003. The spec makes a native path that LoopStructural uses when the native package is installed, with Python as the reference and the fallback.

Stages (user stories)

  1. Python only: compute the restore order of a feature's chain of cutting faults once, not per call (a cutting fault's fixed cost ~40 ms → ≤ 10 ms, bit-identical).
  2. Native restoration with the Python semantics (restore order, already-restored faults, block sides, reverse, NaN rules, the fix(fault): keep a step direction where a cutting fault leaves no frame gradient #425 step direction).
  3. Native values and gradients (with the fix(features): fold rotation angles, fault gradients near faults, fault_pitch, faultfunction setter #421 refinement); masks and regions stay in Python.
  4. On by default when installed; a configuration setting and an environment variable turn it off (the setting wins); a version mismatch falls back with one warning; prebuilt packages for Windows, macOS and Linux.
  5. Safe to use: public API unchanged, per-feature fallback, no stale data, the GIL released, thread-safe, configurable thread count.

Key decisions (clarifications)

  • Native results must meet the golden tolerance of spec 003 (1e-8 × the box size). The proof of concept does not yet (5.4e-5 m on a 1 km model); the plan must find the cause (C-007).
  • All built-in displacement profiles are supported; profiles given as Python functions use the Python path (C-010).
  • Targets: at 10 000 points, ≤ 20 % of the Python time on one thread and ≤ 3 % on 20 threads; the 94-fault test model evaluates 5000 points in ≤ 0.5 s (now 2.1 s).

Also

Next step: spec-planner, after spec 003 (#391) is merged.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XADRvHhG72666JkYNHtzUx

Spec 007 adds a native fault application that LoopStructural uses when
the native package is installed, with the Python path as the reference
and the fallback. Five stories: the restore order computed once per
feature (Python), native restoration, native values and gradients, on
by default with a switch and prebuilt packages, and safe use (public API,
fallback, no stale data, threads). Reviewed and clarified (C-001 to
C-011). research.md is the literature review of precomputed displacement
maps, kept as background.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XADRvHhG72666JkYNHtzUx
@lachlangrose
lachlangrose merged commit dc533a4 into master Nov 26, 2026
5 checks passed
@lachlangrose
lachlangrose deleted the docs/spec-007-native-fault-kernel branch November 26, 2026 23:21
lachlangrose added a commit that referenced this pull request Nov 27, 2026
…evaluation-performance

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XADRvHhG72666JkYNHtzUx
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