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

XRT error on sw-emulation

Jump to solution

Hi to all!

I have implemented o Sobel filter edge detection with 3 kernels in C and i want to pass it to Vitis.

Build is successful but i receive xrt error on sw emulation. 

INFO: [SW-EM 09-0] Unable to find emconfig.json. Using default device.
Found Platform
Platform Name: Xilinx
INFO: Reading ./binary_container_1.xclbin
Loading: './binary_container_1.xclbin'
INFO: [SW-EM 09-0] Unable to find emconfig.json. Using default device.
Trying to program device[0]: xilinx_zcu102_base_202010_1
Device[0]: program successful!
XRT build version: 2.6.0
Build hash: 2d6bfe4ce91051d4e5b499d38fc493586dd4859a
Build date: 2020-05-26 18:53:06
Git branch: 2020.1
PID: 663
UID: 0
[Tue Oct  6 17:53:19 2020]
HOST: zynqmp-common-2020_1
EXE: /media/sd-mmcblk0p1/sobel
[XRT] ERROR: program is nullptr
../src/sobelhost.cpp:92 Error calling cl::Kernel krnl_sob(program, "grayconvert", &err), error code is: -44

 Any help to overcome this error would be precious!

0 Kudos
1 Solution

Accepted Solutions
kmorris
Xilinx Employee
Xilinx Employee
516 Views
Registered: ‎01-11-2011

Hi @stzog, the best way to debug these issues is to run the debugger (bug icon in the toolbar) and step through your kernel code via breakpoints. When doing this, I found a couple of issues.

The first was a missing kernel argument for your imgscan kernel, your host code only specifies 3 arguments, but misses the T variable (threshold from what I could gather). After adding the extra argument with a best-guess value, the next error I saw when stepping through the code is a segmentation fault when entering the below in the grayconvert kernel:

 

