Prerequisites
Please make sure to check off these prerequisites before submitting a bug report.
Quick summary
The Vitis backend in hls4ml (starting with v1.2.0, PR #1327 ) defaults to using the vitis-run command, which was only introduced in Vitis 2023.1. This breaks compatibility with Vitis 2022.2, despite the documentation stating that 2022.2 is the minimum supported version for this backend.
Details
Please add to the following sections to describe the bug as accurately as possible.
Steps to Reproduce
- Clone the hls4ml repository or directly install latest release with pip
- Install Xilinx Vitis 2022.2 and source 'settings64.sh' (so vitis binaries are on PATH)
- Run a build command targeting Vitis backend. This code may serve as an example:
# 0. Load packages
import torch
import torch.nn as nn
import hls4ml
# 1. Minimal PyTorch model
class SimpleModel(nn.Module):
def __init__(self):
super(SimpleModel, self).__init__()
self.fc1 = nn.Linear(10, 5)
self.relu = nn.ReLU()
def forward(self, x):
return self.relu(self.fc1(x))
model = SimpleModel()
model.eval()
# 2. Define the hls4ml configuration
config = hls4ml.utils.config_from_pytorch_model(model, (1, 10))
output_dir = 'hls4ml_vitis_2022_2_bug'
# 3. Convert the model
hls_model = hls4ml.converters.convert_from_pytorch_model(
model,
input_shape=(1, 10),
hls_config=config,
output_dir=output_dir,
backend='Vitis',
part='xcvu9p-flga2104-2L-e'
)
# 4. Trigger the build
# This step fails because hls4ml attempts to execute 'vitis-run',
# which does not exist in Vitis 2022.2.
hls_model.build()
Expected behavior
The build() command should detect the Vitis version or allow a fallback to vitis_hls (the command used in 2022.2 and older Vitis HLS versions). If 2022.2 is officially supported, the backend should use the vitis_hls Tcl-based flow.
Actual behavior
The build command fails with a 'Exception: Vitis installation not found. Make sure "vitis-run" is on PATH.' error.
Optional
Possible fix
This issue was introduced at PR #1327, which migrated the Vitis backend to the Unified Flow CLI (vitis-run).
A possible fix would be to add a version check in hls4ml/backends/vitis/vitis_backend.py (Vitis version<= 2022.2) or to add a fallback if "vitis-run" is not found on PATH, leading to the execution of the older "vitis_hls" command and its associated Tcl parameters.
Additional context
Add any other context about the problem here.
Prerequisites
Please make sure to check off these prerequisites before submitting a bug report.
Quick summary
The Vitis backend in hls4ml (starting with v1.2.0, PR #1327 ) defaults to using the vitis-run command, which was only introduced in Vitis 2023.1. This breaks compatibility with Vitis 2022.2, despite the documentation stating that 2022.2 is the minimum supported version for this backend.
Details
Please add to the following sections to describe the bug as accurately as possible.
Steps to Reproduce
Expected behavior
The build() command should detect the Vitis version or allow a fallback to vitis_hls (the command used in 2022.2 and older Vitis HLS versions). If 2022.2 is officially supported, the backend should use the vitis_hls Tcl-based flow.
Actual behavior
The build command fails with a 'Exception: Vitis installation not found. Make sure "vitis-run" is on PATH.' error.
Optional
Possible fix
This issue was introduced at PR #1327, which migrated the Vitis backend to the Unified Flow CLI (vitis-run).
A possible fix would be to add a version check in hls4ml/backends/vitis/vitis_backend.py (Vitis version<= 2022.2) or to add a fallback if "vitis-run" is not found on PATH, leading to the execution of the older "vitis_hls" command and its associated Tcl parameters.
Additional context
Add any other context about the problem here.