Skip to content

[AMD] CanonicalizePointers: Handle different base pointers and offsets#9541

Merged
antiagainst merged 2 commits into
triton-lang:mainfrom
kelesvol:canon-ptr
Mar 13, 2026
Merged

[AMD] CanonicalizePointers: Handle different base pointers and offsets#9541
antiagainst merged 2 commits into
triton-lang:mainfrom
kelesvol:canon-ptr

Conversation

@kelesvol

Copy link
Copy Markdown
Contributor

scf.if and arith.select ops can have different base pointers accross branches. In that case, FatPtrAttrs can't keep smallTensorBase or pick one of the branches. Instead, replace smallTensorBase (Value) with isSmallTensor (bool) in FatPtrAttrs and add a conservative merge function for combining attrs. Also, handle different scalar offsets properly when handling arith.select ops.

@kelesvol

Copy link
Copy Markdown
Contributor Author

cc @AlexAUT

@AlexAUT AlexAUT left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this, looks reasonable to me. cc @yangshuxin since he also touched this pass IIRC.

Comment thread third_party/amd/lib/TritonAMDGPUTransforms/CanonicalizePointers.cpp Outdated
Comment thread third_party/amd/lib/TritonAMDGPUTransforms/CanonicalizePointers.cpp Outdated
Comment thread third_party/amd/lib/TritonAMDGPUTransforms/CanonicalizePointers.cpp Outdated
Comment thread third_party/amd/lib/TritonAMDGPUTransforms/CanonicalizePointers.cpp
Comment thread third_party/amd/lib/TritonAMDGPUTransforms/CanonicalizePointers.cpp
`scf.if` and `arith.select` ops can have different base pointers accross
branches. In that case, `FatPtrAttrs` can't keep `smallTensorBase` or pick
one of the branches. Instead, replace `smallTensorBase` (Value) with
`isSmallTensor` (bool) in `FatPtrAttrs` and add a conservative `intersect`
function for combining attrs. Also, handle different scalar offsets properly
when handling `arith.select` ops.
@antiagainst antiagainst enabled auto-merge (squash) March 12, 2026 23:09
@antiagainst antiagainst merged commit dd998b6 into triton-lang:main Mar 13, 2026
16 of 18 checks passed
raymondtay pushed a commit to raymondtay/triton that referenced this pull request Mar 22, 2026
triton-lang#9541)

`scf.if` and `arith.select` ops can have different base pointers accross
branches. In that case, `FatPtrAttrs` can't keep `smallTensorBase` or
pick one of the branches. Instead, replace `smallTensorBase` (Value)
with `isSmallTensor` (bool) in `FatPtrAttrs` and add a conservative
`merge` function for combining attrs. Also, handle different scalar
offsets properly when handling `arith.select` ops.
jvican pushed a commit to jvican/triton that referenced this pull request Mar 27, 2026
triton-lang#9541)

`scf.if` and `arith.select` ops can have different base pointers accross
branches. In that case, `FatPtrAttrs` can't keep `smallTensorBase` or
pick one of the branches. Instead, replace `smallTensorBase` (Value)
with `isSmallTensor` (bool) in `FatPtrAttrs` and add a conservative
`merge` function for combining attrs. Also, handle different scalar
offsets properly when handling `arith.select` ops.
AlexAUT pushed a commit to AlexAUT/triton that referenced this pull request Mar 27, 2026
triton-lang#9541)

`scf.if` and `arith.select` ops can have different base pointers accross
branches. In that case, `FatPtrAttrs` can't keep `smallTensorBase` or
pick one of the branches. Instead, replace `smallTensorBase` (Value)
with `isSmallTensor` (bool) in `FatPtrAttrs` and add a conservative
`merge` function for combining attrs. Also, handle different scalar
offsets properly when handling `arith.select` ops.
gshtras added a commit to ROCm/vllm that referenced this pull request Mar 30, 2026
Signed-off-by: Gregory Shtrasberg <Gregory.Shtrasberg@amd.com>
jayfurmanek pushed a commit to ROCm/triton that referenced this pull request Mar 31, 2026
triton-lang#9541)

