cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
1,450 Views
Registered: ‎08-28-2018

Compilation problem in SDSoC and zcu104 reVISION platform

Jump to solution

Hi,

I'm facing a really annoying problem with the porting in HW of a very simple function that iterates on all the pixels of an input image and outputs a resulting image with pixels with values that are half of the original value. The function is not useful at all but I used it to test the complete procedure to run a function in HW. The strange thing is that if I insert the function in one of the live examples (filter2d) everything works fine but if I make a new project based on the zcu104 reVision platform I get always the same error during compilation:

 

C:/Xilinx/SDK/2018.2/gnu/aarch64/nt/aarch64-linux/aarch64-linux-gnu/include/c++/7.2.1\bits/move.h:48:14: error: use of undeclared identifier '__builtin_addressof'
    { return __builtin_addressof(__r); }

 

I checked the compilation options in the two cases, i.e. filter2d and the new project but they look exactly the same.

 

Any help will be really appreciated

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Observer
Observer
1,375 Views
Registered: ‎08-28-2018

Hi @agary,

thanks for the support, but I eventually solved by simply moving the function to be accelerated into a separated .cpp file and starting with a new project. It worked but I don't know why

 

BR

DaT63

View solution in original post

5 Replies
Highlighted
Observer
Observer
1,418 Views
Registered: ‎05-17-2018

Hello @dat63

 

I'm not an expert at all but you mentioned: "Any help will be really appreciated".

According to this link, it looks like that the problem is about your compiler version since the "__builtin_addressof" is relatively new. So I recommend you to solve the problem with one of the methods mentioned via the link.

 

Agary 

0 Kudos
Highlighted
Observer
Observer
1,396 Views
Registered: ‎08-28-2018

Hi agary,

I tried the suggestion mentioned in your link but with no result, because other errors pop up and I am a bit worried to modify the toolchain include file. I attach a copy of the simple function and the main if someone can help. If I do not select the function to be implemented in HW the compilation is OK otherwise I get the annoying error:

 

C:/Xilinx/SDK/2018.2/gnu/aarch64/nt/aarch64-linux/aarch64-linux-gnu/include/c++/7.2.1\bits/move.h:48:14: error: use of undeclared identifier '__builtin_addressof'
    { return __builtin_addressof(__r); }

 

I am using the xf_bilateral_filter example in order to have the reVISION Platform already setup. I simply removed the existing main with the code hereinafter:

 

#pragma SDS data mem_attribute(rgb_in:NON_CACHEABLE|PHYSICAL_CONTIGUOUS)
#pragma SDS data copy(rgb_in[0:nPixels])
#pragma SDS data access_pattern(rgb_in:SEQUENTIAL)
#pragma SDS data mem_attribute("gray_out.data":NON_CACHEABLE|PHYSICAL_CONTIGUOUS)
#pragma SDS data copy("gray_out.data"[0:"gray_out.size"])
#pragma SDS data access_pattern("gray_out.data":SEQUENTIAL)
void rgb24togray8(ap_uint<8> *rgb_in, xf::Mat<XF_8UC1, HEIGHT, WIDTH, XF_NPPC1> &gray_out, int nPixels)
{
 int i;
 unsigned short aveVal;
 for(i=0; i<nPixels; i++)
 {
#pragma HLS pipeline II=1
  aveVal=*(rgb_in+i*3)+*(rgb_in+1+i*3)+*(rgb_in+2+i*3);
  gray_out.data[i]=(char)(aveVal/3);
 }
}
int main(int argc, char **argv)
{
 cv::Mat in_img;
 xf::Mat<TYPE, HEIGHT, WIDTH*3, NPC1> *_src;
 xf::Mat<TYPE, HEIGHT, WIDTH, NPC1> *_dst;
 if(argc != 2)
 {
  printf("Usage: <executable> <input image path> \n");
  return -1;
 }
 in_img = cv::imread(argv[1], 1); // reading in the color image
 if(!in_img.data)
 {
  printf("Failed to load the image ... !!!\n");
  return -1;
 }
 uint16_t width = in_img.cols;
 uint16_t height = in_img.rows;
 _src=new xf::Mat<TYPE, HEIGHT, WIDTH*3, NPC1>(height, width*3);
 _dst = new xf::Mat<TYPE, HEIGHT, WIDTH, NPC1>(height, width);
 _src->copyTo(in_img.data);
 rgb24togray8((ap_uint<8>*)in_img.data,  *_dst, width*height);
 xf::imwrite("hls_out.bmp",*_dst);
 printf("Done...\n");
 return 0;
}
0 Kudos
Highlighted
Observer
Observer
1,385 Views
Registered: ‎05-17-2018

Hello @dat63,

 

I'm doing my best to find a way out of this maze for you. But I think finally Xilinx experts should solve your problem.

After reading more about the error, now I think the problem is about "gray_out" argument. For testing purposes, is it possible for you to replace it with some types other than a template (maybe creating a struct is not a bad idea)?

 

Best regards,

Agary

0 Kudos
Highlighted
Observer
Observer
1,376 Views
Registered: ‎08-28-2018

Hi @agary,

thanks for the support, but I eventually solved by simply moving the function to be accelerated into a separated .cpp file and starting with a new project. It worked but I don't know why

 

BR

DaT63

View solution in original post

Highlighted
Visitor
Visitor
606 Views
Registered: ‎06-03-2019

Hi dat63,

I also have the same problem you're having, can you describe in more detail how you fixed it?

 

Thanks

0 Kudos