thesps / conifer

Fast inference of Boosted Decision Trees in FPGAs
Apache License 2.0
48 stars 27 forks source link

Not working on Windows ? #52

Closed SebastianHambura closed 1 year ago

SebastianHambura commented 1 year ago

Hey,

I just found your project, and it look awesome :D I wanted to try it out quickly, to see if it's indeed what I needed.

I'm currently working on windows, and it seems like conifer doesn't find vivado hls or vitis hls as I get following errors :

Could not find ap_ headers (e.g., ap_fixed.h). None of XILINX_AP_INCLUDE, XILINX_HLS, XILINX_VIVADO are defined

---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
Cell In[15], line 3
      1 # Create and compile the model
      2 model = conifer.converters.convert_from_xgboost(xgbt_model.get_booster(), cfg)
----> 3 model.compile()
      5 # Synthesize the model
      6 model.build()

File ~\anaconda3\envs\connifer-octave\Lib\site-packages\conifer\backends\xilinxhls\writer.py:454, in XilinxHLSModel.compile(self)
    452 if ap_include is None:
    453     os.chdir(curr_dir)
--> 454     raise Exception("Couldn't find Xilinx ap_ headers. Source the Vivado/Vitis HLS toolchain, or set XILINX_AP_INCLUDE environment variable.")
    455 cmd = f"g++ -O3 -shared -std=c++14 -fPIC $(python3 -m pybind11 --includes) {ap_include} bridge.cpp firmware/BDT.cpp firmware/{cfg.project_name}.cpp -o conifer_bridge_{self._stamp}.so"
    456 logger.debug(f'Compiling with command {cmd}')

Exception: Couldn't find Xilinx ap_ headers. Source the Vivado/Vitis HLS toolchain, or set XILINX_AP_INCLUDE environment variable.

After struggling a bit with it, I've looked into the code and found this :

https://github.com/thesps/conifer/blob/086c82ee1f70b5bd2706c6381244064fb30061c3/conifer/backends/xilinxhls/writer.py#L19-L28

This looks like a linux-only command. Can conifer only run on Linux ?

thesps commented 1 year ago

Thanks for reaching out! I haven't done any development for Windows, and I think it's true that there will be some steps that are Linux-centric. That said, I think you might still be able to make some progress if you're already familiar with using Vivado HLS. I think you should be able to convert and write a model, creating all the .cpp and .tcl files for the HLS project. From there you can create a Vivado HLS project using the HLS software directly, rather than using the compile and build methods of the conifer model. Do you think that can work for you?

I'm also open to adding support for Windows to conifer, we recently made some modifications to support emulation on OSX for example.

SebastianHambura commented 1 year ago

It's not a big deal for me, I also have a Linux which I can use. I just wanted to be sure.