Skip to content

Unify Resolution structs with runtime dispatch - #4

Open
JoeyBF wants to merge 1 commit into
masterfrom
unify-resolution-runtime-dispatch
Open

JoeyBF wants to merge 1 commit into
masterfrom
unify-resolution-runtime-dispatch

Conversation

@JoeyBF

@JoeyBF JoeyBF commented Mar 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replaces the compile-time nassau feature flag with a QueryModuleResolution enum that dispatches to the standard or Nassau algorithm at runtime
  • nassau::Resolution now uses SteenrodAlgebra/CCC types externally (matching the standard resolution's associated types), with a milnor_algebra() helper for internal algorithm operations
  • construct() auto-detects Nassau when conditions are met (p=2, Milnor, finite-dimensional, no profile/cofiber) and a save directory is provided; without a save dir, standard is used to preserve in-memory quasi-inverse support
  • All #[cfg(feature = "nassau")] blocks removed from examples, utilities, and tests
  • Deleted 9 nassau-specific benchmark files (standard benchmarks now cover them)

Test plan

  • make lint passes
  • make test passes (all lib, integration, doc, and pytest tests)
  • make benchmarks passes (output unchanged)
  • cargo test --test milnor_vs_nassau confirms nassau and standard produce identical output

🤖 Generated with Claude Code

Replace the compile-time `nassau` feature flag with a single
`QueryModuleResolution` enum that dispatches to either the standard
or Nassau algorithm at runtime.

Key changes:
- `nassau::Resolution` no longer has a type parameter; it now uses
  `SteenrodAlgebra`/`CCC` types externally, matching the standard
  resolution's associated types. A `milnor_algebra()` helper extracts
  `&MilnorAlgebra` internally for algorithm-specific operations.
- `QueryModuleResolution` enum (Standard/Nassau) implements
  `ChainComplex` and `AugmentedChainComplex` via a `delegate!` macro,
  picking up the `FreeChainComplex` blanket impl automatically.
- `construct()` auto-detects Nassau when: Milnor basis, p=2, finite
  dimensional module, no profile, no cofiber, and a save directory is
  provided. Without a save directory, standard is used to preserve
  in-memory quasi-inverse support for `ResolutionHomomorphism` and
  `SecondaryResolution`.
- All `#[cfg(feature = "nassau")]` blocks removed from examples and
  utilities.
- Nassau benchmark files deleted (standard benchmarks now cover them).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
JoeyBF added a commit that referenced this pull request Sep 13, 2026
`MATRIX_GROUP x TERM_GROUP` was last closed by arguing from the loop's instruction mix that a wider
tile amortises more `col_sums`/`masks` loads per pair. It does -- and it is slower anyway. ncu over
one whole replayed frontier batch (the same 463 089 captured products through every arm, clocks
locked, the 2x3 arm repeated and reproducing to 0.005%):

  2x2  56 regs  9.310e11 inst  2.2904e9 cycles   15.6% slower
  2x3  63 regs  7.744e11 inst  1.9821e9 cycles   --
  3x3  76 regs  6.844e11 inst  2.0331e9 cycles    2.6% slower
  4x2  64 regs  7.090e11 inst  2.0643e9 cycles    4.1% slower
  4x3  80 regs  6.071e11 inst  2.0894e9 cycles    5.4% slower

Above 2x3 instructions and time move in OPPOSITE directions: 4x3 issues 21.6% fewer instructions
and takes 5.4% longer. The discriminator is registers -- 63 and 64 both fit four 256-thread blocks
per SM, 76 and 80 only three -- so the amortisation argument was measuring the wrong quantity. What
a wider tile removes is address arithmetic that already overlapped with the loads it serves.

The comparison has to be per whole BATCH, not per launch: the tile changes threads per product, so
it changes both how a batch is grouped into blocks (5 at 2x3, 3 at 4x3, 7 at 2x2) and how each
block is chunked at 2^31 threads. "Launch #4" is different work for two tiles, and `pairs` in the
`[launch]` log is a thread count, not a product count.

No code change; 2x3 stays. Recorded so the next tile question is answered by reading the table.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RuauwDGczEvcusxMZB8Vvs
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