Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while building accelerator for KR260 - device tree overlay blob generation #62

Closed
vmayoral opened this issue Jul 2, 2022 · 4 comments

Comments

@vmayoral
Copy link
Contributor

vmayoral commented Jul 2, 2022

I caught a weird error while re-running things in a clean workspace with the KR260:

Description

The KR260 KRS v1.0.0 firmware is built minimalistic and ships as little as possible. While building accelerators, the CMake logic attempts to produce all necessary artifacts (besides the accelerator itself) including the .dtbo file and the shell.json files necessary to run things on top of libdfx. This can be tracked down to https://github.com/ros-acceleration/ament_vitis/blob/main/cmake/vitis_acceleration_kernel.cmake#L357-L372. As things are, the accelerator will be successfully built but the CMake logic will fail because it won't find necessary files to complete the process.

Reproduction of the issue

To reproduce this issue, in a clean ROS 2 workspace with KR260 as explained at https://xilinx.github.io/KRS/sphinx/build/html/docs/install.html#cross-compilation-development:

colcon build --build-base=build-kr260-ubuntu --install-base=install-kr260-ubuntu --merge-install --mixin kr260 --cmake-args -DNOKERNELS=false --packages-select simple_vadd  # or any other accelerator

Workaround ⚠️

As a workaround, one can fetch into the ROS 2 overlay workspace the resources from KRS KV260 v1.0.0 (from here), build the workspace (deploying the firmware), and then (re)build things:

# fetch KV260 firmware
cd <root-of-your-ROS-ws, e.g. ~/krs_ws>
wget https://www.xilinx.com/bin/public/openDownload?filename=acceleration_firmware_kv260.zip -P src/firmware/acceleration_firmware_kv260
unzip src/firmware/acceleration_firmware_kv260/openDownload\?filename\=acceleration_firmware_kv260.zip -d src/firmware/acceleration_firmware_kv260/

# deploy KV260 firmware
colcon build --merge-install --packages-select acceleration_firmware_kv260

# select KV260 firmware artifacts and re-build accelerators targeting KR260 build configuration
source install/setup.bash
colcon acceleration select kv260
colcon build --build-base=build-kr260-ubuntu --install-base=install-kr260-ubuntu --merge-install --mixin kr260 --cmake-args -DNOKERNELS=false --packages-select simple_vadd  # or any other accelerator

This will instruct ament and colcon to look into KV260 firmware resources while building accelerators.

vmayoral added a commit to ros-acceleration/acceleration_firmware_kr260 that referenced this issue Jul 2, 2022
see Xilinx/KRS#62

Signed-off-by: Víctor Mayoral Vilches <[email protected]>
@vmayoral
Copy link
Contributor Author

vmayoral commented Jul 2, 2022

Updated comment above with a workaround that should unblock those testing things out. For a complete fix, refer to ros-acceleration/acceleration_firmware_kr260@af069d8. This needs to be further validated and fully tested but once ready, it should be released, and that should do.

@vmayoral
Copy link
Contributor Author

vmayoral commented Jul 2, 2022

Updated again with a more detailed walkthrough on how to apply the workaround.

@mohammedrafi-sk
Copy link
Contributor

mohammedrafi-sk commented Jul 12, 2022

Hi @vmayoral

Thanks for the workaround. I will clean up my workspace and follow it.

Meanwhile, I tested the complete fix and I am seeing the below error while the building accelerator for KR260

[Processing: offloaded_doublevadd_publisher]                                     
[Processing: offloaded_doublevadd_publisher]                                       
--- stderr: offloaded_doublevadd_publisher                                            
cp: cannot stat '/home/mr/krs_ws/install-kr260-ubuntu/../acceleration/firmware/select/data/../device_tree/kernel_default.dtbo': No such file or directory
cp: cannot stat '/home/mr/krs_ws/install-kr260-ubuntu/../acceleration/firmware/select/data/../shell.json': No such file or directory
ln: failed to create symbolic link '/home/mr/krs_ws/install-kr260-ubuntu/../acceleration/firmware/select/data/../BOOT.BIN': No such file or directory
In file included from /home/mr/krs_ws/install-kr260-ubuntu/include/vitis_common/common/ros_opencl_120.hpp:41,
                 from /home/mr/krs_ws/src/acceleration/acceleration_examples/nodes/offloaded_doublevadd_publisher/src/offloaded_doublevadd_publisher.cpp:24:
/home/mr/krs_ws/acceleration/firmware/kr260/sysroots/aarch64-xilinx-linux/usr/include/CL/cl2.hpp:18:151: note: ‘#pragma message: cl2.hpp has been renamed to opencl.hpp to make it clear that it supports all versions of OpenCL. Please include opencl.hpp directly.’
   18 | #pragma message("cl2.hpp has been renamed to opencl.hpp to make it clear that it supports all versions of OpenCL. Please include opencl.hpp directly.")
      |                                                                                                                                                       ^
CMake Error at cmake_install.cmake:46 (file):
  file INSTALL cannot find
  "/home/mr/krs_ws/build-kr260-ubuntu/offloaded_doublevadd_publisher/vadd_offloaded.dtbo":
  No such file or directory.


---
Failed   <<< offloaded_doublevadd_publisher [53min 15s, exited with code 1]

colcon seems to be looking into data folder which doesn't exist in the acceleration firmware. I created a empty data directory in the specified location and then the build worked fine.

I also observed that the platform is missing in kr260 firmware. I used the platform from kv260 firmware for this build.

@vmayoral
Copy link
Contributor Author

@mohammedrafi-sk I don't seem to be able to reproduce the error you described after another attempt, moreover the original intent of this ticket was to reflect the workaround needed with KR260 and Ubuntu 22.04 accelerators.

Objective was fulfilled and confirmed (triple-checked) at #67. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants