UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor fporrmann
Visitor
254 Views
Registered: ‎03-20-2019

Software emulation crashes when then kernel uses more than 8MByte of memory

Hello,

when the software emulation is executed with a kernel that uses more than 8MByte of memory, it receives a
SIGUSR1 signal (probably from the genericpciemodel, i.e., the CPU emulator) and exits with the following message:
Software emulation of compute unit(s) exited unexpectedly.

Simple example:

#define M_SIZE (128*128*511) // <8MByte -- Works
//#define M_SIZE (128*128*512) // 8MByte -- SIGUSR1

kernel __attribute__((reqd_work_group_size(1, 1, 1)))
void krnl_mirror(__global const uchar* restrict a,
		         __global uchar* restrict c)
{
    uchar arr[M_SIZE];
    for(uint i = 0; i < M_SIZE; i++)
    	arr[i] = a[i];

    for(uint i = 0; i < M_SIZE; i++)
    	c[i] = arr[i] + arr[i];
}

If this behavior is intended, please add a warning message, to prevent people from searching for a non-existing bug in their code.

Setup:
Ubuntu 16.04.2
SDAccel 2018.03

Board:
Xilinx Virtex UltraScale+ VCU1525

 

0 Kudos
4 Replies
Xilinx Employee
Xilinx Employee
218 Views
Registered: ‎03-24-2010

回复: Software emulation crashes when then kernel uses more than 8MByte of memory

From reading the code, it should be ok.

Could you also post the test bench and command-line options that allow us to reproduce?

Regards,
brucey
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
Visitor fporrmann
Visitor
206 Views
Registered: ‎03-20-2019

回复: Software emulation crashes when then kernel uses more than 8MByte of memory

Hello bruecy,

thank you for the reply, I attached the host code as well as the kernel code. Both were built from a default SDAccel project (derived from the vadd example) and executed either from within SDAccel or from a terminal using the following command:

XCL_EMULATION_MODE=sw_emu ./host.exe binary_container_1.xclbin

Regards,
fporrmann

PS: I had to upload the code as a .zip because for some reason the forum did not accept the host code.

 

 

 

0 Kudos
Xilinx Employee
Xilinx Employee
191 Views
Registered: ‎03-24-2010

回复: Software emulation crashes when then kernel uses more than 8MByte of memory

Thanks for the code. We'll investigate the issue.

For such type of code, you may consider reduce local memory usage, thus to save RAM resources in the device.

Regards,
brucey
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
Visitor fporrmann
Visitor
152 Views
Registered: ‎03-20-2019

回复: Software emulation crashes when then kernel uses more than 8MByte of memory

Just a quick follow up, I performed a few more tests and managed to identify the exact byte size at which the kernel stops working (see code below).
Additionally, once a certain size is exceeded, I encountered a strange behavior, where the kernel stops working but does not crash, the application just hangs.
Furthermore, the size at which the hanging/crashing occurs depends on the overall code size, when more code, e.g., an additional loop, is added, the problems occur earlier.

#define M_SIZE (8382824) // Works -- 2 loops
//#define M_SIZE (8382825) // Hangs start -- 2 loops
//#define M_SIZE (8387816) // Hangs end   -- 2 loops
//#define M_SIZE (8387817) // Crashs -- 2 loops

//#define M_SIZE (8382816) // Works -- 3 loops
//#define M_SIZE (8382817) // Hangs start -- 3 loops
//#define M_SIZE (8387808) // Hangs end   -- 3 loops
//#define M_SIZE (8387809) // Crashs -- 3 loops

kernel __attribute__((reqd_work_group_size(1, 1, 1)))
void krnl_mirror(__global const uchar* restrict a,
                 __global uchar* restrict c)
{
    uchar arr[M_SIZE];
    for(uint i = 0; i < M_SIZE; i++)
        arr[i] = a[i];

    for(uint i = 0; i < M_SIZE; i++)
        c[i] = arr[i] + arr[i];

//    for(uint i = 0; i < M_SIZE; i++)
//        c[i] = c[i] + arr[M_SIZE-i];
}

 

When the third loop is enabled, the hanging and crashing occur 8 bytes earlier respectively.

It should be noted, that this problem only occurs in the software emulation, the hardware emulation executes without problems.

 

0 Kudos