IntelLabs / t2sp

Productive and portable performance programming across spatial architectures (FPGAs, etc.) and vector architectures (GPUs, etc.)
Other
29 stars 12 forks source link

Cannot run T2SP emulation on local machine #5

Closed hecmay closed 2 years ago

hecmay commented 3 years ago

I am trying to run AOT regression cases on a local machine after installing t2sp. And I got the following errors

g++ gemm-generate.cpp -g -I ../util -I ../../../../Halide/include -L ../../../../Halide/bin -lHalide -lz -lpthread -ldl -std=c++11
env BITSTREAM=b.aocx AOC_OPTION="-march=emulator -board=a10gx -emulator-channel-depth-model=strict " ./a.out

g++ gemm-run.cpp host.cpp ../../../src/AOT-OpenCL-Runtime.cpp ../../../src/SharedUtilsInC.cpp -g -DLINUX -DALTERA_CL -fPIC -I../../../src/ -I ../../../../Halide/include -I/work/shared/common/CAD_tool/Intel/intelFPGA_pro//19.4/hld/examples_aoc/common/inc /work/shared/common/CAD_tool/Intel/intelFPGA_pro//19.4/hld/examples_aoc/common/src/AOCLUtils/opencl.cpp /work/shared/common/CAD_tool/Intel/intelFPGA_pro//19.4/hld/examples_aoc/common/src/AOCLUtils/options.cpp -I/work/shared/common/CAD_tool/Intel/intelFPGA_pro//19.4/hld/host/include -L/work/shared/common/CAD_tool/Intel/intelFPGA_pro//19.4/hld/linux64/lib -L/linux64/lib -L/work/shared/common/CAD_tool/Intel/intelFPGA_pro//19.4/hld/host/linux64/lib -lOpenCL -L ../../../../Halide/bin -lelf -lHalide -lz -lpthread -ldl -std=c++11

env CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA=1 INTEL_FPGA_OCL_PLATFORM_NAME="Intel(R) FPGA Emulation Platform for OpenCL(TM)" BITSTREAM=b.aocx ./a.out

ERROR: UNRECOGNIZED ERROR CODE (-1001)
Location: /work/shared/common/CAD_tool/Intel/intelFPGA_pro//19.4/hld/examples_aoc/common/src/AOCLUtils/opencl.cpp:297
Query for number of platforms failed

Similarly, if I run realize() directly on FPGA target (using emulation mode), I would get the following errors from JITModule

CL: halide_opencl_init_kernels (user_context: 0x0, state_ptr: 0x7ff98ff7b000, program: 0x7ff98ff76280, size: 10331
    load_libopencl (user_context: 0x0)
    Loaded OpenCL runtime library: libOpenCL.so
halide_acquire_cl_context 
    create_opencl_context (user_context: 0x0)
Error: CL: clGetPlatformIDs failed: <Unknown error> -1001
Aborted (core dumped)

@ronghongbo @haoxiaochen

ronghongbo commented 3 years ago

Not sure what happens. But I see you are accessing /work/shared/common/CAD_tool/Intel/intelFPGA_pro//19.4/hld/examples_aoc. Under that directory should be a hello world like vector add. Try to emulate and run that hello world and see if it works. If it works, something might be wrong with t2s code gen. Otherwise, it might be some other issue.

hecmay commented 3 years ago

I think it is my local machine's problem. I am not even able to compile the OpenCL code into AOCX (emulation) uing AOC.

Using build options: -cl-std=CL1.2 -g -s "/work/shared/users/phd/sx233/examples_aoc/vector_add/device/vector_add.cl" -Xclang -O3 -Xclang -Wuninitialized -Xclang -DINTELFPGA_CL=194 -Xclang -ivfsoverlay-lib/work/shared/common/CAD_tool/Intel/intelFPGA_pro/19.4/hld/linux64/lib/libaoc_clang_decrypt.so -I "/work/shared/users/phd/sx233/examples_aoc/vector_add/device" -I "/work/shared/common/CAD_tool/Intel/intelFPGA_pro/19.4/hld/llvm/include/cclang"
Setting target instruction set architecture to: Default (Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX2))
Unable to load OpenCL platforms
ronghongbo commented 3 years ago

See if this threads helps: https://community.intel.com/t5/Intel-High-Level-Design/aoc-error-for-emulation/td-p/1156840

I have not tried aoc 19.4 locally due to some installation issue, but I tried aoc 19.1 before and it works fine.