-
Notifications
You must be signed in to change notification settings - Fork 17
Motivic foundation: A_C, the C-motivic Steenrod algebra engine over F₂[τ] #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JoeyBF
merged 15 commits into
SpectralSequences:master
from
JoeyBF:claude/motivic-algebra-engine
Aug 31, 2026
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
58bfbfe
motivic: A_C, the C-motivic Steenrod algebra engine over F₂[τ]
claude a6f269d
motivic: add a criterion bench for the C-motivic engine
JoeyBF 4588992
motivic: rework the monomial and coefficient representation
JoeyBF 5322999
algebra: extract next_disjoint from the Milnor multiplier
JoeyBF 1ba525f
motivic: address the review comments on the tau and coefficient code
JoeyBF 6c11c73
motivic: drop the tau coefficient, which the weight already determines
JoeyBF 2324a95
motivic: give the A_C reading of a monomial its own type
JoeyBF 4bbc3f1
motivic: trim the engine after the tau removal
JoeyBF b1b0a2d
motivic: speed up the closed-form product
JoeyBF c9e1982
motivic: bound the Y walk by the degree equation instead of testing i…
JoeyBF 0c2e11b
motivic: cut the Y walk on the square-free condition, and skip infeas…
JoeyBF 0b7bb1a
motivic: compute the mod-tau product directly instead of filtering th…
JoeyBF 967b357
motivic: trim the comments before merge
JoeyBF 1a5b488
motivic: drop the basis-element string API
JoeyBF 25855a4
motivic: fix a compute_basis race, and build the slack table only for…
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,3 +55,7 @@ harness = false | |
| [[bench]] | ||
| name = "nassau_milnor" | ||
| harness = false | ||
|
|
||
| [[bench]] | ||
| name = "motivic" | ||
| harness = false | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| //! Benchmarks for the C-motivic Steenrod algebra engine. | ||
| //! | ||
| //! Three levels, from the kernel outwards: | ||
| //! | ||
| //! - `motivic_product` — a single [`multiply_closed`], the Kong–Lin Theorem 5.1 product. This is | ||
| //! the arithmetic the whole layer is built on. | ||
| //! - `motivic_block` — [`MotivicMilnorAlgebra::fill_block`], the batch unit a resolution actually | ||
| //! asks for: every structure constant for one pair of topological degrees. Throughput is in | ||
| //! structure constants, so the numbers are comparable across degrees. | ||
| //! - `motivic_basis` — [`enum_basis`], the basis enumeration each new degree pays once. | ||
| //! | ||
| //! The `motivic_block` group is the one to watch when changing the coefficient representation: | ||
| //! it is the only group that exercises the `DualElement` map, the index lookup, and the product | ||
| //! together, in the proportion a resolution hits them. | ||
|
|
||
| use algebra::{ | ||
| MotivicMilnorAlgebra, | ||
| motivic::milnor::{Dual, Monomial, enum_basis, multiply_closed}, | ||
| }; | ||
| use criterion::{ | ||
| BenchmarkGroup, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main, | ||
| measurement::WallTime, | ||
| }; | ||
| use pprof::criterion::{Output, PProfProfiler}; | ||
|
|
||
| /// `Q(E)P(R)` from the `Q` indices and the ξ exponents, in the paper's indexing where `R[0]` | ||
| /// belongs to ξ_0 = 1 and is skipped. | ||
| fn elt(q: &[u32], xi: &[u32]) -> Dual<Monomial> { | ||
| let mut r = vec![0]; | ||
| r.extend_from_slice(xi); | ||
| Dual(Monomial::from_paper(q.iter().map(|i| 1 << i).sum(), &r).unwrap()) | ||
| } | ||
|
|
||
| fn bench_product( | ||
| g: &mut BenchmarkGroup<WallTime>, | ||
| name: &str, | ||
| a: Dual<Monomial>, | ||
| b: Dual<Monomial>, | ||
| ) { | ||
| g.bench_function(name, |bench| { | ||
| bench.iter(|| std::hint::black_box(multiply_closed(a, b))); | ||
| }); | ||
| } | ||
|
|
||
| fn product(c: &mut Criterion) { | ||
| let mut g = c.benchmark_group("motivic_product"); | ||
|
|
||
| // Pure ξ: the classical Milnor-matrix part of the formula, with no Y enumeration. | ||
| bench_product(&mut g, "xi/small", elt(&[], &[2]), elt(&[], &[2])); | ||
| bench_product(&mut g, "xi/medium", elt(&[], &[4, 1]), elt(&[], &[2, 1])); | ||
| bench_product(&mut g, "xi/large", elt(&[], &[6, 2, 1]), elt(&[], &[4, 1])); | ||
|
|
||
| // With a Q-part, which is what turns on the second (`Y`) matrix and the τ-rewriting. | ||
| bench_product(&mut g, "q/small", elt(&[0], &[1]), elt(&[1], &[1])); | ||
| bench_product(&mut g, "q/medium", elt(&[0, 1], &[2]), elt(&[2], &[1, 1])); | ||
| bench_product(&mut g, "q/large", elt(&[0, 2], &[3, 1]), elt(&[1], &[2, 1])); | ||
|
|
||
| g.finish(); | ||
| } | ||
|
|
||
| fn block(c: &mut Criterion) { | ||
| let mut g = c.benchmark_group("motivic_block"); | ||
|
|
||
| for t in [12, 16, 20] { | ||
| // Size the throughput by the number of structure constants in the block, so the | ||
| // per-product cost is comparable across degrees. | ||
| let dims = { | ||
| let alg = MotivicMilnorAlgebra::new(); | ||
| alg.compute_basis(t); | ||
| alg.dimension(t) | ||
| }; | ||
| g.throughput(Throughput::Elements((dims * dims) as u64)); | ||
| g.bench_with_input(BenchmarkId::from_parameter(t), &t, |bench, &t| { | ||
| // A fresh algebra per iteration: `fill_block` is memoized, so reusing one would | ||
| // measure the cache rather than the product. | ||
| bench.iter_batched( | ||
| MotivicMilnorAlgebra::new, | ||
| |alg| alg.fill_block(t, t), | ||
| criterion::BatchSize::SmallInput, | ||
| ); | ||
| }); | ||
| } | ||
|
|
||
| g.finish(); | ||
| } | ||
|
|
||
| fn basis(c: &mut Criterion) { | ||
| let mut g = c.benchmark_group("motivic_basis"); | ||
|
|
||
| for t in [20, 30, 40] { | ||
| g.bench_with_input(BenchmarkId::from_parameter(t), &t, |bench, &t| { | ||
| bench.iter(|| std::hint::black_box(enum_basis(t))); | ||
| }); | ||
| } | ||
|
|
||
| g.finish(); | ||
| } | ||
|
|
||
| criterion_group! { | ||
| name = benches; | ||
| config = Criterion::default() | ||
| .measurement_time(std::time::Duration::from_secs(3)) | ||
| .with_profiler(PProfProfiler::new(100, Output::Flamegraph(None))); | ||
| targets = product, block, basis | ||
| } | ||
| criterion_main!(benches); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: SpectralSequences/sseq
Length of output: 34554
🏁 Script executed:
Repository: SpectralSequences/sseq
Length of output: 27221
🏁 Script executed:
Repository: SpectralSequences/sseq
Length of output: 5075
🌐 Web query:
Criterion 0.5.0 Bencher iter_batched iter_batched_ref source timing drop behavior💡 Result:
In Criterion.rs 0.5.0, the
iter_batchedanditer_batched_refmethods are designed to benchmark routines that require per-iteration setup that should not be included in the measurement [1][2]. Both methods generate a batch of inputs using a provided setup function, run the routine on those inputs, and then collect/drop the outputs [2]. The critical difference regarding drop behavior between these two methods relates to the setup value [1][3]: -iter_batched(which takes the setup value by value,FnMut(I) -> O): If the setup value implementsDrop, the time required to drop that setup value is included in the measurement [1][3]. -iter_batched_ref(which takes the setup value by mutable reference,FnMut(&mut I) -> O): If you do not want to include the time required to drop the setup value in the measurement, you should useiter_batched_refinstead ofiter_batched[1][3]. For both methods, the overhead of dropping the output value (returned by the routine) is excluded from the measurement [1][2]. Criterion achieves this by collecting the outputs into a vector and dropping them outside of the timed section [3][4]. In summary, useiter_batched_refif you have an expensiveDropimplementation for your input/setup value and wish to exclude it from your benchmark results; otherwise,iter_batchedis acceptable [1][3].Citations:
🏁 Script executed:
Repository: SpectralSequences/sseq
Length of output: 5614
Exclude populated-algebra destruction from the block timing.
iter_batchedpasses ownership ofMotivicMilnorAlgebrato the timed closure. The populated cache is then dropped with the algebra. Useiter_batched_refwithBatchSize::PerIteration.🤖 Prompt for AI Agents