Skip to content

[lang] Fix Array.slice with integer bounds - #110

Open
samridh10exe wants to merge 1 commit into
NVIDIA:mainfrom
samridh10exe:samridh10exe/bug-lang-array-slice
Open

samridh10exe wants to merge 1 commit into
NVIDIA:mainfrom
samridh10exe:samridh10exe/bug-lang-array-slice

Conversation

@samridh10exe

Copy link
Copy Markdown

Description

Array.slice() failed type checking in cuda.lang for any start and stop, including integer literals. The shared implementation expects 0D tiles and builds the view with cuTile pointer ops, while cuda.lang uses scalars and its own pointers.

Add a cuda.lang implementation that builds the view with PointerOffset and Array.from_parts, like array_getitem, and keeps the same checks on start and stop. The new tests in test_slice.py cover constant bounds, runtime bounds on the last axis, and the rejected cases.

I couldn't run the GPU tests, since mlir2cubin is not in the public build. On CPU, the kernels from the new tests fail type checking before this change and lower to IR after it, with the view offset at start * stride and the axis size stop - start.

closes #101

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Signed-off-by: Samridh <109811970+samridh10exe@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: cuda.lang Array.slice rejects valid integer bounds as non-tile scalars

1 participant