Altera_Forum
Honored Contributor
7 years agopassing pointer to RTL library
Hello everyone,
I'm having a RTL library function that writes to the DDR some data to an address given as an input. Currently, my design is very simple and the OpenCL wrapper only passes the data and pointer, which works see the code below.kernel void test_lib (__global uint* restrict pin, ulong din) {
ulong8 din_extended; // ddr words must be 512 bits width
din_extended.s0 = din;
din_extended.s1 = din + 1;
din_extended.s2 = din + 2;
din_extended.s3 = din + 3;
din_extended.s4 = din + 4;
din_extended.s5 = din + 5;
din_extended.s6 = din + 6;
din_extended.s7 = din + 7;
ddr_w_rtl(pin, din_extended);
} But then I want to optimize my OpenCL call. So I want to create a buffer of input pointers and a buffer of data. So far, I did not found a way to bypass the compiler checks that annoys me. I tried the following OpenCL kernel: kernel void test_lib (__global uint* restrict pin, ulong din, uint n_input) {
ulong8 din_extended;
din_extended.s0 = din;
//din_extended stuff ...//
for(uint i = 0; i < n_input; i++){
ddr_w_rtl(pin, din_extended);
}
} I checked that the buffer created on the global memory is n_input*8 long. The compiler answer is: /home/.../kernel.test.cl:16: Compiler Error: Pointer argument 0 to 'ddr_w_rtl' HDL Function Call is not a function argument!
Compiler Error: A pointer passed to HDL library componenet must satisfy all these criteria:
Compiler Error: 1. Must be a global or constant address space pointer.
Compiler Error: 2. Must be a kernel argument.
Compiler Error: 3. Must be marked with 'restrict' keyword to prevent aliasing.
Compiler Error: 4. Must have no other uses besides a single HDL library component OR
Compiler Error: must have all its uses, including by all HDL library components, as read-only.
Error: Optimizer FAILED. I see that my problem comes from point 4. But I don't understand how I can avoid such check. In my case, it is useless. There is no point of preventing me such pointer usage knowing that my kernel can access any address it want, whatever the input! Thanks, Alban