You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
With testsuite, Level 1m function fails for matrix sizes 5000 and above #323
Level 1m function fails for single real and single complex datatype. (sc)
Steps to reproduce the issue:
Build blis library
do below changes in testsuite/input.general file
6000 # Problem size: first to test
6000 # Problem size: maximum to test
1000 # Problem size: increment between experiments
and enable only level 1m functions in testsuite/input.operations
make checkblis
**% blis_
m n gflops resid result
blis_ssubm_n_cc 6000 3000 2.38 2.93e+02 FAILURE
blis_ssubm_c_cc 6000 3000 2.38 2.93e+02 FAILURE
blis_ssubm_t_cc 6000 3000 0.24 2.93e+02 FAILURE
blis_ssubm_h_cc 6000 3000 0.24 2.93e+02 FAILURE
% blis_
m n gflops resid result
blis_csubm_n_cc 6000 3000 2.42 3.81e+03 FAILURE
blis_csubm_c_cc 6000 3000 2.43 2.59e+03 FAILURE
blis_csubm_t_cc 6000 3000 0.36 3.81e+03 FAILURE
blis_csubm_h_cc 6000 3000 0.36 2.59e+03 FAILURE**
I've looked into this a bit, and I'm pretty sure that this is a "false positive" failure. That is, the testsuite is reporting failure when the implementation is actually fine. The reason for the failure, according to my theory, is nuanced and related to the rather rudimentary way that the subm test module is attempting to detect failure.
Let's leave this issue open. I'll have to think about if there is a better way to test for failure in these large cases.
@kirannd28 Other test modules use similar correctness checking methods to that of subm, including those for the addm and normfm operations.
I looked into dotxaxpyf, and the failures there are actually being produced by another phenomenon. It appears that the #pragma omp simd directive that we use to try to get the compiler to better optimize reference kernels is causing the compiler to emit code that is more prone to accumulating error in dot products.
@devinamatthews Any ideas why #pragma omp simd might be having this effect? (I determined specifically that it was the dotxv product component of the dotxaxpyftest that is the culprit; the axpyv component has negligible impact on the outcome.)
Worse case, of course, is that we disable the #pragma omp simd by default.
I spoke to @rvdg, and he pointed out that it's important to always remember what we're comparing against. The testsuite module for dotxaxpyf uses loops over dotxv (and axpyv) to compute the solution that we assume is correct and that we compare the dotxaxpyf solution to. The current implementation of dotxv on Haswell- and Zen-like architectures is one that accumulates dot products via AVX vectors (ie: accumulates the ith vector element into the (i mod 4)th vector slot), with a horizontal add at the very end to collapse the four intermediate results (or eight for single-precision real) down to a single value. This implementation, which effectively accumulates once per four elements, would likely give you better numerical accuracy than one that accumulated once per element.
So it would appear that the compiler-generated code is perhaps fine as-is, but the "check/test" code based on axpyv and dotxv (AVX intrinsics) is slightly better. Which would explain residuals such as:
That is, they are not WAY off, but just a little off. These residuals might simply be representing the relative improvement in accuracy one observes by using dot product code that accumulates as described above.
Also, note that when we switch to a problem where at least one vector is non-contiguous, the BLIS implementation of dotxaxpyf falls back to a simpler code branch that relies only on loops over axpyv and dotxv, in which case the residuals disappear completely:
I have similar problems often in TBLIS, but when trying to compare a vectorized and a non-vectorized implementation some error is to be expected. In fact the best remedy for this is to only test smaller sizes...
Activity
fgvanzee commentedon Jul 16, 2019
@kirannd28 Thanks for this report.
I've looked into this a bit, and I'm pretty sure that this is a "false positive" failure. That is, the testsuite is reporting failure when the implementation is actually fine. The reason for the failure, according to my theory, is nuanced and related to the rather rudimentary way that the
submtest module is attempting to detect failure.Let's leave this issue open. I'll have to think about if there is a better way to test for failure in these large cases.
kirannd28 commentedon Jul 17, 2019
@fgvanzee Thanks for the reply.
Adding more info about the problem.
Test cases fail for the above 4 functions, for single real and single complex datatype.
Hope the above reply holds good for all four functions.
fgvanzee commentedon Jul 17, 2019
@kirannd28 Other test modules use similar correctness checking methods to that of
subm, including those for theaddmandnormfmoperations.I looked into
dotxaxpyf, and the failures there are actually being produced by another phenomenon. It appears that the#pragma omp simddirective that we use to try to get the compiler to better optimize reference kernels is causing the compiler to emit code that is more prone to accumulating error in dot products.@devinamatthews Any ideas why
#pragma omp simdmight be having this effect? (I determined specifically that it was thedotxvproduct component of thedotxaxpyftest that is the culprit; theaxpyvcomponent has negligible impact on the outcome.)Worse case, of course, is that we disable the
#pragma omp simdby default.fgvanzee commentedon Jul 17, 2019
An update.
I spoke to @rvdg, and he pointed out that it's important to always remember what we're comparing against. The testsuite module for
dotxaxpyfuses loops overdotxv(andaxpyv) to compute the solution that we assume is correct and that we compare thedotxaxpyfsolution to. The current implementation ofdotxvon Haswell- and Zen-like architectures is one that accumulates dot products via AVX vectors (ie: accumulates the ith vector element into the (i mod 4)th vector slot), with a horizontal add at the very end to collapse the four intermediate results (or eight for single-precision real) down to a single value. This implementation, which effectively accumulates once per four elements, would likely give you better numerical accuracy than one that accumulated once per element.So it would appear that the compiler-generated code is perhaps fine as-is, but the "check/test" code based on
axpyvanddotxv(AVX intrinsics) is slightly better. Which would explain residuals such as:That is, they are not WAY off, but just a little off. These residuals might simply be representing the relative improvement in accuracy one observes by using dot product code that accumulates as described above.
Also, note that when we switch to a problem where at least one vector is non-contiguous, the BLIS implementation of
dotxaxpyffalls back to a simpler code branch that relies only on loops overaxpyvanddotxv, in which case the residuals disappear completely:devinamatthews commentedon Aug 6, 2020
I have similar problems often in TBLIS, but when trying to compare a vectorized and a non-vectorized implementation some error is to be expected. In fact the best remedy for this is to only test smaller sizes...
I think this can be safely closed.
GTestSuite: cleanup of disabled tests (flame#323)