Parameters representing number of events as well as sizes of enqueued block arguments in enqueue_kernel function are specified as uint type. This prevents passing sizeof(int) type expressions on the 64 bit architectures because they return size_t which is a 64 bit wide in contrast to uint that is always 32 bits.
The suggestion is:
- For the number of events argument allow to pass larger integers than 32 bits as soon as compiler can prove that the range fits in 32 bits. If not, the diagnostic will be given.
- Change type of the arguments specifying sizes of the corresponding block arguments to be size_t.
The proposed enqueue_kernel signature would be:
int enqueue_kernel (queue_t queue, kernel_enqueue_flags_t flags, const ndrange_t ndrange, uint num_events_in_wait_list, const clk_event_t *event_wait_list, clk_event_t *event_ret, void (^block)(local void *, ...), size_t size0, ...)
and therefore compiler should allow the call:
enqueue_kernel(default_queue, flags, ndrange, sizeof(event_wait_list)/sizeof(event_wait_list[0]), event_wait_list2, &clk_event, ^(local void *p) { return; }, sizeof(int[2]));
See tests for more examples.
should Int32Ty be SizeTy?