`scf.if` and `arith.select` ops can have different base pointers accross
branches. In that case, `FatPtrAttrs` can't keep `smallTensorBase` or
pick one of the branches. Instead, replace `smallTensorBase` (Value)
with `isSmallTensor` (bool) in `FatPtrAttrs` and add a conservative
`merge` function for combining attrs. Also, handle different scalar
offsets properly when handling `arith.select` ops.
naromero77amd pushed a commit to ROCm/triton that referenced this pull request Apr 1, 2026
triton-lang#9541)

`scf.if` and `arith.select` ops can have different base pointers accross
branches. In that case, `FatPtrAttrs` can't keep `smallTensorBase` or
pick one of the branches. Instead, replace `smallTensorBase` (Value)
with `isSmallTensor` (bool) in `FatPtrAttrs` and add a conservative
`merge` function for combining attrs. Also, handle different scalar
offsets properly when handling `arith.select` ops.

(cherry picked from commit dd998b6)
naromero77amd pushed a commit to ROCm/triton that referenced this pull request Apr 1, 2026
triton-lang#9541)

`scf.if` and `arith.select` ops can have different base pointers accross
branches. In that case, `FatPtrAttrs` can't keep `smallTensorBase` or
pick one of the branches. Instead, replace `smallTensorBase` (Value)
with `isSmallTensor` (bool) in `FatPtrAttrs` and add a conservative
`merge` function for combining attrs. Also, handle different scalar
offsets properly when handling `arith.select` ops.

(cherry picked from commit dd998b6)
jayfurmanek added a commit to ROCm/triton that referenced this pull request Apr 1, 2026
triton-lang#9541) (#935)

`scf.if` and `arith.select` ops can have different base pointers accross
branches. In that case, `FatPtrAttrs` can't keep `smallTensorBase` or
pick one of the branches. Instead, replace `smallTensorBase` (Value)
with `isSmallTensor` (bool) in `FatPtrAttrs` and add a conservative
`merge` function for combining attrs. Also, handle different scalar
offsets properly when handling `arith.select` ops.

Co-authored-by: Volkan Keles <volkan.keles@amd.com>
naromero77amd pushed a commit to ROCm/triton that referenced this pull request Apr 7, 2026
triton-lang#9541)

`scf.if` and `arith.select` ops can have different base pointers accross
branches. In that case, `FatPtrAttrs` can't keep `smallTensorBase` or
pick one of the branches. Instead, replace `smallTensorBase` (Value)
with `isSmallTensor` (bool) in `FatPtrAttrs` and add a conservative
`merge` function for combining attrs. Also, handle different scalar
offsets properly when handling `arith.select` ops.

(cherry picked from commit dd998b6)
atalman pushed a commit that referenced this pull request Apr 10, 2026
…nters and offsets (#9541) (#9950)

Upstream cherry-pick `dd998b6` onto `release/3.7.x`.

Testing will be done here:
pytorch/pytorch#179636

---------

Co-authored-by: Volkan Keles <volkan.keles@amd.com>
Co-authored-by: Thomas Raoux <thomas.raoux@openai.com>
@kelesvol kelesvol deleted the canon-ptr branch April 14, 2026 16:42
plognjen pushed a commit to plognjen/triton that referenced this pull request Apr 14, 2026
triton-lang#9541)

`scf.if` and `arith.select` ops can have different base pointers accross
branches. In that case, `FatPtrAttrs` can't keep `smallTensorBase` or
pick one of the branches. Instead, replace `smallTensorBase` (Value)
with `isSmallTensor` (bool) in `FatPtrAttrs` and add a conservative
`merge` function for combining attrs. Also, handle different scalar
offsets properly when handling `arith.select` ops.
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.

4 participants