I get the following message in a messagebox dialog:
"Could not build OpenCL program 1 (Context 1) for debugging.
OpenCL kernel debugging will be disabled for this program.
Error Code: CL_BUILD_PROGRAM_FAILURE"
How can I avoid this problem, and is this a known issue with CodeXL?
To allow debugging of OpenCL kernels, CodeXL forces a few build flags on your programs.
If you are not intending to use CodeXL for OpenCL kernel debugging (e.g. only for API-level debugging), you can ignore this message (and see below on how to make it go away).
In some rare cases (usually, kernels that take the device to some resource limit, kernels that use some special build flags or kernels that use some advanced features), adding these debug flags causes the build operation (clBuildProgram) to fail where normally it would succeed.
This is what this message signifies.
Note that kernels that belong to other programs in your application are not affected.
1. To avoid the issue, try the following:
A. Remove any build flags added to clBuildProgram that are not necessary. Probable culprits are flag pertaining to optimizations.
B. If the program has multiple kernels, consider splitting it to separate programs (one for each kernel)
C. Try splitting the kernel to smaller kernels.
2. If none of the above work, you can try to see what the build error is:
A. Add the build flags "-g -O0" to your clBuildProgram (note that these flags will only work on AMD platforms)
B. This is expected to make clBuildProgram fail
C. Now get the program's build log, which may contain information on what is the problem.
3. If your version of CodeXL is much newer than your Catalyst driver or vice-versa, there might be a problem with that as well. Which versions are you using?
4. To disable the forcing of the flags outright (note that this will make it so that NONE of the OpenCL programs in the applications will be debuggable):
A. Open CodeXL's general project settings
B. Open the environment variables dialog
C. Add an environment variable named "SU_CS_DONT_ADD_DEBUGGING_BUILD_FLAGS" with the value 1.
Hope this was helpful,
If I add "-g -O0" then the build fails with
Error: Undeclared function index 1119
(By the way, this is a terrible nondescript error message that should be fixed)
CodeXL version is 1.7.8364.0
AMD Catalyst version: 14.4