Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

Running SYCL program in MSVC Debug mode throws std::bad_array_new_length #256

Closed
martinstarkov opened this issue May 27, 2021 · 9 comments
Closed

Comments

@martinstarkov
Copy link
Collaborator

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):
image
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

@alycm
Copy link

alycm commented May 27, 2021

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?

@martinstarkov
Copy link
Collaborator Author

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).

@razorbeard
Copy link

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 :
computecpp_info

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 :
debug_mode_computecpp

@DuncanMcBain
Copy link
Member

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?

@razorbeard
Copy link

Hello Duncan, here's the following lines from my CMakeCache file :
cmakecache_output

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.

@DuncanMcBain
Copy link
Member

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).

@razorbeard
Copy link

Yes, here's the flag I have changed in the simple-add-vector sample :
runtime_mdd

Changing it to this one make it works :
runtime_mt

Could it be a bug in the ComputeCpp_d.lib file ?

@Bensuo
Copy link
Contributor

Bensuo commented Sep 15, 2021

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.

@razorbeard
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants