Skip to content

Failing tests when building against libc++ #1712

@bettinaheim

Description

@bettinaheim

Required prerequisites

  • Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
  • Make sure you've read the documentation. Your issue may be addressed there.
  • Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
  • If possible, make a PR with a failing test to give us a starting point to work on!

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:

  • 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
  • ArgumentConversion/test_argument_conversion.cpp

In targettests folder:

  • execution/mapping_test-1-cpp17.cpp
  • execution/mapping_test-1.cpp
  • execution/qir_cond_for_loop-3.cpp
  • execution/sim_gate_timing-cpp17.cpp
  • execution/sim_gate_timing.cpp
  • CUDAQ-Target :: Kernel/inline-qpu-func.cpp (fails with a type traversal issue in TraverseStmt)
  • Kernel/signaure-2.cpp (small struct not passed by value correctly)
  • execution/custom_operation_basic (fails randomly after or around the time of introducing cudaq operators, details below)
  • execution/vector_bool_parameters.cpp (vector<vector<bool>> is not passed correctly)
  • python/tests/kernel/test_kernel_parameters.py (list[list[bool]] is not passed correctly)

In the unittests folder:

  • tensornet_CustomUnitaryTester.checkSimple and the same for tensornet_mps

Steps to reproduce the bug

Check out the PR branch #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.

custom_operator_basic used to pass, but I saw a sporadic failure when I was merging in #2631. Changes in that PR should be unrelated to this failure, I think.
Stacktrace:

