Repository navigation
Record the work of applying the trace when learning it - #394
Merged
Merged
Conversation
The F4 operations of the runs applying the trace are no longer counted: the linear algebra kernels do not increment the application counters, and the counts of a run were never added to the meta data of the caller, so the verbose output reported 0 Gops/sec for the learning and the application phases. Counting in the kernels would add work to their inner loops and needs care with several threads. The work of an application of the trace is the same for all primes, so it is now recorded in the trace when it is learned, outside the kernels. For each round, construct_trace adds to nmadd the lengths of the known pivots used by each row kept in the trace, that is the multiply-adds of the reductions of the rows by the known pivots, and to nterms the terms of the rows to be reduced and of the reducers used. add_lms_to_trace adds to nmadd_new the number of new elements of the round times their total length, an estimate of the multiply-adds of the reductions of the new rows by each other, which nmadd does not include. These quantities are meant for cost models choosing between strategies, such as the p-adic lifting of the parametrizations. In the verbose output of msolve_trace_qq and of the lifting of Gröbner bases, the rate of the application phase is computed from nmadd. The rate of the learning phase and the numbers of additions, multiplications and reductions printed at info level 3, which were always 0, are no longer printed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With probabilistic linear algebra (-l 42, 43 or 44), F4 learns no trace and the meta data has no trace to read the multiply-adds from, so msolve crashed when printing the rate of the application phase at info level 2. The rate is now printed only when a trace exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ederc
approved these changes
Nov 8, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The linear algebra no longer counts the F4 operations of the runs applying the trace (#390 removed the application counters from the kernels as unused, and the counts of a run were never added to the meta data of the caller anyway). As a result, the verbose output of
msolve_trace_qqand of the lifting of Gröbner bases always reported 0 Gops/sec for the learning and the application phases, and 0 additions, multiplications and reductions at info level 3.This PR records the work of an application of the trace in the trace itself, when it is learned. This work is the same for all primes, so it does not need to be counted at each run, and the kernels and their inner loops are not changed.
Changes
trace_t, summed over the rounds of the trace:nmadd: the multiply-adds of the reductions of the rows by the known pivots.construct_traceadds, for each row kept in the trace, the lengths of the known pivots marked in its reducer bit array. This is exactly the work of these reductions when the trace is applied.nterms: the terms of the rows of the matrices, that is the rows to be reduced (multiples of basis elements, whose lengthsconstruct_tracenow reads from the basis passed to it) and the reducers used.nmadd_new: an estimate of the multiply-adds of the reductions of the new rows by each other, whichnmadddoes not include: the number of new elements of a round times their total length, added byadd_lms_to_trace.nmadd. It is printed only when a trace is learned, which is not the case with the probabilistic linear algebra (-l 42or44). The rate of the learning phase and the numbers of additions, multiplications and reductions printed at info level 3, which were always 0, are no longer printed.These quantities do not depend on the prime nor on the number of threads, which makes them suitable for cost models choosing between strategies. They are meant for the cost model of the p-adic lifting of parametrizations (#391), which used the application counters removed by #390.
Testing
make checkpasses (73/73).-P 2 -t 2and with-g 2.-P 2and-g 2run with each of the options-l 2,42and44, at info levels 0, 2 and 3 (-l 1crashes on master too, independently of this PR).Parts of this PR were written with the assistance of Claude Code (Claude Opus 5.5); all changes were reviewed and tested by the author.
🤖 Generated with Claude Code