Fix MSVC test fails#2009
Conversation
|
Hi @spiralbit Thanks for your contribution. |
yhmtsai
left a comment
There was a problem hiding this comment.
there is also format issue.
Could you install pre-commit hook from ginkgo repo and run it via like pre-commit run --from-ref "origin/develop" --to-ref HEAD
|
|
||
| fine_b = gko::initialize<Vec>( | ||
| {I<VT>({2.0, -1.0}), I<VT>({-1.0, 2.0}), I<VT>({0.0, -1.0}), | ||
| I<VT>({3.0, -2.0}), I<VT>({-2.0, 1.0})}, | ||
| exec); | ||
|
|
||
| coarse_b = gko::initialize<Vec>( | ||
| {I<VT>({2.0, -1.0}), I<VT>({0.0, -1.0})}, exec); | ||
|
|
||
| restrict_ans = (gko::initialize<Vec>( | ||
| {I<VT>({0.0, -1.0}), I<VT>({2.0, 0.0})}, exec)); | ||
|
|
||
| prolong_ans = gko::initialize<Vec>( | ||
| {I<VT>({0.0, -2.0}), I<VT>({1.0, -2.0}), I<VT>({1.0, -2.0}), | ||
| I<VT>({0.0, -1.0}), I<VT>({2.0, 1.0})}, | ||
| exec); | ||
|
|
||
| prolong_applyans = gko::initialize<Vec>( | ||
| {I<VT>({2.0, -1.0}), I<VT>({0.0, -1.0}), I<VT>({2.0, -1.0}), | ||
| I<VT>({0.0, -1.0}), I<VT>({2.0, -1.0})}, | ||
| exec); | ||
|
|
||
| fine_x = gko::initialize<Vec>( | ||
| {I<VT>({-2.0, -1.0}), I<VT>({1.0, -1.0}), I<VT>({-1.0, -1.0}), | ||
| I<VT>({0.0, 0.0}), I<VT>({0.0, 2.0})}, | ||
| exec); |
There was a problem hiding this comment.
you can delete the new line between each variables
Co-authored-by: Yu-Hsiang M. Tsai <19565938+yhmtsai@users.noreply.github.com>
Co-authored-by: Yu-Hsiang M. Tsai <19565938+yhmtsai@users.noreply.github.com>
Co-authored-by: Yu-Hsiang M. Tsai <19565938+yhmtsai@users.noreply.github.com>
Co-authored-by: Yu-Hsiang M. Tsai <19565938+yhmtsai@users.noreply.github.com>
Installed and run that. Hope the formatting looks OK to you now. |
MS have never formally acknowledged this exact problem, but they have acknowledged similar issues with templates, initializer lists and member-init lists. I've added a couple of references I could find though where issues with these kinds of things has been acknowledged. It's a known "fact" that MSVC trails Clang and GCC in standards compliance. |
|
Hm, because you have mentioned the following in the pr description
I thought it is documented or raised the same question/discussion before. Is it not true? |
Here's one reference to the kind of problem I could find: https://gitlab.com/libeigen/eigen/-/issues/2423. It's a bit of an obscure area, and it shouldn't really matter if the code is in a member-list init or in the body, but it certainly does seem to matter here - the failure mode is a zero-matrix result. I have tried to make a simple case which illustrates the problem in MSVC and have not managed it. I suspect it might be a template size / nesting problem which is only triggered when the parsing stack overflows or something like this. Because this code is test code I think it's academically interesting why it works in the body - it doesn't really matter, although I agree it would be nice to know exactly why it does. |
|
yes, the initialization in the list or body is fine and they are in the test. At least from my perspective, I do not only consider the code itself. A bug fix should address the root cause unless doing so would break the public interface or there is no practical way to fix it properly. For example, if the issue comes from an incorrect class constructor design, then we should fix the constructor itself rather than changing how member initialization is written. If the PR is merged without clarification, people may simply trust the description when they encounter the same issue later and never look into the actual details. In particular, when you mentioned that other libraries such as Eigen, Boost, and TensorFlow avoid this pattern for the same reason, I think we need to be more careful because that statement refers to decisions made by other projects. If it is inaccurate or unsupported by references, it could create unnecessary confusion or misrepresent what those projects actually do. I do not mean that providing a reference automatically makes something true, but we should avoid introducing unsupported claims whenever possible, at least based on what we currently know. Otherwise, it also raises questions about the responsibility of the PR author. Thanks again for working with me to help figure out the issue. |
These changes fix two kinds of issues which cause various test failures seen running the tests on the following platform:
The two underlying issues are:
Here are a couple of links concerning documented historical issues in MSVC with template resolution and initialiser lists:
https://learn.microsoft.com/en-us/cpp/overview/cpp-conformance-improvements-2019?view=msvc-170
https://devblogs.microsoft.com/cppblog/two-phase-name-lookup-support-comes-to-msvc/
Whereas GCC has:
This PR adds a couple of normalisation loops over the output and expected variables to strip out any mention of "class " or "struct ".
Here are the test summaries. Before the changes:
After:
These final four failures are CUDA hardware related and I am investigating them. One of these is reported here:
I've also added my cmake configuration script for reference.
ginkgo-run-cmake.txt