Skip to content

[AxisInfo] Fix signed division/remainder analysis and revert PyTorch floordiv workaround#7570

Draft
whitneywhtsang wants to merge 1 commit into
mainfrom
whitneywhtsang/wi6376_
Draft

[AxisInfo] Fix signed division/remainder analysis and revert PyTorch floordiv workaround#7570
whitneywhtsang wants to merge 1 commit into
mainfrom
whitneywhtsang/wi6376_

Conversation

@whitneywhtsang

Copy link
Copy Markdown
Contributor

The previous fix (#6896) used a divisibility >= contiguity guard for DivSIOp/RemSIOp which is insufficient — truncation toward zero breaks constancy even within purely negative windows (counterexample: sdiv([-64..-57], 32) = [-2,-1,-1,-1,-1,-1,-1,-1], not constant-8).

Completely disable the constancy/contiguity/divisibility optimizations for DivSIOp and RemSIOp in AxisInfo. Without range analysis we cannot prove inputs are non-negative, so we conservatively return 1 for all three properties.

Add a PyTorch patch to bypass the XOR-based floordiv workaround (pytorch/pytorch#175168) for XPU, using the simple tl.where-based floordiv instead.

Fixes #6376

…floordiv workaround

The previous fix (#6896) used a `divisibility >= contiguity` guard for
DivSIOp/RemSIOp which is insufficient — truncation toward zero breaks
constancy even within purely negative windows (counterexample:
sdiv([-64..-57], 32) = [-2,-1,-1,-1,-1,-1,-1,-1], not constant-8).

Completely disable the constancy/contiguity/divisibility optimizations
for DivSIOp and RemSIOp in AxisInfo. Without range analysis we cannot
prove inputs are non-negative, so we conservatively return 1 for all
three properties.

Add a PyTorch patch to bypass the XOR-based floordiv workaround
(pytorch/pytorch#175168) for XPU, using the simple tl.where-based
floordiv instead.

Fixes #6376

Signed-off-by: Whitney Tsang <whitney.tsang@intel.com>
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.

Investigate flex-attn-masks regression on March 15

1 participant