for (int x=0; x<width*height; x++){
gray_image[x] = 0.2989*image[3*x]+ 0.5870*image[3*x+1]+ 0.1140*image[3*x+2] ;

 

The width and height are not initialized to any value, which can cause the seg fault. When defining them to a value, the kernel seems to process, but I would also check that your values do not exceed the array bounds of the 'image' variable.

-------------------------------------------------------------------------
Please don’t forget to reply, kudo, and accept as solution!
-------------------------------------------------------------------------

View solution in original post

12 Replies
kmorris
Xilinx Employee
Xilinx Employee
924 Views
Registered: ‎01-11-2011

Hi @stzog, is this being run via GUI or command line? If it is command line, I am wondering if you have the XCL_EMULATION_MODE variable set per the instructions here. Your executable appears to be running from /media/sd-mmcblk0p1/sobel, could you double check that the host is actually in this location?

-------------------------------------------------------------------------
Please don’t forget to reply, kudo, and accept as solution!
-------------------------------------------------------------------------
0 Kudos
stzog
Explorer
Explorer
915 Views
Registered: ‎02-07-2020

@kmorris 

Hi and thanks for your reply.

It is this being run via GUI not command line.

0 Kudos
kmorris
Xilinx Employee
Xilinx Employee
897 Views
Registered: ‎01-11-2011

Would it be possible to provide the archived Vitis project to reproduce (File > Export)?

-------------------------------------------------------------------------
Please don’t forget to reply, kudo, and accept as solution!
-------------------------------------------------------------------------
0 Kudos
stzog
Explorer
Explorer
857 Views
Registered: ‎02-07-2020

@kmorris 

I attached it!

0 Kudos
stzog
Explorer
Explorer
842 Views
Registered: ‎02-07-2020

Can anybody explain the following error?

INFO: [SW-EM 09-0] Unable to find emconfig.json. Using default device.
Found Platform
Platform Name: Xilinx
INFO: Reading ./binary_container_1.xclbin
Loading: './binary_container_1.xclbin'
INFO: [SW-EM 09-0] Unable to find emconfig.json. Using default device.
Trying to program device[0]: xilinx_zcu102_base_202010_1
Device[0]: program successful!
Software emulation of compute unit(s) exited unexpectedly
0 Kudos
kmorris
Xilinx Employee
Xilinx Employee
833 Views
Registered: ‎01-11-2011

After looking at your project, the error can be expanded if you increase your stack size. You can do this in a terminal before starting Vitis:

ulimit -s unlimited

When doing this, the message I get running the emulation is:

HOST: zynqmp-common-2020_1
EXE: /media/sd-mmcblk0p1/sobel
[XRT] ERROR: Invalid scalar argument size, expected 4 got 8
ERROR: clSetKernelArg() for kernel "borderscan", argument index 1.
../src/sobelhost.cpp:126 Error calling err = krnl_sob1.setArg(1, buffer_output), error code is: -51
[XRT] WARNING: Profiling may contain incomplete information. Please ensure all OpenCL objects are released by your host code (e.g., clReleaseProgram()).
corrupted size vs. prev_size
-------------------------------------------------------------------------
Please don’t forget to reply, kudo, and accept as solution!
-------------------------------------------------------------------------
0 Kudos
stzog
Explorer
Explorer
789 Views
Registered: ‎02-07-2020

Now i get the following...

INFO: [SW-EM 09-0] Unable to find emconfig.json. Using default device.
Found Platform
Platform Name: Xilinx
INFO: Reading ./binary_container_1.xclbin
Loading: './binary_container_1.xclbin'
INFO: [SW-EM 09-0] Unable to find emconfig.json. Using default device.
Trying to program device[0]: xilinx_zcu102_base_202010_1
Device[0]: program successful!
XRT build version: 2.6.0
Build hash: 2d6bfe4ce91051d4e5b499d38fc493586dd4859a
Build date: 2020-05-26 18:53:06
Git branch: 2020.1
PID: 742
UID: 0
[Sat Oct 10 11:18:44 2020]
HOST: zynqmp-common-2020_1
EXE: /media/sd-mmcblk0p1/sobel
[XRT] ERROR: program is nullptr
[XRT] WARNING: Profiling may contain incomplete information. Please ensure all OpenCL objects are released by your host code (e.g., clReleaseProgram()).
Software emulation of compute unit(s) exited unexpectedly
0 Kudos
kmorris
Xilinx Employee
Xilinx Employee
700 Views
Registered: ‎01-11-2011

Is this happening after setting the stack size and correcting the error I mentioned previously?

-------------------------------------------------------------------------
Please don’t forget to reply, kudo, and accept as solution!
-------------------------------------------------------------------------
0 Kudos
stzog
Explorer
Explorer
660 Views
Registered: ‎02-07-2020

@kmorris 

I corrected my code , i followed your suggestion(ulimit -s unlimited before run vitis)

but most of the times a still get the following error when i run sw emulation

 

 

 

 

INFO: [SW-EM 09-0] Unable to find emconfig.json. Using default device.
Found Platform
Platform Name: Xilinx
INFO: Reading ./binary_container_1.xclbin
Loading: './binary_container_1.xclbin'
INFO: [SW-EM 09-0] Unable to find emconfig.json. Using default device.
Trying to program device[0]: xilinx_zcu102_base_202010_1
Device[0]: program successful!
Software emulation of compute unit(s) exited unexpectedly

 

 

Sometimes i get....

 

INFO: [SW-EM 09-0] Unable to find emconfig.json. Using default device.
Found Platform
Platform Name: Xilinx
INFO: Reading ./binary_container_1.xclbin
Loading: './binary_container_1.xclbin'
INFO: [SW-EM 09-0] Unable to find emconfig.json. Using default device.
Trying to program device[0]: xilinx_zcu102_base_202010_1
Device[0]: program successful!
TEST PASSED!

 

Does this mean that sw emulation run succesfully?

 

 

0 Kudos
stzog
Explorer
Explorer
594 Views
Registered: ‎02-07-2020

@kmorris 

Hi!

Do you have any suggestion?

Moreover is the 

INFO: [SW-EM 09-0] Unable to find emconfig.json. Using default device.

 crucial to run correctly the sw-emulation?

Regards

0 Kudos
stzog
Explorer
Explorer
537 Views
Registered: ‎02-07-2020

@kmorris 

Hi again!

I constantly get the 

Software emulation of compute unit(s) exited unexpectedly
error.Even if i run ulimit -s unlimited before run Vitis.Any other point to check out to solve this?
 
0 Kudos
kmorris
Xilinx Employee
Xilinx Employee
517 Views
Registered: ‎01-11-2011

Hi @stzog, the best way to debug these issues is to run the debugger (bug icon in the toolbar) and step through your kernel code via breakpoints. When doing this, I found a couple of issues.

The first was a missing kernel argument for your imgscan kernel, your host code only specifies 3 arguments, but misses the T variable (threshold from what I could gather). After adding the extra argument with a best-guess value, the next error I saw when stepping through the code is a segmentation fault when entering the below in the grayconvert kernel:

 

for (int x=0; x<width*height; x++){
gray_image[x] = 0.2989*image[3*x]+ 0.5870*image[3*x+1]+ 0.1140*image[3*x+2] ;

 

The width and height are not initialized to any value, which can cause the seg fault. When defining them to a value, the kernel seems to process, but I would also check that your values do not exceed the array bounds of the 'image' variable.

-------------------------------------------------------------------------
Please don’t forget to reply, kudo, and accept as solution!
-------------------------------------------------------------------------

View solution in original post