#74 278.2 RUN: at line 14: nvq++  --target iqm --iqm-machine Apollo --emulate /cuda-quantum/targettests/execution/custom_operation_basic.cpp -o /cuda-quantum/build/targettests/execution/Output/custom_operation_basic.cpp.tmp && /cuda-quantum/build/targettests/execution/Output/custom_operation_basic.cpp.tmp | /usr/local/llvm/bin/FileCheck /cuda-quantum/targettests/execution/custom_operation_basic.cpp
#74 278.2 + nvq++ --target iqm --iqm-machine Apollo --emulate /cuda-quantum/targettests/execution/custom_operation_basic.cpp -o /cuda-quantum/build/targettests/execution/Output/custom_operation_basic.cpp.tmp
#74 278.2 cudaq-opt: /root/.llvm-project/llvm/include/llvm/Support/Casting.h:567: decltype(auto) llvm::cast(const From &) [To = mlir::StringAttr, From = mlir::Attribute]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
#74 278.2 PLEASE submit a bug report to https://github.com/NVIDIA/cuda-quantum and include the crash backtrace.
#74 278.2  #0 0x0000b29e612a9d7c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/cuda-quantum/build/bin/cudaq-opt+0x1899d7c)
#74 278.2  #1 0x0000b29e612a7c8c llvm::sys::RunSignalHandlers() (/cuda-quantum/build/bin/cudaq-opt+0x1897c8c)
#74 278.2  #2 0x0000b29e612aa604 SignalHandler(int) Signals.cpp:0:0
#74 278.2  #3 0x0000e5db097898f8 (linux-vdso.so.1+0x8f8)
#74 278.2  #4 0x0000e5db094d3274 raise (/lib64/libc.so.6+0x36274)
#74 278.2  #5 0x0000e5db094bda2c abort (/lib64/libc.so.6+0x20a2c)
#74 278.2  #6 0x0000e5db094ccba0 __assert_fail_base (/lib64/libc.so.6+0x2fba0)
#74 278.2  #7 0x0000e5db094ccc18 __assert_perror_fail (/lib64/libc.so.6+0x2fc18)
#74 278.2  #8 0x0000b29e607a0cac mlir::NamedAttribute::getNameDialect() const (/cuda-quantum/build/bin/cudaq-opt+0xd90cac)
#74 278.2  #9 0x0000b29e6072d594 std::__1::pair<mlir::NamedAttribute const*, bool> mlir::impl::findAttrSorted<mlir::NamedAttribute const*>(mlir::NamedAttribute const*, mlir::NamedAttribute const*, mlir::StringAttr) (/cuda-quantum/build/bin/cudaq-opt+0xd1d594)
#74 278.2 #10 0x0000b29e608a57c4 mlir::func::FuncOp::getResAttrsAttr() (/cuda-quantum/build/bin/cudaq-opt+0xe957c4)
#74 278.2 #11 0x0000b29e608aefd4 mlir::LogicalResult mlir::function_interface_impl::verifyTrait<mlir::func::FuncOp>(mlir::func::FuncOp) (/cuda-quantum/build/bin/cudaq-opt+0xe9efd4)
#74 278.2 #12 0x0000b29e608ae964 mlir::LogicalResult mlir::op_definition_impl::verifyTraits<mlir::OpTrait::OneRegion<mlir::func::FuncOp>, mlir::OpTrait::ZeroResults<mlir::func::FuncOp>, mlir::OpTrait::ZeroSuccessors<mlir::func::FuncOp>, mlir::OpTrait::ZeroOperands<mlir::func::FuncOp>, mlir::OpTrait::OpInvariants<mlir::func::FuncOp>, mlir::OpTrait::AffineScope<mlir::func::FuncOp>, mlir::OpTrait::AutomaticAllocationScope<mlir::func::FuncOp>, mlir::CallableOpInterface::Trait<mlir::func::FuncOp>, mlir::SymbolOpInterface::Trait<mlir::func::FuncOp>, mlir::FunctionOpInterface::Trait<mlir::func::FuncOp>, mlir::OpTrait::IsIsolatedFromAbove<mlir::func::FuncOp>, mlir::OpAsmOpInterface::Trait<mlir::func::FuncOp>>(mlir::Operation*) (/cuda-quantum/build/bin/cudaq-opt+0xe9e964)
#74 278.2 #13 0x0000b29e608ae7f4 mlir::Op<mlir::func::FuncOp, mlir::OpTrait::OneRegion, mlir::OpTrait::ZeroResults, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::ZeroOperands, mlir::OpTrait::OpInvariants, mlir::OpTrait::AffineScope, mlir::OpTrait::AutomaticAllocationScope, mlir::CallableOpInterface::Trait, mlir::SymbolOpInterface::Trait, mlir::FunctionOpInterface::Trait, mlir::OpTrait::IsIsolatedFromAbove, mlir::OpAsmOpInterface::Trait>::verifyInvariants(mlir::Operation*) FuncOps.cpp:0:0
#74 278.2 #14 0x0000b29e608ab724 mlir::RegisteredOperationName::Model<mlir::func::FuncOp>::verifyInvariants(mlir::Operation*) FuncOps.cpp:0:0
#74 278.2 #15 0x0000b29e608534b0 (anonymous namespace)::OperationVerifier::verifyOperation(mlir::Operation&) Verifier.cpp:0:0
#74 278.2 #16 0x0000b29e60853340 mlir::verify(mlir::Operation*, bool) (/cuda-quantum/build/bin/cudaq-opt+0xe43340)
#74 278.2 #17 0x0000b29e60ec23ec mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/cuda-quantum/build/bin/cudaq-opt+0x14b23ec)
#74 278.2 #18 0x0000b29e60ec28fc mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/cuda-quantum/build/bin/cudaq-opt+0x14b28fc)
#74 278.2 #19 0x0000b29e60ec7d40 std::__1::__function::__func<mlir::LogicalResult mlir::failableParallelForEach<std::__1::__wrap_iter<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&>(mlir::MLIRContext*, std::__1::__wrap_iter<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*>, std::__1::__wrap_iter<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&)::'lambda'(), std::__1::allocator<mlir::LogicalResult mlir::failableParallelForEach<std::__1::__wrap_iter<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&>(mlir::MLIRContext*, std::__1::__wrap_iter<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*>, std::__1::__wrap_iter<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&)::'lambda'()>, void ()>::operator()() Pass.cpp:0:0
#74 278.2 #20 0x0000b29e608565ec std::__1::__function::__func<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'(), std::__1::allocator<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()>, void ()>::operator()() Verifier.cpp:0:0
#74 278.2 #21 0x0000b29e6125aa70 llvm::ThreadPool::processTasks(llvm::ThreadPoolTaskGroup*) (/cuda-quantum/build/bin/cudaq-opt+0x184aa70)
#74 278.2 #22 0x0000b29e6125b408 void* llvm::thread::ThreadProxy<std::__1::tuple<llvm::ThreadPool::grow(int)::$_0>>(void*) ThreadPool.cpp:0:0
#74 278.2 #23 0x0000e5db0971d8b8 start_thread /builddir/build/BUILD/glibc-2.28/build-aarch64-redhat-linux/nptl/crtn.o:0:0
#74 278.2 #24 0x0000e5db094c0afc thread_start /builddir/build/BUILD/glibc-2.28/build-aarch64-redhat-linux/csu/abi-note.o:0:0
#74 278.2 /cuda-quantum/build/bin/nvq++: line 27: 25850 Aborted                 (core dumped) $*
#74 278.2 failed: "/cuda-quantum/build/bin/cudaq-opt --pass-pipeline=builtin.module(func.func(unwind-lowering),canonicalize,lambda-lifting,func.func(memtoreg{quantum=0}),canonicalize,apply-op-specialization,kernel-execution,aggressive-early-inlining,func.func(quake-add-metadata,const-prop-complex,lift-array-alloc),globalize-array-values,func.func(get-concrete-matrix),device-code-loader,expand-measurements,func.func(lower-to-cfg),canonicalize,cse) custom_operation_basic.qke -o custom_operation_basic.qke.VaX73u"

Environment

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

Suggestions

No response

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions