Re-enable dim=4 in strided matmul test with proper cross-BLAS tolerances#2949
Draft
antonwolfy wants to merge 4 commits into
Draft
Re-enable dim=4 in strided matmul test with proper cross-BLAS tolerances#2949antonwolfy wants to merge 4 commits into
antonwolfy wants to merge 4 commits into
Conversation
Contributor
|
Array API standard conformance tests for dpnp=0.21.0dev3=py313h509198e_8 ran successfully. |
Collaborator
|
coverage: 78.118% (-0.009%) from 78.127% — revert-gh-2912 into master |
a41c3b1 to
d279e64
Compare
Contributor
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/2949/index.html |
…test The revert of gh-2912 removed the widened tolerance on TestMatvec::test_axes, which reintroduced a CI failure on ubuntu-latest: dpnp computes matvec via oneMKL gemm_batch while NumPy uses OpenBLAS gemv, so the summation order differs and the float64 result deviates at the noise floor (~1.4e-14), exceeding the default 8e-15 tolerance. Restore factor=40 on test_axes (with an explanatory comment) while keeping the rest of the revert, i.e. re-enabling dim=4 in TestMatmul::test_strided1, whose factor=16 tolerance already absorbs any cross-BLAS discrepancy. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Re-enabling dim=4 in TestMatmul::test_strided1 reintroduced the CI failure gh-2912 had worked around by skipping it: for float32 the strided matmul deviates by ~1.87e-5, just above the factor=16 bound (~1.81e-5). The cause is benign cross-BLAS non-associativity -- dpnp copies the strided input to c-contiguous and runs oneMKL gemm_batch, while NumPy uses OpenBLAS, so the length-20 float32 contraction accumulates in a different order. Bump the tolerance to factor=24 (pass-bound ~2.27e-5) for float32 only; integer input is compared exactly, so the factor does not affect it. This keeps dim=4 covered without masking real regressions in the exact path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gh-2912 introduced two temporary test workarounds after a CI failure on
ubuntu-latest:TestMatvec::test_axestofactor=40;dim=4iteration inTestMatmul::test_strided1.Both failures share the same benign root cause, so this PR re-enables the disabled coverage and replaces the ad-hoc mitigations with documented, dtype-aware tolerances:
test_axes(matvec, float64) — keepsfactor=40. dpnp computesmatvecvia oneMKLgemm_batchwhile NumPy uses OpenBLASgemv; the summation order differs and the float64 result deviates at the noise floor (~1.4e-14), which exceeds the default8e-15tolerance.test_strided1(matmul) — re-enablesdim=4. dpnp copies the strided input to c-contiguous and runs it through oneMKLgemm_batch, again against NumPy's OpenBLAS. For float32, the length-20 contraction deviates by ~1.87e-5, just above the oldfactor=16bound (~1.81e-5), so the tolerance is bumped tofactor=24for float32 only (pass-bound ~2.27e-5). Integer input is compared exactly and is unaffected.Root cause
Neither discrepancy is a dpnp correctness bug. Both are expected floating-point non-associativity between two different BLAS backends (oneMKL vs OpenBLAS), surfaced when the conda-forge NumPy in CI advanced its bundled OpenBLAS. There is nothing to fix upstream, so documented tolerances are the correct handling and let us keep full test coverage (including
dim=4).