Skip to content

[RemoveLayoutConversions] Fix backward remat conflict detection#6701

Merged
whitneywhtsang merged 2 commits into
mainfrom
etiotto/port-upstream-9953-backward-remat-conflict
Apr 21, 2026
Merged

[RemoveLayoutConversions] Fix backward remat conflict detection#6701
whitneywhtsang merged 2 commits into
mainfrom
etiotto/port-upstream-9953-backward-remat-conflict

Conversation

@etiotto
Copy link
Copy Markdown
Contributor

@etiotto etiotto commented Apr 17, 2026

Port upstream Triton PR #9953: when getConvertBackwardSlice encounters
a value that already has the desired encoding, record the layout for
conflict detection without adding it to the remat slice. Previously the
layout was not recorded, so a conflicting encoding via a different path
went undetected.

Closes #6700

@etiotto etiotto self-assigned this Apr 17, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Ports upstream Triton fix to improve backward rematerialization conflict detection by ensuring layouts are recorded even when a value already has the desired encoding, preventing undetected encoding conflicts.

Changes:

  • Always record encountered value layouts for conflict detection, even when the value already has the target encoding.
  • Adjust slice construction so values with matching encodings are not added to the remat slice.
  • Add MLIR regression tests covering conflict scenarios across multiple paths/ops.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
third_party/intel/lib/TritonIntelGPUTransforms/Utility.cpp Updates backward-slice logic to record layouts while avoiding unnecessary slice entries when encodings already match.
lib/Dialect/TritonGPU/Transforms/Utility.cpp Mirrors the upstream fix in the core TritonGPU utility implementation.
test/TritonIntelGPU/RemoveLayoutConversions/backward-remat-conflict.mlir Adds regression tests to validate conflict detection and preservation/elimination of convert_layout as appropriate.

Comment thread third_party/intel/lib/TritonIntelGPUTransforms/Utility.cpp Outdated
Comment thread lib/Dialect/TritonGPU/Transforms/Utility.cpp Outdated
Comment thread lib/Dialect/TritonGPU/Transforms/Utility.cpp
Comment thread test/TritonIntelGPU/RemoveLayoutConversions/backward-remat-conflict.mlir Outdated
Comment thread lib/Dialect/TritonGPU/Transforms/Utility.cpp
@etiotto etiotto force-pushed the etiotto/port-upstream-9953-backward-remat-conflict branch from e325533 to 911b6b5 Compare April 21, 2026 13:47
Port upstream Triton PR #9953: when getConvertBackwardSlice encounters
a value that already has the desired encoding, record the layout for
conflict detection without adding it to the remat slice. Previously the
layout was not recorded, so a conflicting encoding via a different path
went undetected.

Signed-off-by: Tiotto, Ettore <ettore.tiotto@intel.com>
@etiotto etiotto force-pushed the etiotto/port-upstream-9953-backward-remat-conflict branch from 911b6b5 to 4aeb866 Compare April 21, 2026 14:19
@whitneywhtsang whitneywhtsang enabled auto-merge (squash) April 21, 2026 14:52
@whitneywhtsang whitneywhtsang merged commit f684bbc into main Apr 21, 2026
36 of 41 checks passed
@whitneywhtsang whitneywhtsang deleted the etiotto/port-upstream-9953-backward-remat-conflict branch April 21, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RemoveLayoutConversions] Fix backward remat conflict detection

4 participants