Closed pentapatisivani closed 4 years ago
Hi, what specific example project are you running? Did you try following the workflow in our documentation? Or did you just copy the files over to your project?
Also, I think the example projects in master branch are quite outdated, can you try again with the examples in this repo?
Duc.
Are you integrating the NN into a larger project or just compiling the NN with hls4ml?
From your error, it looks like you don't have the C++0x flag. You can see how it's used in the hls4ml build_prj.tcl file, for example:
add_files firmware/myproject.cpp -cflags "-std=c++0x"
If you're integrating the code into another project, you should add the -cflags "-std=c++0x"
flag to your build script. Otherwise, simply use hls4ml build -p your_project -s
which will use the build script we generate.
Hi, what specific example project are you running? Did you try following the workflow in our documentation? Or did you just copy the files over to your project?
Also, I think the example projects in master branch are quite outdated, can you try again with the examples in this repo?
Duc.
Thank you for mentioning about the updated repo. I ran the new tcl script directly in hls terminal to create the project I have got errors related to pre-existing files in vivado hls . How can I resolve this issue? (Attaching screenshot of result)
C SIMULATION COMPLETED IN 0h0m41s C/RTL SYNTHESIS INFO: [SCHED 204-61] Option 'relax_ii_for_timing' is enabled, will increase II to preserve clock frequency constraints. INFO: [HLS 200-10] Analyzing design file 'firmware/myproject.cpp' ... ERROR: [HLS 200-70] Compilation errors found: In file included from firmware/myproject.cpp:1: In file included from firmware/myproject.cpp:19: In file included from F:/apps/Vivado/2018.3/win64/tools/clang/bin..\lib\clang\3.1/../../../include/c++/4.5.2\iostream:39: In file included from F:/apps/Vivado/2018.3/win64/tools/clang/bin..\lib\clang\3.1/../../../include/c++/4.5.2\ostream:39: In file included from F:/apps/Vivado/2018.3/win64/tools/clang/bin..\lib\clang\3.1/../../../include/c++/4.5.2\ios:39: In file included from F:/apps/Vivado/2018.3/win64/tools/clang/bin..\lib\clang\3.1/../../../include/c++/4.5.2\exception:151: F:/apps/Vivado/2018.3/win64/tools/clang/bin..\lib\clang\3.1/../../../include/c++/4.5.2\exception_ptr.h:132:13: error: unknown type name 'type_info' const type_info ^ In file included from firmware/myproject.cpp:1: In file included from firmware/myproject.cpp:19: In file included from F:/apps/Vivado/2018.3/win64/tools/clang/bin..\lib\clang\3.1/../../../include/c++/4.5.2\iostream:39: In file included from F:/apps/Vivado/2018.3/win64/tools/clang/bin..\lib\clang\3.1/../../../include/c++/4.5.2\ostream:39: In file included from F:/apps/Vivado/2018.3/win64/tools/clang/bin..\lib\clang\3.1/../../../include/c++/4.5.2\ios:39: In file included from F:/apps/Vivado/2018.3/win64/tools/clang/bin..\lib\clang\3.1/../../../include/c++/4.5.2\exception:151: F:/apps/Vivado/2018.3/win64/tools/clang/bin..\lib\clang\3.1/../../../include/c++/4.5.2\nested_exception.h:62:5: error: the parameter for this explicitly-defaulted copy constructor is const, but a member or base requires it to be non-const nested_exception(const nested_exception&) = default; ^ F:/apps/Vivado/2018.3/win64/tools/clang/bin..\lib\clang\3.1/../../../include/c++/4.5.2\nested_exception.h:64:23: error: the parameter for this explicitly-defaulted copy assignment operator is const, but a member or base requires it to be non-const nested_exception& operator=(const nested_exception&) = default; ^ F:/apps/Vivado/2018.3/win64/tools/clang/bin..\lib\clang\3.1/../../../include/c++/4.5.2\nested_exception.h:77:28: error: exception specification in declaration does not match previous declaration inline nested_exception::~nested_exception() = default; ^ F:/apps/Vivado/2018.3/win64/tools/clang/bin..\lib\clang\3.1/../../../include/c++/4.5.2\nested_exception.h:66:20: note: previous declaration is here inline virtual ~nested_exception(); ^ F:/apps/Vivado/2018.3/win64/tools/clang/bin..\lib\clang\3.1/../../../include/c++/4.5.2\nested_exception.h:122:61: error: redefinition of default argument __throw_with_nested(_Ex&& __ex, const nested_exception = 0) ^ ~ F:/apps/Vivado/2018.3/win64/tools/clang/bin..\lib\clang\3.1/../../../include/c++/4.5.2\nested_exception.h:110:56: note: previous definition is here throw_with_nested(_Ex&&, const nested_exception* = 0) ^ ~ In file included from firmware/myproject.cpp:1: In file included from firmware/myproject.cpp:21: In file included from firmware/myproject.h:24: In file included from F:/apps/Vivado/2018.3/common/technology/autopilot\ap_int.h:349: In file included from F:/apps/Vivado/2018.3/common/technology/autopilot\ap_fixed.h:55: F:/apps/Vivado/2018.3/common/technology/autopilot\ap_fixed_base.h:837:13: warning: shift count is negative [-Wshift-count-negative] ret.V <<= (_AP_I - _AP_W); ^ ~~~ F:/apps/Vivado/2018.3/common/technology/autopilot\ap_fixed_base.h:868:69: note: in instantiation of member function 'ap_fixed_base<49, 39, true, 5, 3, 0>::to_ap_int_base' requested here inline attribute((always_inline)) int to_int() const { return to_ap_int_base().to_int(); } ^ F:/apps/Vivado/2018.3/common/technology/autopilot\ap_fixed_base.h:1041:71: note: in instantiation of member function 'ap_fixed_base<49, 39, true, 5, 3, 0>::to_int' requested here inline attribute__((always_inline)) operator int() const { return to_int(); } ^ firmware/nnet_utils/nnet_activation.h:168:22: note: in instantiation of member function 'ap_fixed_base<49, 39, true, 5, 3, 0>::operator int' requested here data_round = data[ii]*CONFIG_T::table_size/16; ^ firmware/myproject.cpp:75:5: note: in instantiation of function template specialization 'nnet::sigmoid<ap_fixed<16, 6, 5, 3, 0>, ap_fixed<16, 6, 5, 3, 0>, sigmoid_config5>' requested here nnet::sigmoid<layer4_t, result_t, sigmoid_config5>(layer4_out, layer5_out); ^ 1 warning and 5 errors generated. Failed during preprocessing. while executing "source [lindex $::argv 1] " ("uplevel" body line 1) invoked from within "uplevel #0 { source [lindex $::argv 1] } " INFO: [Common 17-206] Exiting vivado_hls at Wed Mar 4 21:49:44 2020...
There is a workaround here, however the side-effects of doing this are unknown since most of us don't use Windows for development.
If you have a contact within Xilinx, I would suggest also complaining about this to them. They ship a standard library that was part of a compiler from 2010, which is no longer funny, now it's just sad.
Thanks a lot! That fixed the issue and is there any reference or documentation for hls4ml to know what exactly each function is doing? For example there are two functions for conv2d conv2d_latency_cl and conv2d_latency_cf (In this repo: https://github.com/hls-fpga-machine-learning/models ). What exactly is the difference between these 2? and nnet_utils itself has many files and functions and its being difficult to understand what function does what just from the codes and there are multiple functions with similar code. Can you provide any resource with proper documentation of code. And the example models only include 4-5 functions
For the specific case conv2d_latency_cl
vs conv2d_latency_cf
the cl
means 'Channels Last' while cf
means 'Channels First'. The function which is used will be determined by the configuration of the trained model you provide.
Usually the function which gets used is controlled either by your model, as above, or your configuration file. For example we have Strategy: Latency
, Strategy: Resource
, Compression: {True/False}
. These, together with the Reuse
factor will define which function gets used to give the best balance of FPGA resources, latency and synthesizability. If you want to explore the design space it's better to try out these options in the config than to modify which function is called in the produced C++.
The best documentation for the config file parameters is https://fastmachinelearning.org/hls4ml/setup/CONFIGURATION.html
It seems like your issue is resolved, so I will close this issue.
I tried running the example project by adding all files in nnet_utils in my project but still I am getting this error of datatype mismatch while running synthesis even build.tcl isnt working. How exactly can we include hls4ml in vivado hls? ERROR: [HLS 200-70] Compilation errors found: In file included from Gnet/files/myproject.cpp:1: In file included from Gnet/files/myproject.cpp:21: In file included from Gnet/files/parameters.h:7: In file included from Gnet/files/nnet_dense.h:24: Gnet/files/nnet_helpers.h:177:1: error: unknown type name 'constexpr' constexpr int ceillog2(int x){ ^ Gnet/files/nnet_helpers.h:177:11: error: expected unqualified-id constexpr int ceillog2(int x){ ^ Gnet/files/nnet_helpers.h:181:1: error: unknown type name 'constexpr' constexpr int pow2(int x){ ^ Gnet/files/nnet_helpers.h:181:11: error: expected unqualified-id constexpr int pow2(int x){ ^ In file included from Gnet/files/myproject.cpp:1: In file included from Gnet/files/myproject.cpp:21: In file included from Gnet/files/parameters.h:7: Gnet/files/nnet_dense.h:56:22: error: no template named 'enable_if' in namespace 'std'; did you mean '_ap_type::enable_if'? inline typename std::enable_if<std::is_same<data_T, ap_uint<1>>::value