Repository navigation
Fix SVE blendv mask handling after bool fill - #183697
robert-hardwick wants to merge 3 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/183697
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit 4162289 with merge base 9df9278 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pytorchbot label "topic: not user facing" |
|
@claude review the PR, check if the unit test coverage is enough for this and are the ci failures related |
|
Claude finished @aditew01's task in 4m 46s —— View job PR Review: Fix SVE blendv mask handling after bool fill
SummaryThe fix is correct and well-targeted. It changes SVE Code ReviewThe fix ( // Before:
svbool_t mask = svcmpeq_s32(ptrue, svreinterpret_s32_f32(mask_), ALL_S32_TRUE_MASK);
// After:
svbool_t mask = svcmpne_s32(ptrue, svreinterpret_s32_f32(mask_), ZERO_S32);This is the right fix. The x86 Potential concern: Consistency with other SVE typesThe same strict
If the GCC codegen bug can produce non-canonical true values for these types too, they could exhibit the same failure. Is the float path the only one that gets exercised in this particular SDPA code path, or should these be updated for consistency? Test CoverageNew test ( The test directly exercises the failing pattern:
The test is appropriate and targeted. One minor observation:
xfail removals ( CI Failure AnalysisThe one new failure is:
This is on The 4 "unstable" jobs are all OSDC (inductor) jobs already marked as unstable on trunk — not caused by this PR. VerdictLGTM. The fix is minimal, correct, and well-tested. The only suggestion is to consider whether |
This commits temporarily skips tests fixed by pytorch#182034 and pytorch#183697
|
@pytorchbot rebase |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
|
Successfully rebased |
|
@pytorchbot merge |
Merge failedReason: Approvers from one of the following sets are needed:
|
|
Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as |
Stack from ghstack (oldest at bottom):
This fixes the remaining SVE SDPA rewriter failures after the VecMask bit-cast fix.
The failing path comes from compiled CPU vector code for boolean mask operations such as:
mask.masked_fill(torch.logical_not(mask), -float("inf")).to(torch.float32)On SVE, blendv was reconstructing its predicate by checking whether each stored mask lane was exactly 0xffffffff. That is too strict: due to a GCC codegen bug being tracked separately, a logically true lane can be produced with a different nonzero bit pattern rather than the canonical all-bits-true value. When that happened, blendv misread the lane as false and selected the wrong value.
This changes SVE blendv predicate reconstruction from “equal to all-bits-true” to “not equal to zero”, matching the boolean-mask contract: zero is false, any nonzero value is true.
The PR also adds a targeted regression test for the boolean masked_fill(..., -inf).to(float32) pattern and removes the SVE256 xfails from the affected SDPA rewriter tests.
Fixes #177244
cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @jerryzh168 @aditew01 @voznesenskym @penguinwu @EikanWang @Guobing-Chen @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo