EXPECT*KK macro rework - #3258
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors near-comparison test macros to support scalars, SIMD vectors, and rank-1 Kokkos Views.
Changes:
- Moves comparison logic into templated helpers.
- Removes
KK_EXPECT_NEARand updates callers. - Corrects remaining
TestUtilsnamespace references.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
test_common/KokkosKernels_TestUtils.hpp |
Adds generalized comparison helpers and simplifies macros. |
blas/unit_test/Test_Blas1_scal.hpp |
Corrects random-bound utility namespace. |
batched/dense/unit_test/Test_Batched_Swap.hpp |
Migrates assertions to EXPECT_NEAR_KK. |
batched/dense/unit_test/Test_Batched_Nrm.hpp |
Migrates assertions to EXPECT_NEAR_KK. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| return testing::AssertionFailure() << "Expected: " << expr1 << " is near " << expr2 << " (within " << expr_tol | ||
| << ")\n" | ||
| << " Actual: " << abs_diff << "\n" | ||
| << "Expected: " << abs_tol << "\n"; |
Signed-off-by: James Foucar <jgfouca@sandia.gov>
Signed-off-by: James Foucar <jgfouca@sandia.gov>
Signed-off-by: James Foucar <jgfouca@sandia.gov>
3f53afa to
43a5e01
Compare
|
@ndellingwood , done. |
Signed-off-by: James Foucar <jgfouca@sandia.gov>
yasahi-hpc
left a comment
There was a problem hiding this comment.
It is quite nice to refactor test utils.
Since it will print too many error messages if it fails, I think we will eventually need a matcher approach for View to View element-wise comparison like this
Signed-off-by: James Foucar <jgfouca@sandia.gov>
Signed-off-by: James Foucar <jgfouca@sandia.gov>
Signed-off-by: James Foucar <jgfouca@sandia.gov>
Signed-off-by: James Foucar <jgfouca@sandia.gov>
Signed-off-by: James Foucar <jgfouca@sandia.gov>
|
Thanks, @yasahi-hpc. Those were good suggestions. I think my recent pushes addressed all your comments. |
Signed-off-by: James Foucar <jgfouca@sandia.gov>
yasahi-hpc
left a comment
There was a problem hiding this comment.
Thanks for the quick response @jgfouca
Mostly looks good to me.
Not strict blockers except for the fix in the assertion message.
Others are replacements of SFINAE with requires.
Use requires instead of enable_if and improve assert messages. Signed-off-by: James Foucar <jgfouca@sandia.gov>
6aec5b9 to
0b5b104
Compare
Signed-off-by: James Foucar <jgfouca@sandia.gov>
|
@yasahi-hpc , done |
|
@brian-kelley , @lucbv , @ndellingwood , I think this is ready to merge. It's on the higher priority side since it fixes a build error. |
Change list:
Fixes remaining issues involved with #3232 , namely:
:247:5: error: cannot convert 'val_type' (aka 'Vector<SIMD<float>, 4>') to 'double' without a conversion operator