To access the RTL-based kernel, the host code needs to be updated. The updates have been done in the host_step2.cpp
file located in the following directory.
./reference-files/src/host/
The updates includes additional OpenCL API calls briefly described below. The additional OpenCL API calls are identical to the ones used for the C++ based kernel with the arguments changed for the RTL-based kernel.
cl::Program::Binaries bins;
bins.push_back({buf,nb});
cl::Program program(context, devices, bins);
The following code gets the rtl_kernel_wizard_0
object from the program and assigns the name krnl_const_add on line 198. The rtl_kernel_wizard_0
object name matches the name of the kernel you generated with the RTL Wizard.
cl::Kernel krnl_const_add(program,"rtl_kernel_wizard_0");
Next, define the krnl_const_add kernel arguments on line 219.
NOTE: In the host code, the buffer
buffer_result
is passed directly from the C kernel to the RTL kernel through DDR without being moved back to the host memory.
krnl_const_add.setArg(0,buffer_result);
Launch the krnl_const_add kernel on line 222.
q.enqueueTask(krnl_const_add);