Fix ch_axis bounds check in fused_moving_avg_obs_fake_quant_xpu#3964
Fix ch_axis bounds check in fused_moving_avg_obs_fake_quant_xpu#3964Copilot wants to merge 3 commits into
Conversation
|
@copilot please use pr-create skill to update the PR |
|
@copilot The Python lint (flake8/ruff) and Clang format check failed. Please fix the lint errors in this PR. Important: Do NOT update the plan in the PR description directly. Use reply comments to update the status. Lint job log: https://github.com/intel/torch-xpu-ops/actions/runs/27319132554 Instructions:
|
Updated the PR following the pr-creation skill:
Commit: see latest push. |
Fixed all lint errors:
See commit |
|
@copilot please review this PR in deep |
PR Review: Fix ch_axis bounds check in fused_moving_avg_obs_fake_quant_xpuSummaryAdds lower-bound validation and negative-index wrapping for Correctness
const auto wrapped_ch_axis = at::maybe_wrap_dim(ch_axis, x.dim());This produces the same range check and wrapping behavior, provides a consistent error message format, and correctly handles 0-dim tensors (rejects all axes with Upstream CUDA parity — Verified. The upstream CUDA implementation ( 0-dim tensor edge case — The manual check creates an empty valid range TestingMissing negative wrapping equivalence assertion — Missing boundary value Backward CompatibilityThe original code only accepted non-negative RecommendationApprove — The fix is correct, well-scoped, and addresses a real crash. The suggestion to use |
|
@copilot New UT failures detected in basic tests (0 total). Please check these new failures and analyze whether they are caused by the PR changes. Important: Do NOT update the plan in the PR description directly. Use reply comments to update the status. Job log: https://github.com/intel/torch-xpu-ops/actions/runs/27335414788 New failures: Instructions:
|
Analyzed the CI failures:
|
|
@copilot New UT failures detected in op_ut tests (2 total). Please check these new failures and analyze whether they are caused by the PR changes. Important: Do NOT update the plan in the PR description directly. Use reply comments to update the status. Job log: https://github.com/intel/torch-xpu-ops/actions/runs/27335414788 New failures:
Instructions:
|
Both failures error with |
3747880 to
f9b8e71
Compare
|
@copilot New UT failures detected in basic tests (0 total). Please check these new failures and analyze whether they are caused by the PR changes. Important: Do NOT update the plan in the PR description directly. Use reply comments to update the status. Job log: https://github.com/intel/torch-xpu-ops/actions/runs/27392036929 New failures: Instructions:
|
The only failure is |
|
@copilot New UT failures detected in op_ut tests (3 total). Please check these new failures and analyze whether they are caused by the PR changes. Important: Do NOT update the plan in the PR description directly. Use reply comments to update the status. Job log: https://github.com/intel/torch-xpu-ops/actions/runs/27392036929 New failures:
Instructions:
|
All three failures are in dynamo/inductor/export tests unrelated to this PR:
This PR only modifies |
fused_moving_avg_obs_fake_quant_xpuonly validated the upper bound ofch_axis(ch_axis < x.dim()), so any negative value passed the check and was used as a raw index into aDimVector, causing an out-of-bounds access and segfault reachable from public Python APIs.ch_axis >= -x_dim && ch_axis < x_dim-1→ last dim), matching standard PyTorch convention used throughout the codebasech_axisin the function now use the wrapped valueNote: the upstream CUDA implementation (
aten/src/ATen/native/quantized/cuda/FusedObsFakeQuant.cu) has the same bug.