-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·131 lines (101 loc) · 5.23 KB
/
Makefile
File metadata and controls
executable file
·131 lines (101 loc) · 5.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#
# Copyright 2023-2026 Gerrit Pape (gerrit.pape@uni-paderborn.de)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# AuroraFlow test/benchmark application.
# Consumes the AuroraFlow library via aurora_flow.mk.
#
# All build artifacts (host binary, HLS .xo files, xclbin, emconfig.json,
# v++ temp dirs) land under $(BUILD_DIR) (default: ./build). The library
# kernels are also told to build into the same directory, so a single
# `rm -rf build/` cleans everything that this Makefile produces.
#
AURORA_FLOW_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..)
# All outputs go here. Override with `make BUILD_DIR=...` if needed.
BUILD_DIR ?= $(CURDIR)/build
# Tell the library to build into the same place (must be set before include).
AURORA_FLOW_BUILD_DIR := $(BUILD_DIR)
include $(AURORA_FLOW_DIR)/aurora_flow.mk
.PHONY: all host xclbin clean test
# Export AURORA_FLOW_DIR so run_*_emu.sh scripts can find library scripts
export AURORA_FLOW_DIR
PLATFORM ?= xilinx_u280_gen3x16_xdma_1_202211_1
TARGET ?= hw
FIFO_WIDTH ?= 64
MPICXX := mpic++
CXXFLAGS += -std=c++17 -Wall -g
CXXFLAGS += -I$(XILINX_XRT)/include
CXXFLAGS += $(AURORA_FLOW_INCLUDE)
CXXFLAGS += -fopenmp
LDFLAGS := -L$(XILINX_XRT)/lib -lxrt_coreutil -luuid
VPP_HLSCFLAGS := --compile --platform $(PLATFORM) --target $(TARGET) --save-temps --debug \
-DDATA_WIDTH_BYTES=$(FIFO_WIDTH)
VPP_LINKFLAGS := --link --optimize 3 --platform $(PLATFORM) --save-temps --debug
all: host xclbin
$(BUILD_DIR):
mkdir -p $@
# ---------------------------------------------------------------------------
# Application HLS kernels
# ---------------------------------------------------------------------------
$(BUILD_DIR)/recv_$(TARGET).xo: hls/recv.cpp | $(BUILD_DIR)
v++ $(VPP_HLSCFLAGS) --temp_dir $(BUILD_DIR)/_x_recv_$(TARGET) --kernel recv --output $@ $<
$(BUILD_DIR)/send_$(TARGET).xo: hls/send.cpp | $(BUILD_DIR)
v++ $(VPP_HLSCFLAGS) --temp_dir $(BUILD_DIR)/_x_send_$(TARGET) --kernel send --output $@ $<
# ---------------------------------------------------------------------------
# Linked xclbin (one rule per target execution mode)
# ---------------------------------------------------------------------------
# hw xclbin
$(BUILD_DIR)/aurora_flow_test_hw.xclbin: $(AURORA_FLOW_XOS_HW) \
$(BUILD_DIR)/send_hw.xo $(BUILD_DIR)/recv_hw.xo \
cfg/aurora_flow_test_hw.cfg | $(BUILD_DIR)
v++ $(VPP_LINKFLAGS) --target hw \
--temp_dir $(BUILD_DIR)/_x_aurora_flow_test_hw \
--config cfg/aurora_flow_test_hw.cfg \
--output $@ \
$(AURORA_FLOW_XOS_HW) $(BUILD_DIR)/send_hw.xo $(BUILD_DIR)/recv_hw.xo
# hw_emu xclbin (requires DPI-C source for xsim)
$(BUILD_DIR)/aurora_flow_test_hw_emu.xclbin: $(AURORA_FLOW_XOS_HW_EMU) \
$(BUILD_DIR)/send_hw_emu.xo $(BUILD_DIR)/recv_hw_emu.xo \
cfg/aurora_flow_test_hw_emu.cfg \
$(AURORA_FLOW_DPI_SRC) | $(BUILD_DIR)
v++ $(VPP_LINKFLAGS) --target hw_emu \
--temp_dir $(BUILD_DIR)/_x_aurora_flow_test_hw_emu \
--config cfg/aurora_flow_test_hw_emu.cfg \
--vivado.prop "fileset.sim_1.{xsim.compile.xsc.more_options}={$(AURORA_FLOW_DPI_SRC)}" \
--output $@ \
$(AURORA_FLOW_XOS_HW_EMU) $(BUILD_DIR)/send_hw_emu.xo $(BUILD_DIR)/recv_hw_emu.xo
# sw_emu xclbin
$(BUILD_DIR)/aurora_flow_test_sw_emu.xclbin: $(AURORA_FLOW_XO_SW_EMU) \
$(BUILD_DIR)/send_sw_emu.xo $(BUILD_DIR)/recv_sw_emu.xo \
cfg/aurora_flow_test_sw_emu.cfg | $(BUILD_DIR)
v++ $(VPP_LINKFLAGS) --target sw_emu \
--temp_dir $(BUILD_DIR)/_x_aurora_flow_test_sw_emu \
--config cfg/aurora_flow_test_sw_emu.cfg \
--output $@ \
$(AURORA_FLOW_XO_SW_EMU) $(BUILD_DIR)/send_sw_emu.xo $(BUILD_DIR)/recv_sw_emu.xo
$(BUILD_DIR)/emconfig.json: | $(BUILD_DIR)
emconfigutil --platform $(PLATFORM) --od $(BUILD_DIR)
xclbin: $(BUILD_DIR)/aurora_flow_test_$(TARGET).xclbin $(BUILD_DIR)/emconfig.json
# ---------------------------------------------------------------------------
# Host binary
# ---------------------------------------------------------------------------
HOST_HDRS := host/Configuration.hpp host/Results.hpp host/Kernel.hpp cxxopts.hpp \
$(AURORA_FLOW_HEADER)
$(BUILD_DIR)/host_aurora_flow_test: host/host_aurora_flow_test.cpp $(HOST_HDRS) | $(BUILD_DIR)
$(MPICXX) -o $@ $< $(CXXFLAGS) $(LDFLAGS)
host: $(BUILD_DIR)/host_aurora_flow_test
# ---------------------------------------------------------------------------
# Quick sw_emu test
# ---------------------------------------------------------------------------
test: host $(BUILD_DIR)/aurora_flow_test_sw_emu.xclbin $(BUILD_DIR)/emconfig.json
cd $(BUILD_DIR) && XCL_EMULATION_MODE=sw_emu ./host_aurora_flow_test -p aurora_flow_test_sw_emu.xclbin
# ---------------------------------------------------------------------------
# Clean
# ---------------------------------------------------------------------------
clean:
rm -rf $(BUILD_DIR)