You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CUDA does not support libc++ on x86 officially. It seems the situation with HIP is the same, although there's no explicit check. And, from the looks of it, generic target does not work all that well either (at lease when AdaptiveCpp and LLVM themselves are compiled with libstdc++). However, the errors produced are super unhelpful except for SMCP with CUDA.
To Reproduce
With a simple file just including #include <sycl/sycl.hpp>:
#include<sycl/sycl.hpp>intmain()
{
return0;
}
CUDA multipass does not work, but shows a helpful error:
$ acpp --acpp-targets=cuda:sm_86 --stdlib=libc++ simple.cpp acpp warning: No optimization flag was given, optimizations are disabled by default. Performance may be degraded. Compile with e.g. -O2/-O3 to enable optimizations.clang++: warning: CUDA version is newer than the latest partially supported version 12.1 [-Wunknown-cuda-version]In file included from <built-in>:1:In file included from /usr/lib/llvm-17/lib/clang/17/include/__clang_cuda_runtime_wrapper.h:98:In file included from /usr/local/cuda/include/host_defines.h:60:/usr/local/cuda/include/crt/host_defines.h:67:2: error: "libc++ is not supported on x86 system" 67 | #error "libc++ is not supported on x86 system" | ^1 error generated when compiling for sm_86.
HIP multipass does not work, but shows a confusing error after replacing the __local function name with an address space cast:
$ acpp --acpp-targets=hip:gfx1034 --stdlib=libc++ simple.cpp acpp warning: No optimization flag was given, optimizations are disabled by default. Performance may be degraded. Compile with e.g. -O2/-O3 to enable optimizations.In file included from simple.cpp:1:In file included from /home/aland/local/bin/../include/AdaptiveCpp/sycl/sycl.hpp:31:In file included from /home/aland/local/bin/../include/AdaptiveCpp/sycl/../hipSYCL/sycl/sycl.hpp:58:In file included from /home/aland/local/bin/../include/AdaptiveCpp/sycl/../hipSYCL/sycl/libkernel/accessor.hpp:42:In file included from /home/aland/local/bin/../include/AdaptiveCpp/hipSYCL/runtime/runtime.hpp:32:In file included from /home/aland/local/bin/../include/AdaptiveCpp/hipSYCL/runtime/dag_manager.hpp:37:In file included from /home/aland/local/bin/../include/AdaptiveCpp/hipSYCL/runtime/dag_submitted_ops.hpp:36:In file included from /home/aland/local/bin/../include/AdaptiveCpp/hipSYCL/runtime/generic/async_worker.hpp:36:In file included from /usr/lib/llvm-17/bin/../include/c++/v1/queue:272:/usr/lib/llvm-17/bin/../include/c++/v1/deque:436:67: error: expected ')' 436 | static _LIBCPP_HIDE_FROM_ABI __local_iterator __local(_Iterator __iter) { return __iter.__ptr_; } | ^/usr/lib/llvm-17/bin/../include/c++/v1/deque:436:56: note: to match this '(' 436 | static _LIBCPP_HIDE_FROM_ABI __local_iterator __local(_Iterator __iter) { return __iter.__ptr_; } | ^/usr/lib/llvm-17/bin/../include/c++/v1/deque:436:57: error: redefinition of '_Iterator' as different kind of symbol 436 | static _LIBCPP_HIDE_FROM_ABI __local_iterator __local(_Iterator __iter) { return __iter.__ptr_; } | ^/usr/lib/llvm-17/bin/../include/c++/v1/deque:428:9: note: previous definition is here 428 | using _Iterator = __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer, _DiffType, _BlockSize>; | ^/usr/lib/llvm-17/bin/../include/c++/v1/deque:436:77: error: expected expression 436 | static _LIBCPP_HIDE_FROM_ABI __local_iterator __local(_Iterator __iter) { return __iter.__ptr_; } | ^/usr/lib/llvm-17/bin/../include/c++/v1/deque:449:4: error: expected ';' at end of declaration list 449 | } | ^4 errors generated when compiling for gfx1034.
SSCP compiles the code, but the program crashes immediately:
$ acpp --acpp-targets=generic --stdlib=libc++ simple.cpp acpp warning: No optimization flag was given, optimizations are disabled by default. Performance may be degraded. Compile with e.g. -O2/-O3 to enable optimizations.
$ ./a.out [AdaptiveCpp Error] hcf_cache: Invalid hcf object (missing object id)Segmentation fault (core dumped)
Expected behavior
Either libc++ is supported (significant effort) or a consistent compile-time error is emitted.
I think a prerequisite is that both acpp-compiled code and the AdaptiveCpp runtime definitely need to use the same standard library. The application tries to pass C++ objects between runtime library and itself, so there needs to be ABI compatibility. This is what you have seen with generic target. Once that is done, libc++ should work too, except for stdpar (where it is also documented that currently libstdc++ is needed).
For the other compilation flows, it's a problem in clang CUDA/HIP although we could ensure that better warnings are generated (and document this limitation as you suggest).
Bug summary
CUDA does not support libc++ on x86 officially. It seems the situation with HIP is the same, although there's no explicit check. And, from the looks of it,
generic
target does not work all that well either (at lease when AdaptiveCpp and LLVM themselves are compiled with libstdc++). However, the errors produced are super unhelpful except for SMCP with CUDA.To Reproduce
With a simple file just including
#include <sycl/sycl.hpp>
:CUDA multipass does not work, but shows a helpful error:
HIP multipass does not work, but shows a confusing error after replacing the
__local
function name with an address space cast:SSCP compiles the code, but the program crashes immediately:
Expected behavior
Either libc++ is supported (significant effort) or a consistent compile-time error is emitted.
Describe your setup
Additional context
Not critical. Just making a public note about a confusing behavior.
The text was updated successfully, but these errors were encountered: