Repository navigation
Indexing: tile-grid scans, device mask packing, device folded offsets, repeat - #39
Open
AdvaitTahilyani wants to merge 9 commits into
Open
AdvaitTahilyani wants to merge 9 commits into
AdvaitTahilyani wants to merge 9 commits into
Conversation
…, repeat - Index ops: row offsets by a scan of the tile grid - Unaligned masks: device pack and device message - repeat: scalar counts without an index array, host counts on the device - Folded arrays: index-array offsets built on the device - test_index_scale: unaligned masks, tile-grid scans, repeat, folded index arrays - COMPRESS / MASK_SCATTER / EXPAND elements: CUDA IPC to processes on the host - Index ops review fixes: kind-first dispatch, procNum, folded basic keys Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 6, 2026
adityapb
reviewed
Nov 6, 2026
adityapb
left a comment
Member
There was a problem hiding this comment.
Verdict: approve with nits.
I checked two parts with NumPy models:
- The frontend
_folded_plan, copied verbatim, plus a model of the backend GATHER rules, compared withx[key]for 24 keys on 4-D and 5-D arrays: all match. - The row-offset scan on 300 random views with uneven tiles, offsets, steps and random message order: all correct.
Line numbers are at this PR's head.
- [minor, regression] Out-of-range device indices on >3-D arrays are now dropped instead of raising.
_folded_plan(indexing.py:633-634) now uses_wrap_device(..., oob). Before,_host_keyfetched device index arrays and NumPy raisedIndexError.- Example:
x = cnp.asarray(np.zeros((2,3,4,5))); x[cnp.asarray([0, 2])]used to raise and now returns a block of zeros. - The
folded.pydocstring doesn't mention it, andtest_index_scale.py:203uses a host list, so the test doesn't cover it.
- [minor] The float device-repeats crash from #21 still reaches the new root abort (
executor_indexing.cpp:1022). This PR addedcasting="safe"for host counts (indexing.py:946) but not for device counts. - Nit: "scalar
repeatno longer builds an int64 index array" only holds foraxis=Noneor 1-D input. N-D input with an axis still buildsarange(n*r) // r(indexing.py:940-943). - Nit: there are no tests for:
- a duplicate-index scatter on folded arrays;
- out-of-range device indices on folded arrays;
- float device repeats.
…ger repeats Folded device index arrays (mode "raise") get one blocking min/max get, so an out-of-range entry raises IndexError as before instead of being dropped. Device repeats must cast safely to int64 (float counts aborted the server), as must scalar repeats. Tests: OOB folded device indices, duplicate-index scatter on folded arrays, float device repeats. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Validated: CPU regress +p1/+p2 (orig 15/15, ports 25/25, ops 34/34, |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
repeatwithaxis=Noneor 1-D input no longer builds an int64 index array (N-D input with an axis still gathers witharange(n*r) // r).IndexError; non-integerrepeatcounts raiseTypeError.F[idx](before the bounds check)Adds
test_index_scale(244 checks).🤖 Generated with Claude Code