Forum Discussion

FPorr's avatar
FPorr
Icon for New Contributor rankNew Contributor
6 years ago

OpenCL software emulation crashes when the Kernel uses more than 6MByte of memory

Hello,

the OpenCL software emulation crashes with a segmentation fault when the kernel utilizes more than 6MByte of memory. Example:

uchar arr[128*128*384]; // 6MByte -- Works
uchar arr[128*128*385]; // more than 6MByte -- Segmentation Fault

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

Setup:

Ubuntu 16.04.2

Intel FPGA SDK for OpenCL 18.0.0-219

Tested Boards:

Arria 10 (ref BSP and BSP of custom hardware)

Stratix 10 (only BSP of custom hardware)

7 Replies

  • KhaiChein_Y_Intel's avatar
    KhaiChein_Y_Intel
    Icon for Regular Contributor rankRegular Contributor

    Hi,

    May I request the testcase for replication? What is the cmd you are executing?

    Thanks.

  • FPorr's avatar
    FPorr
    Icon for New Contributor rankNew Contributor

    Hi,

    thank you for the reply, I attached a simple test case to reproduce the error.

    The build commands I used were:

    # Host application
    make
    # Kernel
    aoc -march=emulator krnl.cl -o bin/krnl_emu.aocx

    and for execution:

    CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA=1 bin/host bin/krnl_emu.aocx

    Depending on which size define is enabled in krnl.cl, the application either crashes or executes.

  • KhaiChein_Y_Intel's avatar
    KhaiChein_Y_Intel
    Icon for Regular Contributor rankRegular Contributor
    Hi, Thanks for the attachment. Please allow me some time to look into this. Thanks. (1507183204)
  • KhaiChein_Y_Intel's avatar
    KhaiChein_Y_Intel
    Icon for Regular Contributor rankRegular Contributor
    Hi, A lot has changed in the emulator since 18.0, not only in the old emulator flow (now called legacy emulator), but there is now a new emulator that replaces it in 19.1 (the fast emulator). Can you try this in 19.1 with the new fast emulator? Thanks,
  • FPorr's avatar
    FPorr
    Icon for New Contributor rankNew Contributor

    Hi,

    I am sorry for the late response. I installed 19.1 but trying to compile any kernel using the fast emulator fails with:

    Error: OpenCL kernel compilation FAILED

    The ioc.log contains the following lines:

    Using build options: -cl-std=CL1.2 -Xclang -Wuninitialized -I "/home/user/vector_add/device"

    Failed to get platform id...: 0 (CL_SUCCESS)

    Compilation failed!

    Any thoughts on what might be the problem?

  • FPorr's avatar
    FPorr
    Icon for New Contributor rankNew Contributor

    Hi,

    I managed to solve the problem. It did not work because I forgot to install a device ... 😟

    Anyway, using the fast emulator indeed removed the problem, the application no longer crashes for data > 6MB.

    Thank you for your assistance.