Skip to content

Commit 10fbba0

Browse files
committed
fix[hardware_predict]: Fixed rebuild when hardware predict, changed default to shared_lib
1 parent ba05a29 commit 10fbba0

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

hls4ml/backends/vitis_accelerator/vitis_accelerator_backend.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,21 @@ def dat_to_numpy(self, model):
114114
y = np.loadtxt(output_file, dtype=float).reshape(-1, expected_shape)
115115
return y
116116

117-
def hardware_predict(self, model, x, target="hw", debug=False, profilingRepeat=-1, method="file"):
117+
def hardware_predict(self, model, x, target="hw", debug=False, profilingRepeat=-1, method="lib"):
118118
if method == "file":
119119
"""Run the hardware prediction using file-based communication."""
120+
120121
command = ""
121122

122123
if debug:
123124
command += "DEBUG=1 "
125+
xclbin_path = model.config.get_output_dir() + "/build_hw_deb/kernel_wrapper.xclbin"
126+
else:
127+
xclbin_path = model.config.get_output_dir() + "/build_hw_rel/kernel_wrapper.xclbin"
128+
129+
if not os.path.exists(xclbin_path):
130+
raise Exception(f"XCLBIN file {xclbin_path} does not exist. Please run build first.")
131+
124132
if isinstance(profilingRepeat, int) and profilingRepeat > 0:
125133
command += "PROFILING_DATA_REPEAT_COUNT=" + profilingRepeat + " "
126134
self._validate_target(target)

hls4ml/backends/vitis_accelerator/vitis_accelerator_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, config):
3232
else:
3333
print(
3434
"WARNING: You set an unrecognized Platform."
35-
"Using " + platforms[0] + " platform instead"
35+
"Using " + platforms[0] + " platform instead."
3636
)
3737
self.platform = platforms[0]
3838
else:

hls4ml/templates/vitis_accelerator/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ host_shared: $(KERNEL_NAME)_host_cl.cpp libs/xcl2.cpp $(wildcard libs/*.hpp)
124124

125125
# Execute program #############################################################
126126

127-
run: ./host $(BUILD_DIR)/$(WRAPPER_NAME).xclbin
127+
run: ./host #$(BUILD_DIR)/$(WRAPPER_NAME).xclbin
128128
ifeq ($(TARGET), hw)
129129
@echo "TARGET is hw, not setting XCL_EMULATION_MODE"
130130
$(eval EMULATION_MODE :=)

0 commit comments

Comments
 (0)