computecpp-sdk
computecpp-sdk copied to clipboard
Running SYCL program in MSVC Debug mode throws std::bad_array_new_length
Cloned the latest computecpp-sdk samples and built project files using the included CMake.
Running on Visual Studio v16.9.4 2019 on Windows 10 in Debug mode.
Exception points to the queue construction (with both default constructor and with specific ones):
This seems like a ComputeCpp bug and nothing to do with the samples as I have tested in my own code and it occurs with any simple queue construction. Perhaps not though, as Visual Studio seems to link with the correct debug library, found in the linker dependencies:
\computecpp\lib\ComputeCpp_d.lib
Hello,
The image says fluid_simulation.exe
which is not in the samples as far as I can see. Does the same exception occur for all programs in the SDK? Or some of them?
Oh. Yes that image was taken from my own program but the same exception occurs on the sample programs. I have not tested every single one but it seems to occur where a cl::sycl::queue object is used (constructed).
I'm joinning this thread because I have the same issue. I am using Visual Studio 16.11.2 on Windows 10. Here's computecpp_info output on my machine :
Build has been done through CMake with the following command line from the guide, plus an extra command for my device :
cmake .. -G "Visual Studio 16 2019" -A x64 -DComputeCpp_DIR="C:\Program Files\Codeplay\ComputeCpp" -DCOMPUTECPP_BITCODE=ptx64
. No problem so far.
Building simple_vector_add
in release mode seems to work, but in debug mode the same error as @martinstarkov is thrown :
The CMake should pick up the debug version of the ComputeCpp library when building in debug mode, but it's possible that it's not. Can you check the CMake cache (it's in the build folder) for the entry COMPUTECPP_RUNTIME_LIBRARY_DEBUG
?
Hello Duncan, here's the following lines from my CMakeCache file :
It seems to be ok in Debug mode. In the project properties in C/C++ > Code Generation > Runtime Library, if I manually switch the /MDd flag to /MT only it works. I have also tested previous versions of CMake in case of deprecating functions, but I still get the same problem.
Yes those are the right libraries. Are you saying that if you change from the debug CRT to the release CRT, debug builds start working again? If that's the case, that's definitely unexpected (I don't know what those flags do, I'm afraid, but I'm guessing from some documentation).
Yes, here's the flag I have changed in the simple-add-vector sample :
Changing it to this one make it works :
Could it be a bug in the ComputeCpp_d.lib file ?
I have also tested previous versions of CMake in case of deprecating functions, but I still get the same problem.
Did you try any version of CMake 3.14
or lower? I believe 3.15
introduced the change that causes this issue.
Doesn't seems to work either. I tried versions 3.14
and 3.15
but the same error is raised.
Below 3.14
there's not support for Visual Studio 2019 unfortunately.