Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenCL fallback to CPU device causes assert in debug build #378

Open
pezcode opened this issue Sep 19, 2024 · 1 comment
Open

OpenCL fallback to CPU device causes assert in debug build #378

pezcode opened this issue Sep 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@pezcode
Copy link

pezcode commented Sep 19, 2024

When the OpenCL backend falls back from GPU to CPU device, the following line causes an assert:

ocl_error_printf("ocl::init: Couldn't get any GPU device ID's, trying CL_DEVICE_TYPE_CPU\n");

ocl_error_printf() contains the following:

#if BASISU_OPENCL_ASSERT_ON_ANY_ERRORS
		assert(0);
#endif

even though in this case the error isn't fatal and execution continues normally in release builds.

BASISU_OPENCL_ASSERT_ON_ANY_ERRORS is hardcoded to 1 further up top so can't be disabled. The CPU device fallback should either not call ocl_error_printf() or BASISU_OPENCL_ASSERT_ON_ANY_ERRORS should be overridable, e.g.:

#ifndef BASISU_OPENCL_ASSERT_ON_ANY_ERRORS
  #define BASISU_OPENCL_ASSERT_ON_ANY_ERRORS (1)
#endif
@richgel999
Copy link
Contributor

Thanks - will reproduce and fix.

@richgel999 richgel999 added the bug Something isn't working label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants