NVIDIA / cuda-quantum

C++ and Python support for the CUDA Quantum programming model for heterogeneous quantum-classical workflows
https://nvidia.github.io/cuda-quantum/
Other
564 stars 191 forks source link

Failing tests when building against libc++ #1712

Open bettinaheim opened 6 months ago

bettinaheim commented 6 months ago

Required prerequisites

Describe the bug

CUDA-Q currently is built against libstdc++. Building against a different standard library generally requires updates to the compiler. Specifically, when building against libc++ (built from source along with the other LLVM dependencies), the following llvm-lit tests fail:

In test folder:

In targettests folder:

In the unittests folder:

Steps to reproduce the bug

Check out the PR branch https://github.com/NVIDIA/cuda-quantum/pull/1603, and remove the excludes listed under this bug in docker/build/assets.Dockerfile.

Expected behavior

All tests should pass.

Is this a regression? If it is, put the last known working version (or commit) here.

Possibly, but we haven't tested for libc++ so far

Environment

ghcr.io/nvidia/cuda-quantum-assets docker image

Suggestions

No response

schweitzpgi commented 5 months ago

The following tests fail because of inconsistencies in the header file implementations. An update to the bridge is forthcoming. AST-Quake/reverse.cpp AST-Quake/vector_ctor_initlist.cpp AST-Quake/vector_ctor_initlist_int.cpp AST-Quake/vector_ctor_sized.cpp AST-Quake/vector_front_back.cpp

These tests pass for me with the patches for the previous group applied. execution/mapping_test-1-cpp17.cpp execution/mapping_test-1.cpp execution/qir_cond_for_loop-3.cpp

These tests are using timer interfaces that are apparently not supported in libc++ and will require some modification. execution/sim_gate_timing-cpp17.cpp execution/sim_gate_timing.cpp

bettinaheim commented 5 months ago

Reopening since recent changes added tests for inline-qpu-func and CustomUnitary that require additional changes to be supported with libc++. (description above is updated)

bettinaheim commented 4 months ago

@schweitzpgi I have all tests running except the Kernel/inline-qpu-func.cpp, which still fails with a type traversal issue in TraverseStmt:

RUN: at line 9: nvq++  --enable-mlir /cuda-quantum/targettests/Kernel/inline-qpu-func.cpp -o /cuda-quantum/build/targettests/Kernel/Output/inline-qpu-func.cpp.tmp && /cuda-quantum/build/targettests/Kernel/Output/inline-qpu-func.cpp.tmp | /usr/local/llvm/bin/FileCheck /cuda-quantum/targettests/Kernel/inline-qpu-func.cpp
+ nvq++ --enable-mlir /cuda-quantum/targettests/Kernel/inline-qpu-func.cpp -o /cuda-quantum/build/targettests/Kernel/Output/inline-qpu-func.cpp.tmp
loc("/usr/local/llvm/include/c++/v1/__bit_reference":146:1):warning: compiler encountered type traversal issue
inline-qpu-func.cpp:18:3: error: statement not supported in qpu kernel
  for (auto x : result_vec)
  ^
1 error generated.
error: could not translate file '/cuda-quantum/targettests/Kernel/inline-qpu-func.cpp
khalatepradnya commented 4 months ago

Can you recheck the status of tensornet_CustomUnitaryTester.checkSimple -- the single test was split into multiple tests and might help narrowing the issue.

sacpis commented 3 months ago

Seems like the test /cuda-quantum/targettests/Kernel/inline-qpu-func.cpp is passing with the current main.