Skip to content

[Docs] Clarify multiple_of / max_contiguous / max_constancy semantics#10356

Merged
Jokeren merged 1 commit into
triton-lang:mainfrom
adityasingh2400:docs-multiple-of-max-contiguous-max-constancy
May 26, 2026
Merged

[Docs] Clarify multiple_of / max_contiguous / max_constancy semantics#10356
Jokeren merged 1 commit into
triton-lang:mainfrom
adityasingh2400:docs-multiple-of-max-contiguous-max-constancy

Conversation

@adityasingh2400
Copy link
Copy Markdown
Contributor

The current docstrings for tl.multiple_of, tl.max_contiguous, and tl.max_constancy do not match the underlying semantics modeled by AxisInfo. multiple_of describes its argument as "multiples of value" without explaining how the hint composes with contiguity, and the other two use the phrase "the value first values in input are contiguous/constant", which conflates the hint with its per-dimension length argument and confused at least one reader (#1324).

This PR rewrites each docstring to mirror the precise definitions in include/triton/Analysis/AxisInfo.h. multiple_of now states that values[d] is the largest power of two that divides the first element of every contiguous group along dimension d. max_contiguous and max_constancy now say that the input forms contiguous (resp. constant) groups of length values[d] along dimension d, that values must have one entry per dimension, and that each entry must be a power of two.

Each docstring includes a concrete 1D example taken from AxisInfo.h so the meaning is obvious from the rendered Sphinx page. multiple_of and max_contiguous now cross-reference each other via :func: so users can see how they compose to enable vectorized memory accesses. Behavior is unchanged; this is documentation only.

Closes #1324.

The existing docstrings for these three hint functions in
triton.language did not match the underlying semantics modeled by
AxisInfo. multiple_of described the values as "multiples of value"
without addressing how the hint interacts with contiguity, and
max_contiguous and max_constancy used the misleading phrase "the value
first values in input are contiguous/constant", which conflated the
hint name with the function's per-dimension length argument.

This change rewrites each docstring to mirror the precise definitions
in include/triton/Analysis/AxisInfo.h: contiguity[d] is the length of
the contiguous run along dimension d, divisibility[d] is the largest
power of two that divides the first element of each such run, and
constancy[d] is the length of a constant run. Each docstring now states
that values must have one entry per dimension, includes a concrete 1D
example matching AxisInfo.h, and cross-references the related hints
so users can see how multiple_of and max_contiguous compose for
vectorized memory accesses.

Closes triton-lang#1324.
@adityasingh2400 adityasingh2400 requested a review from ptillet as a code owner May 22, 2026 12:40
@Jokeren Jokeren enabled auto-merge (squash) May 26, 2026 13:26
@Jokeren Jokeren merged commit c517f38 into triton-lang:main May 26, 2026
10 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.

Fix multiple_of documentation and document max_contiguous.

2 participants