Catch2 icon indicating copy to clipboard operation
Catch2 copied to clipboard

Catch2 v3.3.1 + MSVC + CUDA 12 cause ICE

Open j-stephan opened this issue 2 years ago • 8 comments

Describe the bug While trying to upgrade our test infrastructure from Catch2 v3.2.1 to v3.3.1 (did not test v3.3.0) I noticed that our Windows CI fails with the following message:

D:\a\alpaka\alpaka\test\integ\zeroDimBuffer\src\zeroDimBuffer.cpp(56): internal error : assertion failed: alloc_copy_of_pending_pragma: copied pragma has source sequence entry (pragma.c, line 526 in alloc_copy_of_pending_pragma) [D:\a\alpaka\alpaka\build\test\integ\zeroDimBuffer\zeroDimBufferTest.vcxproj]

This happens multiple times for different test cases. A quick investigation showed that this always occurs inside a TEMPLATE_LIST_TEST_CASE() for the first occurrence of CHECK() or REQUIRE().

Expected behavior A successful compilation of the test case.

Reproduction steps I didn't have time yet to come up with a small reproducer outside our code base. Feel free to look at our CI log here.

Platform information:

  • OS: Windows Server 2022
  • Compiler+version: nvcc v12.0.76 + MSVC 19.34.31937.0
  • Catch version: v3.3.1

Additional context Possibly related to #2626. Probably a NVCC compiler bug.

j-stephan avatar Feb 07 '23 12:02 j-stephan

I think you'd be better served opening up this issue against nvcc with nvidia.

horenmar avatar Feb 08 '23 18:02 horenmar

@griwes I am under the impression that nvcc 12 is not ancient, so you might be interested. 😃

horenmar avatar Feb 11 '23 21:02 horenmar

It seems that Catch2 v3.3.2 fixed this somehow, I can no longer reproduce this.

j-stephan avatar Mar 02 '23 11:03 j-stephan

Ah, sorry for the noise. I looked at the wrong test cases...

j-stephan avatar Mar 02 '23 11:03 j-stephan

Sure, but I still think you should open the issue with nvcc upstream.

horenmar avatar Mar 03 '23 10:03 horenmar

I finally had the time to investigate a bit more. Since the issue persists in CUDA 12.1 I opened an issue on NVIDIA's bug tracker (NVIDIA ID 4160692). Reproducer:

#include <catch2/catch_template_test_macros.hpp>
#include <catch2/catch_test_macros.hpp>

#include <tuple>

using MyTypes = std::tuple<int, char, float>;
TEMPLATE_LIST_TEST_CASE("Template test case with test types specified inside std::tuple", "[template][list]", MyTypes)
{
    REQUIRE(sizeof(TestType) > 0);
}

Error message:

catch2_error\main.cu(9): internal error : assertion failed: alloc_copy_of_pending_pragma: copied pragma has source sequence entry (pragma.c, line 526 in alloc_copy_of_pending_pragma)
do { ; Catch::AssertionHandler catchAssertionHandler( "REQUIRE"_catch_sr, ::Catch::SourceLineInfo( "catch2_error\\main.cu", static_cast<std::size_t>( 9 ) ), "sizeof(TestType) > 0"_catch_sr, Catch::ResultDisposition::Normal ); try { __pragma(nv_diagnostic push )  catchAssertionHandler.handleExpr( Catch::Decomposer() <= sizeof(TestType) > 0 ); __pragma(nv_diagnostic pop ) } catch(...) { catchAssertionHandler.handleUnexpectedInflightException(); } catchAssertionHandler.complete(); } while( (void)0, (false) && static_cast<const bool&>( !!(sizeof(TestType) > 0) ) );
                                                                                                                                                                                                                                                                      ^
   
   1 catastrophic error detected in the compilation of "catch2_error/main.cu".
   Compilation aborted.
   main.cu
 CUDACOMPILE : nvcc error : 'cudafe++' died with status 0xC0000409

j-stephan avatar Jun 15 '23 12:06 j-stephan

NVIDIA were able to reproduce the issue and are now looking into it.

j-stephan avatar Jun 27 '23 12:06 j-stephan