[Docs] Clarify multiple_of / max_contiguous / max_constancy semantics#10356
Merged
Jokeren merged 1 commit intoMay 26, 2026
Conversation
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.
Jokeren
approved these changes
May 22, 2026
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.
The current docstrings for
tl.multiple_of,tl.max_contiguous, andtl.max_constancydo not match the underlying semantics modeled byAxisInfo.multiple_ofdescribes 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_ofnow states thatvalues[d]is the largest power of two that divides the first element of every contiguous group along dimensiond.max_contiguousandmax_constancynow say that the input forms contiguous (resp. constant) groups of lengthvalues[d]along dimensiond, thatvaluesmust 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.hso the meaning is obvious from the rendered Sphinx page.multiple_ofandmax_contiguousnow 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.