Introducing the Makefile - 2023.2 日本語

Vitis チュートリアル: ハードウェア アクセラレーション (XD099)

Document ID
XD099
Release Date
2023-11-13
Version
2023.2 日本語
  1. Run the hardware build by compiling the kernels with v++ and link to xclbin.

    ...
    COMMFLAGS +=  -I $(XFLIB_DIR)/L2/include -I $(CUR_DIR)/kernel -I $(XFLIB_DIR)/../database/L1/include/hw -I $(XFLIB_DIR)/../quantitative_finance/L1/include -I $(XFLIB_DIR)/../utils/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/../database/L1/include/hw -I $(XFLIB_DIR)/../quantitative_finance/L1/include -I $(XFLIB_DIR)/../utils/L1/include
    HLSCFLAGS := --compile $(COMMFLAGS)
    LINKFLAGS := --link --optimize 3 $(COMMFLAGS)
    ...
    XCLBIN_OBJ := shortpath_$(TARGET).xclbin
    
    weight_average.xo:  ./kernel/weight_average.cpp
      v++ $(HLSCFLAGS) --kernel weight_average --output $@ $^
    
    shortestPath_top.xo: ./kernel/shortestPath_top.cpp
      v++ $(HLSCFLAGS) $(VPP_FLAGS_shortestPath_top) --kernel shortestPath_top --output $@ $^
    
    search.xo: ./kernel/search.cpp
      v++ $(HLSCFLAGS) --kernel search --output $@ $^
    
    $(XCLBIN_OBJ): weight_average.xo shortestPath_top.xo search.xo
      v++ $(LINKFLAGS)   $(VPP_LDFLAGS_shortestPath_top) --output $@ weight_average.xo shortestPath_top.xo search.xo 
    
  2. Host the build by compiling the main code with g++.

    ...
    CXXFLAGS +=  -I $(XFLIB_DIR)/L2/include -I $(CUR_DIR)/host -I $(CUR_DIR)/kernel -I $(XFLIB_DIR)/ext/xcl2 -I $(XFLIB_DIR)/../utils/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/../database/L1/include/hw -I $(XFLIB_DIR)/../quantitative_finance/L1/include -I $(XFLIB_DIR)/../utils/L1/include -I $(XFLIB_DIR)/ext/xcl2
    ...
    LDFLAGS := -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_0  -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_0_bitacc_cmodel
    ifeq (,$(findstring opencv,$(CXXFLAGS)))
    CXXFLAGS += $(XRT_CXXFLAGS)
    endif
    
    EXECUTABLE := shortpath
    
    HOST_SRCS := ./host/main.cpp
    HOST_SRCS += $(XFLIB_DIR)/ext/xcl2/xcl2.cpp 
    
    $(EXECUTABLE): $(HOST_SRCS)
      $(CXX) -o $(EXECUTABLE) $^ $(CXXFLAGS) $(LDFLAGS)