Visible to Intel only — GUID: ewa1456406724701
Ixiasoft
Visible to Intel only — GUID: ewa1456406724701
Ixiasoft
11.3.1.1. Omit Hardware that Generates and Dispatches Kernel IDs
Semantically, the max_global_work_dim(0) kernel attribute specifies that the global work dimension of the kernel is zero. Setting this kernel attribute means that the kernel does not use any global, local, or group IDs. The presence of this attribute in the kernel code serves as a guarantee to the offline compiler that the kernel is a single work-item kernel.
When compiling the following kernel, the offline compiler generates interface hardware as illustrated in Intel® FPGA SDK for OpenCL™ Offline Compiler-Generated Interface Hardware for a Kernel with the max_global_work_dim(0) Attribute.
channel int chan_in;
channel int chan_out;
__attribute__((max_global_work_dim(0)))
__kernel void plusK (int N, int k) {
for (int i = 0; i < N; ++i) {
int data_in = read_channel_intel(chan_in);
write_channel_intel(chan_out, data_in + k);
}
}
If your current kernel implementation has multiple work-items but does not use global, local, or group IDs, you can use the max_global_work_dim(0) kernel attribute if you modify the kernel code accordingly:
- Wrap the kernel body in a for loop that iterates as many times as the number of work-items.
- Launch the modified kernel with only one work-item.