-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Tutorial lesson_12 fails to run, reporting compile failure. #4918
Comments
The thing that is failing is:
Which really is valid OpenCL C. The target you are running on appears to not be a compliant implementation. It comes from here: https://github.com/halide/Halide/blob/master/src/CodeGen_C.cpp#L2806 That line can be commented off and the tutorial (still) works, but that may not be a suitable workaround in general. I suspect that is there to avoid issues with unused declarations in other contexts on other OpenCL implementations. |
Hi Dillon |
Let me take a look and see if we can change the code generation here to avoid this. I suggest also reporting the issue to the OpenCL vendor, because I really think this should be valid OpenCL C. |
I'm pretty stumped on finding a portable way to deal with this. CodeGen_C assumes C++, so for that, I think we should do:
But for OpenCL C, I can't find something that I think will work on every OpenCL C compiler (except Another option is that perhaps these only ever result from gpu_thread_barrier calls, which don't actually return an int. If we had a Another option is to simply allow the unused variable warnings to exist. This probably isn't that bad? In that case, we could use the The only other option I can see is to provide a few different options as target flags, and let people choose them. @vksnk @steven-johnson @abadams any ideas? |
It is always legal to cast scalar types to int?
|
As far as I can tell, unnamed function parameters are not legal in C. For example: https://stackoverflow.com/questions/3487135/unnamed-parameters-in-c I just had a horrible idea to use varargs:
But I'm not sure that this is safe without using the va_start macro stuff, or if varargs are even legal in OpenCL C at all. |
What about unused function parameters, are those going to cause a warning? |
I don't think there is a big difference between unused vars and unused function parameters. It seems likely that at least some compilers will warn on some of these. I think we should use the template unused for plain CodeGen_C, and just leave variables unused for OpenCL C. My guess is we never cared about warnings in that case, only CodeGen_C (which produces headers/code compiled by host compilers not running at runtime). |
Hi
I'm working my way through the halide tutorials on Odroid XU4, Linux 18.04.4, armv7l.
Lesson_12 seems to compile ok but when running, aborts with a build failure. Tried running with
HL_DEBUG_CODEGEN=3 and the last part of debug is as follows:
Testing GPU correctness:
Realizing Pipeline for target(arch_unknown-0-os_unknown)
jit-compiling for: target(arm-32-linux-jit-opencl-user_context)
Reusing old jit module compiled for :
target(arm-32-linux-jit-opencl-user_context)
custom_print: 0xb6f20fbc
custom_malloc: 0xb6f22000
custom_free: 0xb6f2205c
custom_do_task: 0xb6f1ffac
custom_do_par_for: 0xb252d130
custom_error: 0xb2deec11
custom_trace: 0xb2526000
JIT input Image argument b0 @ 0x55d2c0
__user_context @ 0xbef8ea44
JIT output buffer @ 0x7fac90, 0
Calling jitted function
Error: CL: clBuildProgram failed: CL_BUILD_PROGRAM_FAILURE
Build Log:
The text was updated successfully, but these errors were encountered: