Skip ATen-mode out-of-range integer clamp/hardtanh death tests - #21933
Skip ATen-mode out-of-range integer clamp/hardtanh death tests#21933malfet wants to merge 1 commit into
Conversation
pytorch/pytorch#193169 changes how ATen's scalar `clamp` handles an out-of-range integer bound. Instead of converting the bound straight to the input dtype (which raised for signed dtypes and silently wrapped for unsigned ones), ATen now reconciles the bound by direction: a `min` below the dtype's range (or a `max` above it) is a no-op and is dropped, while the opposite direction is rejected. `hardtanh` shares this behavior. The portable kernels keep their own strict bounds check and are unaffected, but the ATen-mode death tests (built with -DUSE_ATEN_LIB) assume every out-of-range integer bound raises, which no longer holds. Skip those integer cases in ATen mode, matching the existing skips for negative uint8 and out-of-range int32 bounds: - op_clamp_test: ByteTensorTooLargeClampDies - op_hardtanh_test: ByteTensorTooLargeScalarDies, CharTensorTooSmallScalarDies, ShortTensorTooLargeScalarDies (gated in the fixture helper, not the shared ScalarOverflowTestMacros.h, which eight suites depend on) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21933
Note: Links to docs will display an error until the docs builds have been completed.
|
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
This PR updates ExecuTorch kernel death tests to account for upstream ATen behavior changes around out-of-range integer bounds for clamp/hardtanh when building/running in ATen mode (-DUSE_ATEN_LIB). Since ATen now treats some out-of-range integer bounds as a direction-dependent no-op (instead of always erroring), these specific death tests no longer reliably hold under ATen kernels and are now skipped there.
Changes:
- Skip
OpClampOutTest.ByteTensorTooLargeClampDieswhenSupportedFeatures::get()->is_atenis true. - Skip the integral dtype scalar-overflow hardtanh death tests in ATen mode by gating them in
OpHardTanhTest::expect_bad_scalar_value_dies.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| kernels/test/op_hardtanh_test.cpp | Adds ATen-mode skip for integral hardtanh scalar overflow death tests via the shared fixture helper. |
| kernels/test/op_clamp_test.cpp | Adds ATen-mode skip for the “too large uint8 bound” clamp death test that no longer universally errors in ATen. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
pytorch/pytorch#193169 changes how ATen's scalar
clamphandles an out-of-rangeinteger bound. Instead of converting the bound straight to the input dtype
(which raised for signed dtypes and silently wrapped for unsigned ones), ATen
now reconciles the bound by direction: a
minbelow the dtype's range (or amaxabove it) is a no-op and is dropped, while the opposite direction isrejected.
hardtanhshares this behavior.The portable kernels keep their own strict bounds check and are unaffected, but
the ATen-mode death tests (built with -DUSE_ATEN_LIB) assume every out-of-range
integer bound raises, which no longer holds. Skip those integer cases in ATen
mode, matching the existing skips for negative uint8 and out-of-range int32
bounds:
ShortTensorTooLargeScalarDies (gated in the fixture helper, not the shared
ScalarOverflowTestMacros.h, which eight suites depend on)
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Summary
[PLEASE REMOVE] See CONTRIBUTING.md's Pull Requests for ExecuTorch PR guidelines.
[PLEASE REMOVE] If this PR closes an issue, please add a
Fixes #<issue-id>line.[PLEASE REMOVE] If this PR introduces a fix or feature that should be the upcoming release notes, please add a "Release notes: " label. For a list of available release notes labels, check out CONTRIBUTING.md's Pull Requests.
Test plan
[PLEASE REMOVE] How did you test this PR? Please write down any manual commands you used and note down tests that you have written if applicable.