cornell-zhang / heterocl

HeteroCL: A Multi-Paradigm Programming Infrastructure for Software-Defined Heterogeneous Computing
https://cornell-zhang.github.io/heterocl/
Apache License 2.0
326 stars 92 forks source link

OpenCL Codegen Issue #391

Closed yn224 closed 3 years ago

yn224 commented 3 years ago

Issue Description

Generated kernel.cpp code from vitis simulation has a missing argument to the buffer functions that looks like the following:

host.cpp: In function ‘int main(int, char**)’:
host.cpp:107:99: error: expected primary-expression before ‘.’ token
   cl::Buffer buffer_(context, CL_MEM_USE_HOST_PTR | CL_MEM_READ_WRITE, sizeof(float)*1080*1920*3, .data(), &err);
                                                                                                   ^
host.cpp:108:22: error: redeclaration of ‘cl::Buffer buffer_’
   cl::Buffer buffer_(context, CL_MEM_USE_HOST_PTR | CL_MEM_READ_WRITE, sizeof(float)*3*3, .data(), &err);
                      ^~~~~~~
host.cpp:107:14: note: ‘cl::Buffer buffer_’ previously declared here
   cl::Buffer buffer_(context, CL_MEM_USE_HOST_PTR | CL_MEM_READ_WRITE, sizeof(float)*1080*1920*3, .data(), &err);
              ^~~~~~~
host.cpp:108:91: error: expected primary-expression before ‘.’ token
   cl::Buffer buffer_(context, CL_MEM_USE_HOST_PTR | CL_MEM_READ_WRITE, sizeof(float)*3*3, .data(), &err);
                                                                                           ^
host.cpp:109:22: error: redeclaration of ‘cl::Buffer buffer_’
   cl::Buffer buffer_(context, CL_MEM_USE_HOST_PTR | CL_MEM_READ_WRITE, sizeof(float)*3*3, .data(), &err);
                      ^~~~~~~
host.cpp:107:14: note: ‘cl::Buffer buffer_’ previously declared here
   cl::Buffer buffer_(context, CL_MEM_USE_HOST_PTR | CL_MEM_READ_WRITE, sizeof(float)*1080*1920*3, .data(), &err);
              ^~~~~~~
host.cpp:109:91: error: expected primary-expression before ‘.’ token
   cl::Buffer buffer_(context, CL_MEM_USE_HOST_PTR | CL_MEM_READ_WRITE, sizeof(float)*3*3, .data(), &err);
                                                                                           ^
host.cpp:110:22: error: redeclaration of ‘cl::Buffer buffer_’
   cl::Buffer buffer_(context, CL_MEM_USE_HOST_PTR | CL_MEM_READ_WRITE, sizeof(float)*1078*1918, .data(), &err);
                      ^~~~~~~
host.cpp:107:14: note: ‘cl::Buffer buffer_’ previously declared here
   cl::Buffer buffer_(context, CL_MEM_USE_HOST_PTR | CL_MEM_READ_WRITE, sizeof(float)*1080*1920*3, .data(), &err);
              ^~~~~~~
host.cpp:110:97: error: expected primary-expression before ‘.’ token
   cl::Buffer buffer_(context, CL_MEM_USE_HOST_PTR | CL_MEM_READ_WRITE, sizeof(float)*1078*1918, .data(), &err);

The error can be reproduced by running the pipelined version of Sobel example addressed in PR #384 .

hecmay commented 3 years ago

It turns out to be a one line change of code for the fix. Will push the fix in a separate PR.