-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Steps
- Build
release/13.xhalide python bindings - Run the python snippet at the end
- Compile the output C file with
g++into an object
Expected: Since TargetFeature.CPlusPlusMangling is enabled, I can compile the generated C source with g++.
Actual: Compile error. I extracted the offending code to https://www.godbolt.org/z/bTbT7PKaT
reprod.c: In function ‘int consumer(halide_buffer_t*)’:
reprod.c:2657:47: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
2657 | void *const _60 = ((const void * *)_opencl)[0];
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
| |
| const void*
reprod.c:2897:49: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
2897 | void *const _202 = ((const void * *)_opencl)[0];
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
| |
| const void*
Here are the two offending snippets
void *const _56 = _halide_buffer_get_host(_opencl_buf_buffer);
void * _opencl = _56;
void *const _57 = _halide_buffer_get_host(_opencl_gpu_source_kernels_buffer);
int32_t const _58 = halide_opencl_initialize_kernels(_ucon, _opencl, _57, 4166);
bool const _59 = _58 == 0;
if (!_59)
{
return _58;
}
void *const _60 = ((const void * *)_opencl)[0]; // error 1 void *const _202 = ((const void * *)_opencl)[0]; // error 2def find_gpu_target():
host_target = get_host_target()
return Target(host_target.os, host_target.arch, host_target.bits,
[TargetFeature.OpenCL, TargetFeature.CLDoubles, TargetFeature.CPlusPlusMangling])
x, y = Var(), Var()
consumer = Func("consumer")
lut_const = np.arange(128)
lut_buffer = Buffer(lut_const)
at_lut = Func("at_lut")
i = Var()
at_lut[i] = lut_buffer[i] % 16
consumer[x, y] = at_lut[(x + y) % lut_const.shape[0]] * (x * x + y)
xo, yo, xi, yi = Var(), Var(), Var(), Var()
consumer.gpu_tile(x, y, xo, yo, xi, yi, 8, 8)
consumer.compile_to(outputs={
Output.c_source: str(Path(__file__).parent / "reprod.c"),
}, arguments=[], fn_name="consumer", target=find_gpu_target())Metadata
Metadata
Assignees
Labels
No labels