Repository navigation
Conversation
Pre-merge checks:
|
| Check name | Status | Explanation |
|---|---|---|
| Pr Size | PR size check: the pull request changes 2 files, which is at or below the threshold of 40, so the check passes. Evidence: - The PR head is de41932. Its branch merges current origin/main (9c9cba5) vi… | |
| Public Resource Access | The check applies only to external resource references added or modified by this PR. The PR patch was taken against the merge base with origin/main (9c9cba5), which is the branch's point of divergenc… |
Full details: Pr Size
-
Explanation
PR size check: the pull request changes 2 files, which is at or below the threshold of 40, so the check passes. Evidence: - The PR head is de41932. Its branch merges current origin/main (9c9cba5) via merge commit 4e82cbf. -
git diff --name-status origin/main...HEAD(the PR-style diff against the base branch) lists exactly 2 files: - M packages/experimental/kumo-pytorch/src/kumo/pytorch/anchors.py - A packages/experimental/kumo-pytorch/tests/test_anchor_permutation.py - The PR-authored commits are 6c9a912 (implementation, 2 files) and de41932 (test follow-up, same 2 files). Caveat: the PR description names 9d15598 as its base. A raw diff from 9d15598 to HEAD shows 197 files. That count comes from the stale base, because main advanced and was merged into the branch. It does not reflect the PR's own changes. The provider-style diff against the base branch is 2 files, so the check passes on that basis. Line counts were ignored, as the check requires. The PR author is am-porter (provider-reported); author identity does not affect this check.
Full details: Public Resource Access
-
Explanation
The check applies only to external resource references added or modified by this PR. The PR patch was taken against the merge base with origin/main (9c9cba5), which is the branch's point of divergence from main. That diff touches two files: packages/experimental/kumo-pytorch/src/kumo/pytorch/anchors.py (+32/-2) and packages/experimental/kumo-pytorch/tests/test_anchor_permutation.py (+103). A search of every added line in that patch found no URL, git+ or ssh source, GitHub/PyPI/GitLab/Bitbucket location, or package source reference. The only links (rdl-platform
#140,#282,#164, and the change-map comment) appear in the PR description, not in changed repository files, and are not needed to build, test, or use the changed code. No added external resource reference exists, so the check passes. Note: a diff against the older base 9d15598 shows many unrelated UI files. Those changes come from main history that the branch merged in, not from this PR.
Full details: Change Map Design Review
-
Explanation
Summary: The change map (comment 6864860037, marker
<!-- kumo-pr-change-map -->) is present. Its design is sound at the core: vectorizing the existing permutation inanchors.pyis a necessary, correctly placed change, and it preserves the scalar sequence. The map still omits material behavior and overstates its bounded-storage and verification claims. That is a substantive issue under this check. Verified as accurate - Scope and problem: the scalar per-anchor loop inshard_positionsexisted before the PR (anchors.pylines 444–449 before this change). The PR adds_Permutation.many(lines 387–410) and a chunked loop (lines 445–449).manyapplies the same_mixrounds and cycle walk as__call__(lines 371–385). - Thresholds: scalar fallback below 64 positions and when_half > 31matches the code. - Chunk bound:step = 4096 * world_sizeyields at most 4096 positions per rank per chunk. This matches the map and the PR description. - Dependencies: NumPy is already declared inpyproject.toml(line 32), so the map's "no dependency change" claim holds. - Explicit-request path:PositionalAnchors.orderroutes toshard_positions, so the vector kernel covers that path. -#282exists in history (6042710f).#140and#164are external and could not be checked locally. Substantive issues (proven) 1. Omitted material behavior: full epoch materialization on delivery paths. The map says the change keeps "bounded temporary storage." That holds only for theshard_positionsiterator. The explicit-request path still builds the full order in memory: -task.pylines 443–456 (request_batches):chosen = list(padded_positions(anchors.order(...), ...)), thenanchors.fetch(...)over all positions. -assembly.pylines 2414–2423 (batches):order = list(shard_positions(...)). The map names explicit-request delivery as covered, but it does not disclose this. The "bounded" rationale is therefore misleading for end-to-end delivery. 2. Overstated verification. The map says the tests compare "across boundaries and large domains." Intests/test_anchor_permutation.py: - Exact vector-versus-scalar comparisons use sizes up to 10003, so_halfis at most 7. - The large-domain test compares only 5 positions. Those fall below 64, so they use the scalar fallback and never reach the vector kernel. - The2**40bounded-chunk test checks lengths only, not values. So exact parity for the vector kernel is not shown for_halfin 17..31. I found no defect in the arithmetic. This is a verification gap. Optional refinements (kept separate) - Streaming the two consumers above would fix issue 1. That is a separate change, not a requirement of this PR, unless bounded storage is a stated requirement. - The 64-position threshold and the 4096-per-rank chunk size have no stated rationale in the map. -manyreturns aliston the scalar branch and auint64ndarray on the vector branch.shard_positionstolerates both, so this is a design smell, not a behavior defect. I did not run the code. The arithmetic conclusions rest on reading the source.Resolution
Correct the change map and tests as follows: 1. Scope the bounded-storage claim. In the
anchors.pyrow and the Scope/verification text, state that chunking bounds onlyshard_positionsevaluation. State that explicit-request delivery (task.pyrequest_batches, lines 443–456) and theassembly.pybatchespath (lines 2414–2423) still materialize the full epoch order withlist(...). Remove "bounded temporary storage" from any end-to-end claim. 2. Decide the consumer behavior. Either (a) record streaming those consumers as a separate, optional follow-up outside this PR, or (b) if bounded storage is required for explicit requests, change those two call sites to consume the iterator in chunks in this PR, with a test that checks it. 3. Close the verification gap. Add an exact-parity test that forces the vector kernel (at least 64 positions, no scalar fallback) at a domain where_halfis between 17 and 31, for examplen = 2**32 + 1compared with the scalar__call__on a 4096-position window. Also correct the map's "large domains" wording to match what the tests exercise. Alternatively, state the gap explicitly. 4. Optional. Give the 64-position threshold and 4096-per-rank chunk rationale. Makemanyreturn one type on both branches.
Latest assessment: Change Map Design Review
-
Latest assessment: The latest assessment was inconclusive; the previous failure remains unresolved.
Latest explanation: The check assesses the PR conversation comment that starts with
<!-- kumo-pr-change-map -->. That comment is not in the checkout. The only marker hit is the rule indocs/development/review.md. Its text is available only through the prior failure's quotation, so I cannot confirm whether the map was edited after that run. Code evidence at current HEAD: - Verification gap (prior issue 2): addressed in code. Commitde41932dadded a test intests/test_anchor_permutation.py. It compares exact vector-versus-scalar output forhalf17 through 31, using 4,096-position start, middle and end windows. It also monkeypatches scalar__call__to fail, so the vector kernel must run. Whether the map's "large domains" wording was corrected is unverified. - Bounded-storage claim (prior issue 1): still applies in code.anchors.pylines 445–449 chunk only theshard_positionsiterator.task.pylines 443–456 (request_batches) still calllist(padded_positions(anchors.order(...))).assembly.pylines 2425–2434 (batches) still callorder = list(shard_positions(...)). The PR description states this limit. The map must scope "bounded" toshard_positions, and I cannot confirm that it does. - Design: Placing the vector kernel in_Permutation.manyand the chunk loop inshard_positionsfits the existing abstraction. NumPy is already a declared dependency (pyproject.tomlline 32). The scalar fallback for fewer than 64 positions and for_half > 31is present.manyreturns aliston the scalar branch and auint64ndarray on the vector branch. This is a design smell, not a proven defect. I did not find a proven defect in the arithmetic or the changed code.Latest resolution: To reach a verdict, provide the text of comment 6864860037 (or the current
<!-- kumo-pr-change-map -->comment), or enable PR-comment retrieval for this check. Then verify these items in the map: 1. In theanchors.pyrow and the Scope/verification text, state that chunking bounds onlyshard_positionsevaluation. State thattask.pyrequest_batches(lines 443–456) andassembly.pybatches(lines 2425–2434) still materialize the full epoch order withlist(...). Remove "bounded temporary storage" from any end-to-end claim. 2. Either record streaming those two consumers as a separate optional follow-up, or change them in this PR with a test. 3. Cite thede41932dlarge-domain test (half 17–31, 4,096-position windows, scalar fallback disabled) as the verification for the vector kernel. Correct "large domains" wording to match the tests. 4. Optional: give the 64-position threshold and the 4,096-per-rank chunk rationale. Makemanyreturn one type on both branches.
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Scope and verificationThe default positional shuffle still performs scalar Python mixing for every anchor. This PR batches that arithmetic while preserving exact seed/epoch/rank order. Merged #282 supplies native anchor/model batching; this optimization is independent of #164. The 4,096-position bound applies only to temporary evaluation in The threshold of 64 avoids array setup for tiny inputs; chunks of 4,096 amortize vector operations while limiting temporary arrays independently of epoch size. These are engineering choices, not measured universal optima. Scalar fallback also preserves arbitrary-size integer domains. The private helper retains list/ndarray returns; its caller accepts either, and return-type normalization is optional. Review-fix validation: Original implementation evidence: package lint/format, license headers and distribution builds passed. In-memory conformance had 521 passes and 19 missing-DiskGraph errors, identical on its unmodified base; full native conformance was not run locally. Those broader checks and the original 400,000-anchor permutation-only timing were not rerun for this test/docstring follow-up. Change map
|
|
Could you make the limited applicability explicit in the summary/performance discussion? This optimizes Python positional/request-based shuffling; it does not change the DG-native batch iterator used by the primary kumo.pytorch graph and sequence loading paths, including native length-aware planning. The 17.5x measurement is permutation arithmetic only, not loader throughput. Our direction is to move production consumers to native AnchorTable iteration and remove the public |
Summary
Carry the remaining shuffle optimization from closed rdl-platform #140 into
kumo.pytorch.Explicit-request and positional-anchor paths still evaluate the default permutation one row at a time. Evaluate the same integer mixing and cycle walking in chunks of at most 4,096 positions, preserving exact seed/epoch/rank order. Tiny batches and very large integer domains retain scalar evaluation.
Merged #282 already provides native anchor/model batch delivery; its native stage scheduling stays unchanged. This PR needs neither #164 nor its columnar sampling APIs. No public API, output ordering, dependencies, guarantees or native code change.
The 4,096-position bound applies only to temporary permutation evaluation in
shard_positions. Explicit-request delivery intask.py::request_batchesand theassembly.py::batchespath still materialize the full epoch order withlist(...). Streaming these consumers is a separate optional follow-up.Testing Done
tests/test_anchor_permutation.py tests/test_anchor_tables.py), including 45 new exact-parity cases that forbid scalar fallback: 4,096-position windows at the start, middle and end of domains covering every half-width from 17 through 31. Existing chunk/power-of-two boundaries, huge-domain fallback, bounded evaluation, rank sequences and task delivery also pass. Changed-file Ruff check/format andgit diff --checkpass.git diff --checkpassed.9d155981has the identical 19 failures. Full native conformance was not run locally.Change map
File-by-file change map.
Checklist