Skip to content

Add Index Stride Type Support - #1265

Merged
cliffburdick merged 6 commits into
NVIDIA:mainfrom
MashrafeeAryan:maryan/index-stride-type-support
Oct 19, 2026
Merged

cliffburdick merged 6 commits into
NVIDIA:mainfrom
MashrafeeAryan:maryan/index-stride-type-support

Conversation

@MashrafeeAryan

Copy link
Copy Markdown
Contributor

What this does

Allows tensor sizes and strides to use different integer widths.

  1. Adds two independent build options:

    • MATX_BUILD_32_BIT_SIZES enables 32-bit sizes and logical indexes.
    • MATX_BUILD_32_BIT_STRIDES enables 32-bit strides and memory offsets.
  2. Keeps MATX_BUILD_32_BIT working as before by enabling both options. The default is still 64-bit sizes and 64-bit strides.

  3. This uses index_t for sizes and logical indexes, and offset_t is used for strides and memory offsets.

Testing

Tests were added for

  • 64-bit sizes / 64-bit strides
  • 32-bit sizes / 64-bit strides
  • 64-bit sizes / 32-bit strides
  • 32-bit sizes / 32-bit strides

Testing was done using:

  • Google Colab
  • Tesla T4 GPU
  • CUDA 13.0.88
  • GCC 13.3.0
  • C++20

I couldn't run all of the tests. The build is taking longer than expected. The latest run I did is still running for the past hour. I would really appreciate it if anyone would run the workflow for the tests and I can work any errors if tests fail.

Documentation

I updated docs_input/build.rst to explain the separate options and how MATX_BUILD_32_BIT enables both.

Related issue

Closes #387

Explain the independent size and stride flags, the compatibility option, and the default 64-bit types. Clarify the limits of 32-bit types.
Fix stride conversions, overflow checks, and JIT settings. Add regression tests.
@copy-pr-bot

copy-pr-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@cliffburdick

Copy link
Copy Markdown
Collaborator

/build

@greptile-apps

greptile-apps Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The reviewed changes appear safe to merge; no blocking issue remains.

Summary

The PR separates tensor size and stride widths while keeping MATX_BUILD_32_BIT as the option that enables both.

  • MatX builds can choose size and stride widths separately.
  • Tensor views keep size and stride widths separate.
  • Tensor operations use stride widths to reach memory.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  S[Size width option] --> I[index_t]
  T[Stride width option] --> O[offset_t]
  I --> L[Sizes and logical indexes]
  O --> M[Strides and memory offsets]
  D[Custom descriptor] --> W[Its own stride_type]
  W --> A[Gathering and tensor access]
Loading

Reviews (4) · Last reviewed commit: "Fix size and stride handling issues" · Reviewed by Greptile

Comment thread include/matx/core/make_tensor.h Resolved
Comment thread include/matx/core/distributed_tensor.h Resolved
Comment thread include/matx/core/print.h Resolved
Keep both headers and make upstream alias checks work with separate size and stride types.
Comment thread include/matx/kernels/tensor_accessor.h Resolved
Comment thread include/matx/operators/base_operator.h Resolved
@MashrafeeAryan
MashrafeeAryan marked this pull request as draft October 14, 2026 17:58
Preserve custom stride widths in copies, accessors, alias checks, and printing. Check DLPack element counts against the index limit. Add regression tests and clarify the documentation.
@MashrafeeAryan
MashrafeeAryan marked this pull request as ready for review October 14, 2026 19:08
@MashrafeeAryan

Copy link
Copy Markdown
Contributor Author

Hi @cliffburdick, I fixed the issues Greptile pointed out. I would really appreciate some feedback whenever you have time. Thank you so much!

@cliffburdick

Copy link
Copy Markdown
Collaborator

/build

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage is 93.629% — MashrafeeAryan:maryan/index-stride-type-support into NVIDIA:main. No base build found for NVIDIA:main.

@cliffburdick
cliffburdick merged commit 11203c9 into NVIDIA:main Oct 19, 2026
2 checks passed
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.

[FEA] Support different index/stride types

3 participants