Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 77 additions & 13 deletions .github/development/DEFERRED_ISSUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ Next step: Include the fix in the next release and record its version here.

## Empty inputs return an uninitialized integer

Status: Implemented and tested locally; not yet merged or released; separate from [issue #9](https://github.com/jwood000/RcppBigIntAlgos/issues/9)
Status: Resolved in main; merged in [PR #18](https://github.com/jwood000/RcppBigIntAlgos/pull/18) (`7171778`); not yet released; separate from [issue #9](https://github.com/jwood000/RcppBigIntAlgos/issues/9)
Priority: Medium
Evidence: Source inspection and failing-before/passing-after public-API regressions

Expand Down Expand Up @@ -343,26 +343,90 @@ test review found no correctness defects. No sanitizers were run, and no CI
workflows or dependencies changed. This validation does not include
`--as-cran` or cross-platform checks.

Next step: Review and merge the fix, then record its merge and release here.
Next step: Include the fix in the next release and record its version here.

## Parallel polynomial scheduling estimates work after completion

Status: Open
Status: Implemented and tested locally; not yet merged or released
Priority: Medium
Evidence: Isolated arithmetic reproduction under Clang's float-cast-overflow sanitizer
Evidence: Source review, guarded native baseline comparison, and serial/parallel public-API checks

`SetThreadsPolys()` in [Polynomial.cpp](../../src/Polynomial.cpp) is called
after merging a batch, before rechecking whether enough relations have been
collected. For `currLim = 2010`, `SaPThresh = 2000`, and `nPolys = 1000`, its
remaining-work estimate is approximately `-3.65559`. Converting that value
to `std::size_t` is undefined; the isolated sanitizer check reported it.
This was not a full-package sanitizer run or an observed user-facing crash.

Next step: Handle a reached/exceeded target before estimating remaining work.
Keep the result consistent with subsequent serial collection and solution
search. Check values below, at, and above the target, including a large
overshoot; avoid invalid logarithms and negative/NaN conversions. Remaining
work should produce a bounded batch or an explicit serial fallback.
old remaining-work estimate was approximately `-3.65559`. Converting that
value to `std::size_t` is undefined. The original investigation reproduced
this arithmetic with Clang's float-cast-overflow sanitizer; no sanitizers are
used for the current fix. A public-API crash has not been established.

The helper now returns no parallel work before evaluating the estimate when
the target is reached or exceeded. It checks floating estimates before
conversion and bounds duration arithmetic before performing it. The original
integer-clock multiplication/division order, tick truncation, and 15/30-second
comparisons are retained. Guards use chrono's actual promoted representation,
which can be unsigned even when the clock itself has a signed representation.
Both duration products and common-period conversions are checked. A positive
elapsed duration whose average truncates to zero ticks still gets the original
full batch; a time limit yielding zero polynomials instead takes the existing
serial fallback.

Boundary regressions specifically protect old valid schedules that a
floating-seconds rewrite changed: three workers with 25 polynomials each at
the 30-second boundary plus 100 nanoseconds; eight workers with one polynomial
each at the one-polynomial limit plus one nanosecond; and an exact 30-second
average with 25 workers where floating-point rounding would force serial
collection. Neighboring tick-crossing cases verify the original transitions.

Both scheduling outputs are cleared on fallback. Zero polynomial counts,
insufficient worker limits, invalid timing measurements, and unrepresentable
estimates also take that path; these are defensive helper boundaries, not
additional public-API failures. The surrounding parallel/serial loops, the
ten-relation threshold increment, and the strict solution-readiness comparison
remain unchanged. Reaching the current target stops further parallel batches
without prematurely declaring solution readiness.

The development-only [native runner](test-polynomial-scheduling.R) passes all
50 cases with the production helper extracted verbatim. Cases cover target
completion and overshoot, invalid/range-limited estimates, worker limits,
integer timing boundaries, duration overflow guards, common-period conversion,
and nonempty bounded batches. Against baseline `7171778`, an instrumented
comparison fails 21 of 43 cases and passes 22. It replaces
only the old remaining-count declaration with a checked conversion wrapper;
five cases are stopped before an invalid conversion could execute. Other
failures expose stale output values or invalid scheduling decisions under the
fallback contract. Seven synthetic cases run only against the fixed
helper. No original undefined conversion is executed by this comparison, and
it is not a public-API crash reproduction. The runner remains excluded from
the package archive and CI; commands and prerequisites are in
[testing.md](testing.md).

The earlier floating-seconds implementation fails five of these 50 cases:
four integer-clock scheduling regressions and a fine-period conversion guard.
A separate native comparison of extracted helpers matches all 166,048 safe,
nonempty original parallel schedules with positive elapsed time. This includes
55,724 zero-tick averages, nanosecond/millisecond/second clocks, unsigned and
fractional-period clocks, and adjacent timing boundaries. Unsafe, inactive,
and zero-work original schedules are excluded before comparison. This checks
scheduling decisions; it is not an end-to-end performance benchmark.

Four new package expectations in
[testQuadraticSieve.R](../../tests/testthat/testQuadraticSieve.R) check exact
sorted factors and reconstruction of the fixed 162-bit semiprime
`2923003274661805836407421649242809468366377451741` with one and two threads.
Its prime factors are `1208925819614629174706189` and
`2417851639229258349412369`. Baseline statistics confirm MPQS is reached and
the two-thread run enters parallel batches. These output checks pass both
before and after the fix; the native cases establish the boundary regression.

A fresh source-archive `R CMD check --no-manual` finishes with `Status: OK`.
All 500 expectations across 34 blocks pass with no failures, warnings, or
skips, using R 4.6.1 / Apple Clang 17 on macOS arm64. Repository indexes were
unavailable; installed dependencies were sufficient. Independent source and
native-runner review found no actionable defects. No sanitizers were run, and
no CI workflows or package dependencies changed. This validation does not
include `--as-cran` or cross-platform checks.

Next step: Review and merge the fix, then record its merge and release here.

## Relation storage retains unused polynomials and zero-parity columns

Expand Down
Loading
Loading