cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
179 Views
Registered: ‎02-07-2020

Vitis sw emulation stalls with message error

Hi to all!

I have implemented in Vitis a gray image conversion algorithm. The project is based on Vector add example.

When i give as input-image_size a large image and set buffer size above 2048 the sw emulation stalls and gives me the message "software emulation of compute unit(s) exited unexpectedly".

the kernel code is....

 

#define BUFFER_SIZE 2048
#define IMAGE_SIZE 3780
#include <stdio.h>
#include <string.h>

const unsigned int c_size = IMAGE_SIZE/BUFFER_SIZE;

extern "C" {

void grayconvert(unsigned char *image, unsigned char *gray_image, int size)

{

	#pragma HLS dataflow // enable Pipelining



	unsigned char v1_buffer[BUFFER_SIZE];   // Local memory to store vector1
	unsigned int vout_buffer[BUFFER_SIZE]; // Local Memory to store result


	read1:
	for (int j = 0; j < BUFFER_SIZE; j++) {
		#pragma HLS LOOP_TRIPCOUNT min=c_size max=c_size
		#pragma HLS PIPELINE II=1
		v1_buffer[j] = image[j];

	}

	Gray:
	for (int j=0; j<BUFFER_SIZE; j++){
		#pragma HLS LOOP_TRIPCOUNT min=c_size max=c_size
		#pragma HLS PIPELINE II=1
		vout_buffer[j] =( 18*v1_buffer[3*j]+ 37*v1_buffer[3*j+1]+ 7*v1_buffer[3*j+2])/64 ;

		}


//burst write the result

	write:
	for (int j = 0; j < BUFFER_SIZE; j++) {
		 #pragma HLS LOOP_TRIPCOUNT min=c_size max=c_size
		 #pragma HLS PIPELINE II=1
		 gray_image[j] = vout_buffer[j];
		 }


		  	}

		  }

 

 After debugging with printfs i noticed that the problem is in the Gray for loop and buffer size.

Any idea would be precious.

0 Kudos
4 Replies
Highlighted
Moderator
Moderator
114 Views
Registered: ‎09-12-2007

Is there a log file you can share?

0 Kudos
Highlighted
Explorer
Explorer
103 Views
Registered: ‎02-07-2020

@stephenm 

Hi!

Which log file specifically you want me to send?

Regards

 

0 Kudos
Highlighted
Observer
Observer
52 Views
Registered: ‎12-23-2018

@stzog make sure you are not trying to access array index which is out of range. 

0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
44 Views
Registered: ‎06-24-2020

Hi @stzog,

I see that your shared kernel is not using the kernel argument size anywhere. Kindly refer the following vector addition kernel once -

https://github.com/Xilinx/Vitis_Accel_Examples/blob/master/hello_world/src/vadd.cpp

You may refer the following example as well to see how images can be handled as input -

https://github.com/Xilinx/Vitis_Accel_Examples/tree/master/cpp_kernels/custom_datatype

 

0 Kudos