fastmachinelearning / hls4ml

Machine learning on FPGAs using HLS
https://fastmachinelearning.org/hls4ml
Apache License 2.0
1.21k stars 396 forks source link

Co-simulation is failing #679

Open holoLens8 opened 1 year ago

holoLens8 commented 1 year ago

Hi, I have been trying to run the tutorial (the 3 layers example) using various versions of Vivado_HLS.

I used Vivado-HLS 18.2, 18.3 and 19.2 to run the tutorial model. At first, I couldn't pass the C synthesis step, because the preset FPGA target couldn't fit the whole model, resource usage is enormous. I changed the FPGA to a very large one so I could pass the C synthesis, and it worked. However, the co-simulation is always failing no matter what Vivado HLS version I use. Here are the errors that I am getting:

/product/cad/xilinx/2019.2/Vivado/2019.2/include/mpfr.h:704:26: error: 'mpfr_srcptr' has not been declared __MPFR_DECLSPEC int mpfr_fms _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, ^~~~~~~~~~~ /product/cad/xilinx/2019.2/Vivado/2019.2/include/mpfr.h:704:39: error: 'mpfr_srcptr' has not been declared __MPFR_DECLSPEC int mpfr_fms _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, ^~~~~~~~~~~ /product/cad/xilinx/2019.2/Vivado/2019.2/include/mpfr.h:704:52: error: 'mpfr_srcptr' has not been declared __MPFR_DECLSPEC int mpfr_fms _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, ^~~~~~~~~~~ /product/cad/xilinx/2019.2/Vivado/2019.2/include/mpfr.h:714:30: error: '__gmp_const' has not been declared __MPFR_DECLSPEC int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, ^~~~~~~~~~~ /product/cad/xilinx/2019.2/Vivado/2019.2/include/mpfr.h:714:47: error: two or more data types in declaration of 'parameter' __MPFR_DECLSPEC int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, ^ /product/cad/xilinx/2019.2/Vivado/2019.2/include/mpfr.h:714:48: error: expected ')' before ',' token __MPFR_DECLSPEC int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, ^ /product/cad/xilinx/2019.2/Vivado/2019.2/include/mpfr.h:714:50: error: expected unqualified-id before 'char' __MPFR_DECLSPEC int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, ^~~~ /product/cad/xilinx/2019.2/Vivado/2019.2/include/mpfr.h:719:38: error: 'mpfr_srcptr' was not declared in this scope __MPFR_DECLSPEC void * mpfr_custom_get_significand _MPFR_PROTO ((mpfr_srcptr)); ^~~~~~~~~~~ /product/cad/xilinx/2019.2/Vivado/2019.2/include/mpfr.h:720:34: error: 'mpfr_srcptr' was not declared in this scope __MPFR_DECLSPEC mpfr_exp_t mpfr_custom_get_exp _MPFR_PROTO ((mpfr_srcptr)); ^~~~~~~~~~~ /product/cad/xilinx/2019.2/Vivado/2019.2/include/mpfr.h:724:28: error: 'mpfr_srcptr' was not declared in this scope __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr)); ^~~~~~~~~~~ make: *** [obj/myproject_test.cpp_pre.cpp.tb.o] Error 1 ERROR: [COSIM 212-317] C++ compile error. ERROR: [COSIM 212-321] EXE file generate failed. ERROR: [COSIM 212-321] EXE file generate failed. ERROR: [COSIM 212-331] Aborting co-simulation: C simulation failed, compilation errors. ERROR: [COSIM 212-5] *** C/RTL co-simulation file generation failed. *** ERROR: [COSIM 212-4] *** C/RTL co-simulation finished: FAIL *** command 'ap_source' returned error code while executing "source /local2/is148265/na255940/hls4mlTest/my-hls-test/myproject_prj/solution1/cosim.tcl" invoked from within "hls::main /local2/is148265/na255940/hls4mlTest/my-hls-test/myproject_prj/solution1/cosim.tcl" ("uplevel" body line 1) invoked from within "uplevel 1 hls::main {*}$args" (procedure "hls_proc" line 5) invoked from within "hls_proc $argv" Finished C/RTL cosimulation. I have tried to change the #include <gmp.h> to #include "gmp.h" in the mpfr.h. However, I have no permissions to make the changes.

Thanks

jmduarte commented 1 year ago

Hi @holoLens8, I suspect this is an issue with your Vivado installation and is a duplicate of #473

In particular, you may need to install additional libraries before installing Vivado (as it will not do it automatically for you): https://www.xilinx.com/content/dam/xilinx/support/documents/sw_manuals/xilinx2019_2/ug973-vivado-release-notes-install-license.pdf#namedDest=InstallingTheVivadoDesignSuiteTools