cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ahonorat
Visitor
Visitor
699 Views
Registered: ‎02-03-2021

Vitis HLS OpenCL testbench simulation error (no Xilinx platform)

Hello,

I am quite new to FPGA and so I am trying to start with an example of the vitis Vision library in Vitis HLS:
https://github.com/Xilinx/Vitis_Libraries/tree/master/vision/L3/examples/gaussiandifference

This example is designed for Vitis but I was not able to install the Pynq-Z2 board that I am using in Vitis (and I wonder if it is even possible to generate a generic BSP/XSA for it); so I'm using Vitis HLS instead.
However, the testbench provided in the example is calling OpenCL Xilinx lib, and I get the following error during the C simulation:

"Error: Failed to find Xilinx platform"

originating from a call to

xcl::get_xil_devices();


Indeed, my Vitis HLS installation is on a computer which is NOT connected to any Xilinx devices (Pynq Z2 or other), but I do not understand why I would need it for simulation.
The C synthesis is working fine.

Details about my installation :
- Vivado / Vitis / Vitis HLS 2020.2
- OpenCL 2.1 (on Intel CPU)
- OpenCV 3.4.13 (I believe that newest version 4 is not yet fully tested with Vitis)

Q1. I am missing some installation on the development machine (not connected to the Xilinx devices) ? Maybe I should install XRT ?

Q2. Is it even possible to run this OpenCL testbench on the Pynq Z2 with the Vitis Kernel Flow Target  and Pynq framework ?

I see two workarounds:
1) remove OpenCL testbench, use Vivado IP Flow Target synthesis and connect the IP by hand in Vivado (not so pleasant)
2) use another platform, as zcu102 which is provided in Vitis, with extra configuration step (I do not know how to configure the platforme project to meet my needs, and I don't have access to a zcu102 yet)

Any help or advice to simulate the Gaussian difference Vitis vision example in Vitis or Vitis HLS and run it on Pynq Z2, or as last resort on zcu102, is welcome. Thank you!
Small precision: the gaussian difference example matches the needs of my current employer, so I would prefer to keep this one.

 

0 Kudos
4 Replies
wenchen
Moderator
Moderator
654 Views
Registered: ‎05-27-2018

Hi @ahonorat

There would be a lot of trouble if you want to run the Vitis Vision example on PYNQ-Z2. Please take a look at the Makefiles inside the L3 examples.  ZCU102 and ZCU104 are supported by the given make flow.

else ifneq (,$(shell echo $(XPLATFORM) | awk '/zcu102/'))
CXXFLAGS += -I$(SYSROOT)/usr/include
CXXFLAGS += --sysroot=$(SYSROOT)
LDFLAGS += -L$(SYSROOT)/usr/lib
LDFLAGS += -L${SYSROOT}/opt/xilinx/xrt/lib

If you want to use your PYNQ board, you must build the image and sysroot with the OpenCV library using the Petalinux.

So, the best way for you is to run the ZCU102 example using the makefile first.

Wen

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.


**~ Got a minute? Answer our Vitis HLS survey here! ~**


-------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------
ahonorat
Visitor
Visitor
615 Views
Registered: ‎02-03-2021

Thank you for your answer Wen! It answers Q2.

About Q1, in any case (zcu102 target or not), do you know how I can run the C simulation of the OpenCL testbench on my development machine with Vitis HLS? It should work even if it is not connected to the zcu102 target, isn't it?

0 Kudos
wenchen
Moderator
Moderator
592 Views
Registered: ‎05-27-2018

HI @ahonorat 

The installation of XRT is a must to run the examples. If you only run the sw_emu and hw_emu in Vitis flow, you don't have to connect to the zcu102 target physically.

I think you are not aware of some basic concept about Vitis and how Vitis invoke the Vitis_hls for kernel side and the OpenCL in host side.

https://www.xilinx.com/html_docs/xilinx2020_2/vitis_doc/index.html

Please refer to the user guide.

Wen

 

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.


**~ Got a minute? Answer our Vitis HLS survey here! ~**


-------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------
ahonorat
Visitor
Visitor
566 Views
Registered: ‎02-03-2021

Hello, thanks for your answer Wen.

I read a bit the docs, especially:
https://www.xilinx.com/html_docs/xilinx2020_2/vitis_doc/verifyingcodecsimulation.html

and
https://www.xilinx.com/html_docs/xilinx2020_2/vitis_doc/runemulation1.html

In the end I guess that I wrongly assumed that Vitis SW emulation was the same thing as Vitis HLS C simulation.
Moreover, maybe that the testbench file in the gaussiandifference example is closer to a host code (dedicated to run on the host of the board)  than to a Vitis HLS testbench (dedicated to run on the development machine having Vitis HLS, just to check C behavior).
In this case, it is clear that I should not reuse the given testbench in Vitis HLS.

Could you confirm my thoughts?
By the way, about your answer on XRT, is it useful to install it even on the development machine (not connected to any board)? I bet the answer is no, isn't it?

If you confirm my thoughs then I will close the topic afterwards and accept your first answer ; )
Thank you again.

0 Kudos