From 87e7cbef5f94769527b9c1cf218103ec298ec148 Mon Sep 17 00:00:00 2001 From: SDA USR <1391+sdausr@users.noreply.gitenterprise.xilinx.com> Date: Wed, 26 Apr 2023 09:41:38 +0800 Subject: [PATCH] Squashed 'sparse' changes from 70ab538..bedbdea (#841) bedbdea Merge pull request #130 from liyuanz/update_makefile 165d1dd update a7c5de2 Merge pull request #129 from liyuanz/next 4942f53 update Co-authored-by: sdausr --- sparse/L1/tests/hw/cscRow/Makefile | 21 +- sparse/L1/tests/hw/cscRow/run_hls.tcl | 14 +- sparse/L1/tests/hw/dispCol/Makefile | 21 +- sparse/L1/tests/hw/dispCol/run_hls.tcl | 7 +- sparse/L1/tests/hw/dispColVec/Makefile | 21 +- sparse/L1/tests/hw/dispColVec/run_hls.tcl | 7 +- sparse/L1/tests/hw/dispNnzCol/Makefile | 21 +- sparse/L1/tests/hw/dispNnzCol/run_hls.tcl | 7 +- sparse/L1/tests/hw/rowAcc/Makefile | 21 +- sparse/L1/tests/hw/rowAcc/run_hls.tcl | 7 +- sparse/L1/tests/hw/rowAgg/Makefile | 21 +- sparse/L1/tests/hw/rowAgg/run_hls.tcl | 7 +- sparse/L1/tests/hw/xBarCol/Makefile | 21 +- sparse/L1/tests/hw/xBarCol/run_hls.tcl | 10 +- sparse/L1/tests/hw/xBarRow/Makefile | 21 +- sparse/L1/tests/hw/xBarRow/run_hls.tcl | 7 +- sparse/L2/benchmarks/spmv_double/Makefile | 494 ++++++++++++++-------- sparse/L2/benchmarks/spmv_double/utils.mk | 318 ++++++++++---- sparse/L2/tests/cscmv/Makefile | 116 +++-- sparse/L2/tests/cscmv/utils.mk | 189 +++++---- sparse/L2/tests/cscmvSingleHbm/Makefile | 116 +++-- sparse/L2/tests/cscmvSingleHbm/utils.mk | 189 +++++---- sparse/L2/tests/fp64/spmv/Makefile | 66 +-- sparse/L2/tests/fp64/spmv/utils.mk | 153 ++++--- 24 files changed, 1151 insertions(+), 724 deletions(-) diff --git a/sparse/L1/tests/hw/cscRow/Makefile b/sparse/L1/tests/hw/cscRow/Makefile index ebe1df8bbe..28202f3471 100644 --- a/sparse/L1/tests/hw/cscRow/Makefile +++ b/sparse/L1/tests/hw/cscRow/Makefile @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) @@ -61,7 +61,7 @@ export PATH := $(XILINX_VIVADO)/bin:$(PATH) # MK_INC_END vivado.mk -DEVICE ?= u280 +PLATFORM ?= xilinx_u280_gen3x16_xdma_1_202211_1 # MK_INC_BEGIN vitis_set_part.mk @@ -116,12 +116,21 @@ endif # 1.2 endif # 1 # 2. search Vitis installation ifeq (,$(XPLATFORM)) -# 2.1 as exact name +# 2.1 as exact name vitis < 2022.2 XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) -# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +# 2.2 as exact name vitis >= 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/base_platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) +# 2.3 as a pattern vitis < 2022.2 ifeq (,$(XPLATFORM)) XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +# 2.4 as a pattern vitis > 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/base_platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +endif # 2.4 +endif # 2.3 endif # 2.2 endif # 2 # 3. search default locations diff --git a/sparse/L1/tests/hw/cscRow/run_hls.tcl b/sparse/L1/tests/hw/cscRow/run_hls.tcl index 41b0e591ae..a8b1707543 100644 --- a/sparse/L1/tests/hw/cscRow/run_hls.tcl +++ b/sparse/L1/tests/hw/cscRow/run_hls.tcl @@ -1,5 +1,5 @@ -# -# Copyright 2019 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 source settings.tcl @@ -25,8 +25,8 @@ if {![info exists CLKP]} { open_project -reset $PROJ -add_files "${XF_PROJ_ROOT}/L1/tests/hw/cscRow/uut_top.cpp" -cflags "-I ${XF_PROJ_ROOT}/../blas/L1/include/hw -I ${XF_PROJ_ROOT}/L1/tests/hw -I ${XF_PROJ_ROOT}/L1/include/hw -g -O0 -std=c++11 -DSPARSE_maxRowBlocks=256 -DSPARSE_dataType=float -DSPARSE_indexType=uint32_t -DSPARSE_logParEntries=2 -DSPARSE_parEntries=4 -DSPARSE_logParGroups=0 -DSPARSE_parGroups=1 -DSPARSE_dataBits=32 -DSPARSE_indexBits=32 -DSPARSE_printWidth=6" -add_files -tb "${XF_PROJ_ROOT}/L1/tests/hw/cscRow/test.cpp" -cflags "-I ${XF_PROJ_ROOT}/../blas/L1/include/hw -I ${XF_PROJ_ROOT}/L1/tests/hw -I ${XF_PROJ_ROOT}/L1/include/hw -g -O0 -std=c++11 -DSPARSE_maxRowBlocks=256 -DSPARSE_dataType=float -DSPARSE_indexType=uint32_t -DSPARSE_logParEntries=2 -DSPARSE_parEntries=4 -DSPARSE_logParGroups=0 -DSPARSE_parGroups=1 -DSPARSE_dataBits=32 -DSPARSE_indexBits=32 -DSPARSE_printWidth=6 -I ${XF_PROJ_ROOT}/L1/include/sw" +add_files "${XF_PROJ_ROOT}/L1/tests/hw/cscRow/uut_top.cpp" -cflags "-I ${XF_PROJ_ROOT}/../blas/L1/include/hw -I ${XF_PROJ_ROOT}/L1/tests/hw -I ${XF_PROJ_ROOT}/L1/include/hw -g -O0 -std=c++11 -DSPARSE_maxRowBlocks=128 -DSPARSE_dataType=float -DSPARSE_indexType=uint32_t -DSPARSE_logParEntries=2 -DSPARSE_parEntries=4 -DSPARSE_logParGroups=0 -DSPARSE_parGroups=1 -DSPARSE_dataBits=32 -DSPARSE_indexBits=32 -DSPARSE_printWidth=6" +add_files -tb "${XF_PROJ_ROOT}/L1/tests/hw/cscRow/test.cpp" -cflags "-I ${XF_PROJ_ROOT}/../blas/L1/include/hw -I ${XF_PROJ_ROOT}/L1/tests/hw -I ${XF_PROJ_ROOT}/L1/include/hw -g -O0 -std=c++11 -DSPARSE_maxRowBlocks=128 -DSPARSE_dataType=float -DSPARSE_indexType=uint32_t -DSPARSE_logParEntries=2 -DSPARSE_parEntries=4 -DSPARSE_logParGroups=0 -DSPARSE_parGroups=1 -DSPARSE_dataBits=32 -DSPARSE_indexBits=32 -DSPARSE_printWidth=6 -I ${XF_PROJ_ROOT}/L1/include/sw" set_top uut_top open_solution -reset $SOLN @@ -37,7 +37,6 @@ set_part $XPART create_clock -period $CLKP if {$CSIM == 1} { - #csim_design -argv "${CUR_DIR}/toCscRow.dat" csim_design } @@ -46,7 +45,6 @@ if {$CSYNTH == 1} { } if {$COSIM == 1} { - #cosim_design -trace_level all -argv "${CUR_DIR}/toCscRow.dat" cosim_design } @@ -58,4 +56,4 @@ if {$VIVADO_IMPL == 1} { export_design -flow impl -rtl verilog } -exit +exit \ No newline at end of file diff --git a/sparse/L1/tests/hw/dispCol/Makefile b/sparse/L1/tests/hw/dispCol/Makefile index 34797f8109..eeb713de3b 100644 --- a/sparse/L1/tests/hw/dispCol/Makefile +++ b/sparse/L1/tests/hw/dispCol/Makefile @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) @@ -61,7 +61,7 @@ export PATH := $(XILINX_VIVADO)/bin:$(PATH) # MK_INC_END vivado.mk -DEVICE ?= u280 +PLATFORM ?= xilinx_u280_gen3x16_xdma_1_202211_1 # MK_INC_BEGIN vitis_set_part.mk @@ -116,12 +116,21 @@ endif # 1.2 endif # 1 # 2. search Vitis installation ifeq (,$(XPLATFORM)) -# 2.1 as exact name +# 2.1 as exact name vitis < 2022.2 XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) -# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +# 2.2 as exact name vitis >= 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/base_platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) +# 2.3 as a pattern vitis < 2022.2 ifeq (,$(XPLATFORM)) XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +# 2.4 as a pattern vitis > 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/base_platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +endif # 2.4 +endif # 2.3 endif # 2.2 endif # 2 # 3. search default locations diff --git a/sparse/L1/tests/hw/dispCol/run_hls.tcl b/sparse/L1/tests/hw/dispCol/run_hls.tcl index bb6d583e10..7113bdec72 100644 --- a/sparse/L1/tests/hw/dispCol/run_hls.tcl +++ b/sparse/L1/tests/hw/dispCol/run_hls.tcl @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 source settings.tcl @@ -33,7 +33,6 @@ open_solution -reset $SOLN - set_part $XPART create_clock -period $CLKP diff --git a/sparse/L1/tests/hw/dispColVec/Makefile b/sparse/L1/tests/hw/dispColVec/Makefile index ba6bb33950..5d4e5175c9 100644 --- a/sparse/L1/tests/hw/dispColVec/Makefile +++ b/sparse/L1/tests/hw/dispColVec/Makefile @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) @@ -61,7 +61,7 @@ export PATH := $(XILINX_VIVADO)/bin:$(PATH) # MK_INC_END vivado.mk -DEVICE ?= u280 +PLATFORM ?= xilinx_u280_gen3x16_xdma_1_202211_1 # MK_INC_BEGIN vitis_set_part.mk @@ -116,12 +116,21 @@ endif # 1.2 endif # 1 # 2. search Vitis installation ifeq (,$(XPLATFORM)) -# 2.1 as exact name +# 2.1 as exact name vitis < 2022.2 XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) -# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +# 2.2 as exact name vitis >= 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/base_platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) +# 2.3 as a pattern vitis < 2022.2 ifeq (,$(XPLATFORM)) XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +# 2.4 as a pattern vitis > 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/base_platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +endif # 2.4 +endif # 2.3 endif # 2.2 endif # 2 # 3. search default locations diff --git a/sparse/L1/tests/hw/dispColVec/run_hls.tcl b/sparse/L1/tests/hw/dispColVec/run_hls.tcl index 641b091b9b..da048c4fe8 100644 --- a/sparse/L1/tests/hw/dispColVec/run_hls.tcl +++ b/sparse/L1/tests/hw/dispColVec/run_hls.tcl @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 source settings.tcl @@ -33,7 +33,6 @@ open_solution -reset $SOLN - set_part $XPART create_clock -period $CLKP diff --git a/sparse/L1/tests/hw/dispNnzCol/Makefile b/sparse/L1/tests/hw/dispNnzCol/Makefile index 76badfb50c..70e83f1fb3 100644 --- a/sparse/L1/tests/hw/dispNnzCol/Makefile +++ b/sparse/L1/tests/hw/dispNnzCol/Makefile @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) @@ -61,7 +61,7 @@ export PATH := $(XILINX_VIVADO)/bin:$(PATH) # MK_INC_END vivado.mk -DEVICE ?= u280 +PLATFORM ?= xilinx_u280_gen3x16_xdma_1_202211_1 # MK_INC_BEGIN vitis_set_part.mk @@ -116,12 +116,21 @@ endif # 1.2 endif # 1 # 2. search Vitis installation ifeq (,$(XPLATFORM)) -# 2.1 as exact name +# 2.1 as exact name vitis < 2022.2 XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) -# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +# 2.2 as exact name vitis >= 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/base_platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) +# 2.3 as a pattern vitis < 2022.2 ifeq (,$(XPLATFORM)) XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +# 2.4 as a pattern vitis > 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/base_platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +endif # 2.4 +endif # 2.3 endif # 2.2 endif # 2 # 3. search default locations diff --git a/sparse/L1/tests/hw/dispNnzCol/run_hls.tcl b/sparse/L1/tests/hw/dispNnzCol/run_hls.tcl index f5dd5ec969..7ab01ad7b1 100644 --- a/sparse/L1/tests/hw/dispNnzCol/run_hls.tcl +++ b/sparse/L1/tests/hw/dispNnzCol/run_hls.tcl @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 source settings.tcl @@ -33,7 +33,6 @@ open_solution -reset $SOLN - set_part $XPART create_clock -period $CLKP diff --git a/sparse/L1/tests/hw/rowAcc/Makefile b/sparse/L1/tests/hw/rowAcc/Makefile index 6fd41bac4e..2cd0326169 100644 --- a/sparse/L1/tests/hw/rowAcc/Makefile +++ b/sparse/L1/tests/hw/rowAcc/Makefile @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) @@ -61,7 +61,7 @@ export PATH := $(XILINX_VIVADO)/bin:$(PATH) # MK_INC_END vivado.mk -DEVICE ?= u280 +PLATFORM ?= xilinx_u280_gen3x16_xdma_1_202211_1 # MK_INC_BEGIN vitis_set_part.mk @@ -116,12 +116,21 @@ endif # 1.2 endif # 1 # 2. search Vitis installation ifeq (,$(XPLATFORM)) -# 2.1 as exact name +# 2.1 as exact name vitis < 2022.2 XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) -# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +# 2.2 as exact name vitis >= 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/base_platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) +# 2.3 as a pattern vitis < 2022.2 ifeq (,$(XPLATFORM)) XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +# 2.4 as a pattern vitis > 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/base_platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +endif # 2.4 +endif # 2.3 endif # 2.2 endif # 2 # 3. search default locations diff --git a/sparse/L1/tests/hw/rowAcc/run_hls.tcl b/sparse/L1/tests/hw/rowAcc/run_hls.tcl index 46843af859..9ac97cc59e 100644 --- a/sparse/L1/tests/hw/rowAcc/run_hls.tcl +++ b/sparse/L1/tests/hw/rowAcc/run_hls.tcl @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 source settings.tcl @@ -33,7 +33,6 @@ open_solution -reset $SOLN - set_part $XPART create_clock -period $CLKP diff --git a/sparse/L1/tests/hw/rowAgg/Makefile b/sparse/L1/tests/hw/rowAgg/Makefile index 8641e6416f..9db41c91a9 100644 --- a/sparse/L1/tests/hw/rowAgg/Makefile +++ b/sparse/L1/tests/hw/rowAgg/Makefile @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) @@ -61,7 +61,7 @@ export PATH := $(XILINX_VIVADO)/bin:$(PATH) # MK_INC_END vivado.mk -DEVICE ?= u280 +PLATFORM ?= xilinx_u280_gen3x16_xdma_1_202211_1 # MK_INC_BEGIN vitis_set_part.mk @@ -116,12 +116,21 @@ endif # 1.2 endif # 1 # 2. search Vitis installation ifeq (,$(XPLATFORM)) -# 2.1 as exact name +# 2.1 as exact name vitis < 2022.2 XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) -# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +# 2.2 as exact name vitis >= 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/base_platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) +# 2.3 as a pattern vitis < 2022.2 ifeq (,$(XPLATFORM)) XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +# 2.4 as a pattern vitis > 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/base_platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +endif # 2.4 +endif # 2.3 endif # 2.2 endif # 2 # 3. search default locations diff --git a/sparse/L1/tests/hw/rowAgg/run_hls.tcl b/sparse/L1/tests/hw/rowAgg/run_hls.tcl index 478d1b70fc..77ad735fec 100644 --- a/sparse/L1/tests/hw/rowAgg/run_hls.tcl +++ b/sparse/L1/tests/hw/rowAgg/run_hls.tcl @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 source settings.tcl @@ -33,7 +33,6 @@ open_solution -reset $SOLN - set_part $XPART create_clock -period $CLKP diff --git a/sparse/L1/tests/hw/xBarCol/Makefile b/sparse/L1/tests/hw/xBarCol/Makefile index 43baf60672..04b315076b 100644 --- a/sparse/L1/tests/hw/xBarCol/Makefile +++ b/sparse/L1/tests/hw/xBarCol/Makefile @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) @@ -61,7 +61,7 @@ export PATH := $(XILINX_VIVADO)/bin:$(PATH) # MK_INC_END vivado.mk -DEVICE ?= u280 +PLATFORM ?= xilinx_u280_gen3x16_xdma_1_202211_1 # MK_INC_BEGIN vitis_set_part.mk @@ -116,12 +116,21 @@ endif # 1.2 endif # 1 # 2. search Vitis installation ifeq (,$(XPLATFORM)) -# 2.1 as exact name +# 2.1 as exact name vitis < 2022.2 XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) -# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +# 2.2 as exact name vitis >= 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/base_platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) +# 2.3 as a pattern vitis < 2022.2 ifeq (,$(XPLATFORM)) XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +# 2.4 as a pattern vitis > 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/base_platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +endif # 2.4 +endif # 2.3 endif # 2.2 endif # 2 # 3. search default locations diff --git a/sparse/L1/tests/hw/xBarCol/run_hls.tcl b/sparse/L1/tests/hw/xBarCol/run_hls.tcl index 7b79d9d963..9caaa6d19e 100644 --- a/sparse/L1/tests/hw/xBarCol/run_hls.tcl +++ b/sparse/L1/tests/hw/xBarCol/run_hls.tcl @@ -1,5 +1,5 @@ -# -# Copyright 2019 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 source settings.tcl @@ -37,7 +37,6 @@ set_part $XPART create_clock -period $CLKP if {$CSIM == 1} { - #csim_design -argv "${CUR_DIR}/toXBarCol.dat" csim_design } @@ -46,7 +45,6 @@ if {$CSYNTH == 1} { } if {$COSIM == 1} { - #cosim_design -trace_level all -argv "${CUR_DIR}/toXBarCol.dat" cosim_design } @@ -58,4 +56,4 @@ if {$VIVADO_IMPL == 1} { export_design -flow impl -rtl verilog } -exit +exit \ No newline at end of file diff --git a/sparse/L1/tests/hw/xBarRow/Makefile b/sparse/L1/tests/hw/xBarRow/Makefile index e97dcbdaec..83e673c5df 100644 --- a/sparse/L1/tests/hw/xBarRow/Makefile +++ b/sparse/L1/tests/hw/xBarRow/Makefile @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) @@ -61,7 +61,7 @@ export PATH := $(XILINX_VIVADO)/bin:$(PATH) # MK_INC_END vivado.mk -DEVICE ?= u280 +PLATFORM ?= xilinx_u280_gen3x16_xdma_1_202211_1 # MK_INC_BEGIN vitis_set_part.mk @@ -116,12 +116,21 @@ endif # 1.2 endif # 1 # 2. search Vitis installation ifeq (,$(XPLATFORM)) -# 2.1 as exact name +# 2.1 as exact name vitis < 2022.2 XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) -# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +# 2.2 as exact name vitis >= 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/base_platforms/$(DEVICE_L)/$(DEVICE_L).xpfm)) +# 2.3 as a pattern vitis < 2022.2 ifeq (,$(XPLATFORM)) XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +# 2.4 as a pattern vitis > 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/base_platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/'))) +endif # 2.4 +endif # 2.3 endif # 2.2 endif # 2 # 3. search default locations diff --git a/sparse/L1/tests/hw/xBarRow/run_hls.tcl b/sparse/L1/tests/hw/xBarRow/run_hls.tcl index 43cb6c8b31..c89d4bb0e7 100644 --- a/sparse/L1/tests/hw/xBarRow/run_hls.tcl +++ b/sparse/L1/tests/hw/xBarRow/run_hls.tcl @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# vitis hls makefile-generator v2.0.0 source settings.tcl @@ -33,7 +33,6 @@ open_solution -reset $SOLN - set_part $XPART create_clock -period $CLKP diff --git a/sparse/L2/benchmarks/spmv_double/Makefile b/sparse/L2/benchmarks/spmv_double/Makefile index 19151ff07e..9313a043a6 100644 --- a/sparse/L2/benchmarks/spmv_double/Makefile +++ b/sparse/L2/benchmarks/spmv_double/Makefile @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,259 +12,405 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# makefile-generator v1.0.3 -# +# vitis makefile-generator v2.0.9 -# ####################################### Help Section ##################################### +############################## Help Section ############################## .PHONY: help help:: $(ECHO) "Makefile Usage:" - $(ECHO) " make all TARGET= DEVICE= HOST_ARCH=" + $(ECHO) " make all TARGET= PLATFORM=" $(ECHO) " Command to generate the design for specified Target and Shell." - $(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH is required for SoC shells" - $(ECHO) "" - $(ECHO) " make clean " - $(ECHO) " Command to remove the generated non-hardware files." - $(ECHO) "" - $(ECHO) " make cleanall" - $(ECHO) " Command to remove all the generated files." - $(ECHO) "" - $(ECHO) " make TARGET= DEVICE= HOST_ARCH=" - $(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH is required for SoC shells" $(ECHO) "" - $(ECHO) " make run TARGET= DEVICE= HOST_ARCH=" + $(ECHO) " make run TARGET= PLATFORM=" $(ECHO) " Command to run application in emulation." - $(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH required for SoC shells" $(ECHO) "" - $(ECHO) " make build TARGET= DEVICE= HOST_ARCH=" + $(ECHO) " make xclbin TARGET= PLATFORM=" $(ECHO) " Command to build xclbin application." - $(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH is required for SoC shells" $(ECHO) "" - $(ECHO) " make host HOST_ARCH=" + $(ECHO) " make host TARGET=" $(ECHO) " Command to build host application." - $(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH is required for SoC shells" $(ECHO) "" - $(ECHO) " NOTE: For SoC shells, ENV variable SYSROOT needs to be set." + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." $(ECHO) "" -# ##################### Setting up default value of TARGET ########################## -TARGET ?= sw_emu +############################## Setting up Project Variables ############################## -# ################### Setting up default value of DEVICE ############################## -DEVICE ?= xilinx_u280_xdma_201920_3 +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) -# ###################### Setting up default value of HOST_ARCH ####################### +# setting devault value +TARGET ?= hw_emu HOST_ARCH ?= x86 -# #################### Checking if DEVICE in blacklist ############################# - -# #################### Checking if DEVICE in whitelist ############################ -ifneq ($(findstring u280, $(DEVICE)), u280) -$(error [ERROR]: This project is not supported for $(DEVICE).) +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := xilinx_u280_gen3x16_xdma_1_202211_1 endif -# ######################## Setting up Project Variables ################################# -MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) -XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') -CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) -XFLIB_DIR = $(XF_PROJ_ROOT) +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += u280 +PLATFORM_BLOCKLIST += other -# ######################### Include environment variables in utils.mk #################### include ./utils.mk -XDEVICE := $(call device2xsa, $(DEVICE)) -TEMP_DIR := _x_temp.$(TARGET).$(XDEVICE) -TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(XDEVICE) -BUILD_DIR := build_dir.$(TARGET).$(XDEVICE) -BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(XDEVICE) -EMCONFIG_DIR := $(BUILD_DIR) +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) export XCL_BINDIR = $(XCLBIN_DIR) -# ######################### Setting up Host Variables ######################### -#Include Required Host Source Files -HOST_SRCS += $(XFLIB_DIR)/L2/benchmarks/spmv_double/host/main.cpp -HOST_SRCS += $(XFLIB_DIR)/../blas/L2/src/xcl2/xcl2.cpp - -CXXFLAGS += -DSPARSE_dataType=double -DSPARSE_indexType=uint16_t -DSPARSE_parEntries=4 -DSPARSE_hbmChannels=16 -DSPARSE_hbmMemBits=256 -CXXFLAGS += -I$(XFLIB_DIR)/.. -CXXFLAGS += -I$(XFLIB_DIR)/../blas/L2/include/xcl2 -CXXFLAGS += -I$(XFLIB_DIR)/L2/benchmarks/spmv_double/host -CXXFLAGS += -I$(XFLIB_DIR)/L2/include/sw/fp64 -CXXFLAGS += -I$(XFLIB_DIR)/L1/include/hw -CXXFLAGS += -I$(XFLIB_DIR)/L1/include/sw -CXXFLAGS += -I$(XFLIB_DIR)/L2/include/hw -CXXFLAGS += -I$(XFLIB_DIR)/L2/include/hw - -ifeq ($(TARGET),sw_emu) -CXXFLAGS += -D SW_EMU_TEST -endif +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := -ifeq ($(TARGET),hw_emu) -CXXFLAGS += -D HW_EMU_TEST +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) -# ######################### Host compiler global settings ############################ -CXXFLAGS += -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++11 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label -LDFLAGS += -L$(XILINX_XRT)/lib -lOpenCL -lpthread -lrt -Wno-unused-label -Wno-narrowing -DVERBOSE -CXXFLAGS += -fmessage-length=0 -g -O0 -CXXFLAGS += -I$(CUR_DIR)/src/ +########################## Setting up Host Variables ########################## -ifeq ($(HOST_ARCH), x86) -LDFLAGS += -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +#Inclue Required Host Source Files +ifeq ($(ps_on_x86), on) +HOST_SRCS += $(XFLIB_DIR)/L2/benchmarks/spmv_double/host/main.cpp $(XFLIB_DIR)/../blas/L2/src/xcl2/xcl2.cpp +CXXFLAGS += -D SPARSE_dataType=double -D SPARSE_indexType=uint16_t -D SPARSE_parEntries=4 -D SPARSE_hbmChannels=16 -D SPARSE_hbmMemBits=256 +CXXFLAGS += -I $(XFLIB_DIR)/.. -I $(XFLIB_DIR)/../blas/L2/include/xcl2 -I $(XFLIB_DIR)/L2/benchmarks/spmv_double/host -I $(XFLIB_DIR)/L2/include/sw/fp64 -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/hw +CXXFLAGS += -g -O0 +else +HOST_SRCS += $(XFLIB_DIR)/L2/benchmarks/spmv_double/host/main.cpp $(XFLIB_DIR)/../blas/L2/src/xcl2/xcl2.cpp +CXXFLAGS += -D SPARSE_dataType=double -D SPARSE_indexType=uint16_t -D SPARSE_parEntries=4 -D SPARSE_hbmChannels=16 -D SPARSE_hbmMemBits=256 +CXXFLAGS += -I $(XFLIB_DIR)/.. -I $(XFLIB_DIR)/../blas/L2/include/xcl2 -I $(XFLIB_DIR)/L2/benchmarks/spmv_double/host -I $(XFLIB_DIR)/L2/include/sw/fp64 -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/hw +CXXFLAGS += -g -O0 endif -# ################### Setting package and image directory ####################### +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif EXE_NAME := host.exe EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) -HOST_ARGS := $(BUILD_DIR)/spmv.xclbin $(CUR_DIR)/../../tests/fp64/spmv/sig_dat $(CUR_DIR)/../../tests/fp64/spmv/vec_dat nasa2910 1 - -# ##################### Kernel compiler global settings ########################## -VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps --optimize 2 -VPP_FLAGS += --jobs 8 -VPP_FLAGS += -I$(XFLIB_DIR)/L1/include/hw -VPP_FLAGS += -I$(XFLIB_DIR)/L1/include/sw -VPP_FLAGS += -I$(XFLIB_DIR)/L2/include/hw -VPP_FLAGS += -I$(XFLIB_DIR)/L2/include/hw - -VPP_FLAGS += -I$(XFLIB_DIR)/L1/include/hw/ -VPP_FLAGS += -I$(XFLIB_DIR)/L2/benchmarks/spmv_double/kernel -VPP_FLAGS += -I$(XFLIB_DIR)/L2/include/hw/fp64 -VPP_FLAGS += -I$(XFLIB_DIR)/.. -VPP_FLAGS += -I$(XFLIB_DIR)/../blas/L1/include/hw - -loadNnzKernel_VPP_FLAGS += --hls.clock 333000000:loadNnzKernel -loadParXkernel_VPP_FLAGS += --hls.clock 333000000:loadParXkernel -fwdParParamKernel_VPP_FLAGS += --hls.clock 333000000:fwdParParamKernel -moveXkernel_VPP_FLAGS += --hls.clock 333000000:moveXkernel -selMultXkernel_VPP_FLAGS += --hls.clock 333000000:selMultXkernel -loadRbParamKernel_VPP_FLAGS += --hls.clock 333000000:loadRbParamKernel -rowAccKernel_VPP_FLAGS += --hls.clock 333000000:rowAccKernel -assembleYkernel_VPP_FLAGS += --hls.clock 333000000:assembleYkernel -storeYkernel_VPP_FLAGS += --hls.clock 333000000:storeYkernel -VPP_LDFLAGS_spmv += --kernel_frequency 333 +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) -VPP_FLAGS += -DSPARSE_dataType=double -DSPARSE_indexType=uint16_t -DSPARSE_parEntries=4 -DSPARSE_hbmChannels=16 -DSPARSE_hbmMemBits=256 -DSPARSE_maxRows=4096 -DSPARSE_maxCols=4096 -DSPARSE_accLatency=8 -DSPARSE_dataBits=64 -DSPARSE_indexBits=16 +HOST_ARGS := $(BUILD_DIR)/spmv.xclbin $(CUR_DIR)/../../tests/fp64/spmv/sig_dat $(CUR_DIR)/../../tests/fp64/spmv/vec_dat nasa2910 1 +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif -# Kernel linker flags -VPP_LDFLAGS_spmv_temp := --config $(CUR_DIR)/opts.cfg +########################## Kernel compiler global settings ########################## +VPP_FLAGS += -D SPARSE_dataType=double -D SPARSE_indexType=uint16_t -D SPARSE_parEntries=4 -D SPARSE_hbmChannels=16 -D SPARSE_hbmMemBits=256 -D SPARSE_maxRows=4096 -D SPARSE_maxCols=4096 -D SPARSE_accLatency=8 -D SPARSE_dataBits=64 -D SPARSE_indexBits=16 +VPP_FLAGS += -I $(XFLIB_DIR)/L1/include/hw/ -I $(XFLIB_DIR)/L2/benchmarks/spmv_double/kernel -I $(XFLIB_DIR)/L2/include/hw/fp64 -I $(XFLIB_DIR)/.. -I $(XFLIB_DIR)/../blas/L1/include/hw -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/hw +######################### binary container global settings ########################## ifneq (,$(shell echo $(XPLATFORM) | awk '/u280/')) -VPP_LDFLAGS_spmv_temp += --config $(CUR_DIR)/conn_u280.cfg +VPP_FLAGS_loadNnzKernel += --hls.clock 333000000:loadNnzKernel +VPP_FLAGS_loadParXkernel += --hls.clock 333000000:loadParXkernel +VPP_FLAGS_fwdParParamKernel += --hls.clock 333000000:fwdParParamKernel +VPP_FLAGS_moveXkernel += --hls.clock 333000000:moveXkernel +VPP_FLAGS_selMultXkernel += --hls.clock 333000000:selMultXkernel +VPP_FLAGS_loadRbParamKernel += --hls.clock 333000000:loadRbParamKernel +VPP_FLAGS_rowAccKernel += --hls.clock 333000000:rowAccKernel +VPP_FLAGS_assembleYkernel += --hls.clock 333000000:assembleYkernel +VPP_FLAGS_storeYkernel += --hls.clock 333000000:storeYkernel +ifneq ($(HOST_ARCH_temp), x86) +VPP_LDFLAGS_spmv += --clock.defaultFreqHz 333000000 +else +VPP_LDFLAGS_spmv += --kernel_frequency 333 endif +VPP_LDFLAGS_spmv_temp := --config $(CUR_DIR)/conn_u280.cfg VPP_LDFLAGS_spmv += $(VPP_LDFLAGS_spmv_temp) -# ############################ Declaring Binary Containers ########################## +else +VPP_FLAGS_loadNnzKernel += --hls.clock 333000000:loadNnzKernel +VPP_FLAGS_loadParXkernel += --hls.clock 333000000:loadParXkernel +VPP_FLAGS_fwdParParamKernel += --hls.clock 333000000:fwdParParamKernel +VPP_FLAGS_moveXkernel += --hls.clock 333000000:moveXkernel +VPP_FLAGS_selMultXkernel += --hls.clock 333000000:selMultXkernel +VPP_FLAGS_loadRbParamKernel += --hls.clock 333000000:loadRbParamKernel +VPP_FLAGS_rowAccKernel += --hls.clock 333000000:rowAccKernel +VPP_FLAGS_assembleYkernel += --hls.clock 333000000:assembleYkernel +VPP_FLAGS_storeYkernel += --hls.clock 333000000:storeYkernel +ifneq ($(HOST_ARCH_temp), x86) +VPP_LDFLAGS_spmv += --clock.defaultFreqHz 333000000 +else +VPP_LDFLAGS_spmv += --kernel_frequency 333 +endif +VPP_LDFLAGS_spmv_temp := --config $(CUR_DIR)/opts.cfg +VPP_LDFLAGS_spmv += $(VPP_LDFLAGS_spmv_temp) +endif +ifneq ($(SD_CARD_NEEDED), on) BINARY_CONTAINERS += $(BUILD_DIR)/spmv.xclbin -BINARY_CONTAINER_spmv_OBJS += $(TEMP_DIR)/loadNnzKernel.xo -BINARY_CONTAINER_spmv_OBJS += $(TEMP_DIR)/loadParXkernel.xo -BINARY_CONTAINER_spmv_OBJS += $(TEMP_DIR)/fwdParParamKernel.xo -BINARY_CONTAINER_spmv_OBJS += $(TEMP_DIR)/moveXkernel.xo -BINARY_CONTAINER_spmv_OBJS += $(TEMP_DIR)/selMultXkernel.xo -BINARY_CONTAINER_spmv_OBJS += $(TEMP_DIR)/loadRbParamKernel.xo -BINARY_CONTAINER_spmv_OBJS += $(TEMP_DIR)/rowAccKernel.xo -BINARY_CONTAINER_spmv_OBJS += $(TEMP_DIR)/assembleYkernel.xo -BINARY_CONTAINER_spmv_OBJS += $(TEMP_DIR)/storeYkernel.xo - -# ######################### Setting Targets of Makefile ################################ - -.PHONY: all clean cleanall docs emconfig -all: check_vpp check_platform $(EXE_FILE) $(BINARY_CONTAINERS) emconfig - -.PHONY: host -host: check_xrt check_sysroot $(EXE_FILE) - -.PHONY: xclbin -xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) - -.PHONY: build -build: xclbin +else +BINARY_CONTAINERS += $(BUILD_DIR)/spmv_pkg.$(LINK_TARGET_FMT) +BINARY_CONTAINERS_PKG += $(BUILD_DIR)/spmv.xclbin +endif # ################ Setting Rules for Binary Containers (Building Kernels) ################ -$(TEMP_DIR)/loadNnzKernel.xo: $(XFLIB_DIR)/L2/benchmarks/spmv_double/kernel/loadNnzKernel.cpp +$(TEMP_DIR)/loadNnzKernel.xo: $(XFLIB_DIR)/L2/benchmarks/spmv_double/kernel/loadNnzKernel.cpp $(ECHO) "Compiling Kernel: loadNnzKernel" mkdir -p $(TEMP_DIR) - $(VPP) -c $(loadNnzKernel_VPP_FLAGS) $(VPP_FLAGS) -k loadNnzKernel -I'$(> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif endif +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) -# ################# Setting Rules for Host (Building Host Executable) ################ -$(EXE_FILE): $(HOST_SRCS) | check_xrt +.PHONY: mkflag all run +mkflag: mkdir -p $(BUILD_DIR) - $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done -emconfig:$(EMCONFIG_DIR)/emconfig.json -$(EMCONFIG_DIR)/emconfig.json: - emconfigutil --platform $(XPLATFORM) --od $(EMCONFIG_DIR) +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) - -# ###############Setting Essential Checks And Running Rules For Vitis Flow ############# run: all -ifeq ($(TARGET),$(filter $(TARGET),sw_emu hw_emu)) - $(CP) $(EMCONFIG_DIR)/emconfig.json . +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifneq (,$(findstring aws-vu9p-f1, $(PLATFORM_NAME))) +ifeq (,$(wildcard $(BUILD_DIR)/spmv.awsxclbin)) + $(ECHO) "This makefile does not directly support converting .xclbin to .awsxclbin, please refer https://github.com/aws/aws-fpga/blob/master/Vitis/README.md for next operations" +else + $(ECHO) "Running HW using generated .awsxclbin" + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(subst .xclbin,.awsxclbin,$(HOST_ARGS)) + +endif +else ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig gen_instances valid_params +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) endif -# ################################# Cleaning Rules ################################## +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## cleanh: - -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ - -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db cleank: - -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl* start_simulation.sh *.xclbin - -$(RMDIR) _x_temp.*/_x.* _x_temp.*/.Xil _x_temp.*/profile_summary.* xo_* _x* - -$(RMDIR) _x_temp.*/dltmp* _x_temp.*/kernel_info.dat _x_temp.*/*.log - -$(RMDIR) _x_temp.* + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) cleanall: cleanh cleank - -$(RMDIR) $(BUILD_DIR) build_dir.* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* run_script.sh .ipcache *.str - -$(RMDIR) $(XFLIB_DIR)/common/data/*.xe2xd* $(XFLIB_DIR)/common/data/*.orig* - - -$(RMDIR) $(AIE_CONTAINERS) $(CUR_DIR)/Work $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS + -$(RMDIR) $(BUILD_DIR) emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) -clean: cleanh +clean: cleanh \ No newline at end of file diff --git a/sparse/L2/benchmarks/spmv_double/utils.mk b/sparse/L2/benchmarks/spmv_double/utils.mk index 2e98106af4..8a4456fbde 100644 --- a/sparse/L2/benchmarks/spmv_double/utils.mk +++ b/sparse/L2/benchmarks/spmv_double/utils.mk @@ -1,5 +1,5 @@ -# -# Copyright 2019-2020 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# vitis makefile-generator v2.0.9 # #+------------------------------------------------------------------------------- # The following parameters are assigned with default values. These parameters can @@ -22,32 +23,186 @@ REPORT := no PROFILE := no DEBUG := no +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + #'estimate' for estimate report generation #'system' for system report generation ifneq ($(REPORT), no) -LDCLFLAGS += --report estimate -LDCLFLAGS += --report system +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system endif #Generates profile summary report ifeq ($(PROFILE), yes) -LDCLFLAGS += --profile_kernel data:all:all:all +VPP_LDFLAGS += --profile_kernel data:all:all:all endif #Generates debug summary report ifeq ($(DEBUG), yes) -LDCLFLAGS += --dk protocol:all:all:all +VPP_LDFLAGS += --dk protocol:all:all:all endif -#Check environment setup +#Check vitis setup ifndef XILINX_VITIS XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) export XILINX_VITIS endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name vitis < 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +ifeq (,$(XPLATFORM)) +# 2.2 as exact name vitis >= 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/base_platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.3 as a pattern vitis < 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +# 2.4 as a pattern vitis >= 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/base_platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.4 +endif # 2.3 +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +#get HOST_ARCH by PLATFORM +HOST_ARCH_temp = $(shell platforminfo -p $(XPLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(XPLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) ifndef XILINX_XRT XILINX_XRT = /opt/xilinx/xrt export XILINX_XRT endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif #Checks for Device Family ifeq ($(HOST_ARCH), aarch32) @@ -56,47 +211,103 @@ else ifeq ($(HOST_ARCH), aarch64) DEV_FAM = Ultrascale endif -B_NAME = $(shell dirname $(XPLATFORM)) - #Checks for Correct architecture ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) $(error HOST_ARCH variable not set, please set correctly and rerun) endif -#Checks for SYSROOT +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + check_sysroot: ifneq ($(HOST_ARCH), x86) -ifndef SYSROOT +ifeq (,$(wildcard $(SYSROOT))) $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) endif endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif -#Checks for g++ CXX := g++ ifeq ($(HOST_ARCH), x86) -ifneq ($(shell expr $(shell g++ -dumpversion) \>= 5), 1) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) ifndef XILINX_VIVADO -$(error [ERROR]: g++ version older. Please use 5.0 or above) +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) else -CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-6.2.0/bin/g++ +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ ifeq ($(LD_LIBRARY_PATH),) -export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-6.2.0/lib64 +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 else -export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-6.2.0/lib64:$(LD_LIBRARY_PATH) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) endif -$(warning [WARNING]: g++ version older. Using g++ provided by the tool : $(CXX)) +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) endif endif -else ifeq ($(HOST_ARCH), aarch64) +else +ifeq ($(HOST_ARCH), aarch64) CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ else ifeq ($(HOST_ARCH), aarch32) CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif #Setting VPP VPP := v++ #Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator .PHONY: check_vivado check_vivado: @@ -117,80 +328,13 @@ ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) endif export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) ifeq (,$(LD_LIBRARY_PATH)) LD_LIBRARY_PATH := $(XILINX_XRT)/lib else LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) endif - -# check target -ifeq ($(filter $(TARGET),sw_emu hw_emu hw),) -$(error TARGET is not sw_emu, hw_emu or hw) -endif - -ifneq (,$(wildcard $(DEVICE))) -# Use DEVICE as a file path -XPLATFORM := $(DEVICE) -else -# Use DEVICE as a file name pattern -# 1. search paths specified by variable -ifneq (,$(PLATFORM_REPO_PATHS)) -# 1.1 as exact name -XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(DEVICE)/$(DEVICE).xpfm))) -# 1.2 as a pattern -ifeq (,$(XPLATFORM)) -XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) -XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE)/'))) -endif # 1.2 -endif # 1 -# 2. search Vitis installation -ifeq (,$(XPLATFORM)) -# 2.1 as exact name -XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(DEVICE)/$(DEVICE).xpfm)) -# 2.2 as a pattern -ifeq (,$(XPLATFORM)) -XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) -XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE)/'))) -endif # 2.2 -endif # 2 -# 3. search default locations -ifeq (,$(XPLATFORM)) -# 3.1 as exact name -XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(DEVICE)/$(DEVICE).xpfm)) -# 3.2 as a pattern -ifeq (,$(XPLATFORM)) -XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) -XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE)/'))) -endif # 3.2 -endif # 3 -endif - -define MSG_PLATFORM -No platform matched pattern '$(DEVICE)'. -Available platforms are: $(XPLATFORMS) -To add more platform directories, set the PLATFORM_REPO_PATHS variable or point DEVICE variable to the full path of platform .xpfm file. -endef -export MSG_PLATFORM - -define MSG_DEVICE -More than one platform matched: $(XPLATFORM) -Please set DEVICE variable more accurately to select only one platform file, or set DEVICE variable to the full path of the platform .xpfm file. -endef -export MSG_DEVICE - -.PHONY: check_platform -check_platform: -ifeq (,$(XPLATFORM)) - @echo "$${MSG_PLATFORM}" && false -endif -ifneq (,$(word 2,$(XPLATFORM))) - @echo "$${MSG_DEVICE}" && false endif -#Check ends - -# device2xsa - create a filesystem friendly name from device name -# $(1) - full name of device -device2xsa = $(strip $(patsubst %.xpfm, % , $(shell basename $(DEVICE)))) # Cleaning stuff RM = rm -f diff --git a/sparse/L2/tests/cscmv/Makefile b/sparse/L2/tests/cscmv/Makefile index 440579b4ec..000622a5bf 100644 --- a/sparse/L2/tests/cscmv/Makefile +++ b/sparse/L2/tests/cscmv/Makefile @@ -1,4 +1,5 @@ -# Copyright 2019-2022 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,35 +12,31 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# vitis makefile-generator v2.0.7 +# vitis makefile-generator v2.0.9 ############################## Help Section ############################## .PHONY: help help:: $(ECHO) "Makefile Usage:" - $(ECHO) " make all TARGET= PLATFORM= HOST_ARCH=" + $(ECHO) " make all TARGET= PLATFORM=" $(ECHO) " Command to generate the design for specified Target and Shell." - $(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH is required for SoC shells" $(ECHO) "" - $(ECHO) " make run TARGET= PLATFORM= HOST_ARCH=" + $(ECHO) " make run TARGET= PLATFORM=" $(ECHO) " Command to run application in emulation." - $(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH required for SoC shells" $(ECHO) "" - $(ECHO) " make xclbin TARGET= PLATFORM= HOST_ARCH=" + $(ECHO) " make xclbin TARGET= PLATFORM=" $(ECHO) " Command to build xclbin application." - $(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH is required for SoC shells" $(ECHO) "" $(ECHO) " make host TARGET=" $(ECHO) " Command to build host application." - $(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH is required for SoC shells" $(ECHO) "" $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" - $(ECHO) " b. User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" $(ECHO) " export K_IMAGE=< path-to-Image-files >" $(ECHO) " export ROOTFS=< path-to-rootfs >" @@ -47,7 +44,7 @@ help:: $(ECHO) " make clean " $(ECHO) " Command to remove the generated non-hardware files." $(ECHO) "" - $(ECHO) " make cleanall" + $(ECHO) " make cleanall TARGET=" $(ECHO) " Command to remove all the generated files." $(ECHO) "" @@ -67,7 +64,7 @@ ifeq ($(PLATFORM),) PLATFORM := $(DEVICE) endif ifeq ($(PLATFORM),) -PLATFORM := xilinx_u280_gen3x16_xdma_1_202120_1 +PLATFORM := xilinx_u280_gen3x16_xdma_1_202211_1 endif # #################### Checking if PLATFORM in whitelist ############################ @@ -97,13 +94,8 @@ LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps VPP_LDFLAGS += --optimize 2 -R 2 else ifeq ($(HOST_ARCH), aarch64) -ifeq ($(ps_on_x86), on) -CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label -LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel -else CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil -endif VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps VPP_LDFLAGS += --optimize 2 -R 2 endif @@ -111,12 +103,6 @@ CXXFLAGS += $(EXTRA_CXXFLAGS) VPP_FLAGS += $(EXTRA_VPP_FLAGS) ########################## Setting up Host Variables ########################## -ifeq ($(TARGET),sw_emu) -CXXFLAGS += -D SW_EMU_TEST -endif -ifeq ($(TARGET),hw_emu) -CXXFLAGS += -D HW_EMU_TEST -endif #Inclue Required Host Source Files ifeq ($(ps_on_x86), on) @@ -138,7 +124,7 @@ endif EXE_NAME := cscmv.exe EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) -EXE_FILE_DEPS := $(HOST_SRCS) $(EXE_FILE_DEPS) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) HOST_ARGS := $(BUILD_DIR)/cscmv.xclbin $(CUR_DIR)/data/app.bin ifneq ($(HOST_ARCH), x86) @@ -164,7 +150,7 @@ VPP_FLAGS_bufTransNnzColKernel += --hls.clock 300000000:bufTransNnzColKernel VPP_FLAGS_xBarColKernel += --hls.clock 300000000:xBarColKernel VPP_FLAGS_cscRowKernel += --hls.clock 300000000:cscRowKernel VPP_FLAGS_readWriteHbmKernel += --hls.clock 300000000:readWriteHbmKernel -ifneq ($(HOST_ARCH), x86) +ifneq ($(HOST_ARCH_temp), x86) VPP_LDFLAGS_cscmv += --clock.defaultFreqHz 300000000 else VPP_LDFLAGS_cscmv += --kernel_frequency 300 @@ -172,7 +158,7 @@ endif VPP_LDFLAGS_cscmv_temp := --config $(CUR_DIR)/opts.cfg VPP_LDFLAGS_cscmv += $(VPP_LDFLAGS_cscmv_temp) -ifeq ($(HOST_ARCH), x86) +ifneq ($(SD_CARD_NEEDED), on) BINARY_CONTAINERS += $(BUILD_DIR)/cscmv.xclbin else BINARY_CONTAINERS += $(BUILD_DIR)/cscmv_pkg.$(LINK_TARGET_FMT) @@ -216,22 +202,15 @@ $(BINARY_CONTAINERS): $(BINARY_CONTAINERS_DEPS) $(VPP) -l $(VPP_FLAGS) --temp_dir $(TEMP_DIR) --report_dir $(BUILD_REPORT_DIR)/cscmv $(VPP_LDFLAGS) $(VPP_LDFLAGS_cscmv) $(AIE_LDFLAGS) -o $@ $^ ############################## Setting Rules for Host (Building Host Executable) ############################## -ifeq ($(HOST_ARCH), x86) -$(EXE_FILE): $(EXE_FILE_DEPS) | check_xrt +$(EXE_FILE): $(EXE_FILE_DEPS) mkdir -p $(BUILD_DIR) $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) -else -$(EXE_FILE): $(EXE_FILE_DEPS) | check_sysroot - mkdir -p $(BUILD_DIR) - $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) - -endif - $(EMCONFIG): emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + ############################## Preparing sdcard folder ############################## -ifneq ($(HOST_ARCH), x86) +ifeq ($(SD_CARD_NEEDED), on) RUN_SCRIPT := $(BUILD_DIR)/run_script.sh $(RUN_SCRIPT): rm -rf $(RUN_SCRIPT) @@ -253,8 +232,8 @@ endif @echo 'fi' >> $(RUN_SCRIPT) @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) @echo 'exit $$return_code' >> $(RUN_SCRIPT) -DATA_FILE := -DATA_DIR := +DATA_FILE := $(custom_data_file) +DATA_DIR := $(custom_data_dir) SD_FILES += $(RUN_SCRIPT) SD_FILES += $(EXE_FILE) SD_FILES += $(EMCONFIG) @@ -265,7 +244,7 @@ SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) PACKAGE_FILES := $(BINARY_CONTAINERS) PACKAGE_FILES += $(AIE_CONTAINER) SD_CARD := $(CUR_DIR)/package_$(TARGET) -$(SD_CARD): $(EXE_FILE) $(BINARY_CONTAINERS) $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs @echo "Generating sd_card folder...." mkdir -p $(SD_CARD) chmod a+rx $(BUILD_DIR)/run_script.sh @@ -280,19 +259,27 @@ ifeq ($(ps_on_x86), on) @echo "### ***** running PS X86 SE_EMU ***** ###" $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 endif -#3. General Embeded flow +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow ifeq ($(dfx_hw), off) ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) @echo "### ***** sd_card generation done! ***** ###" endif endif +endif .PHONY: sd_card sd_card: $(SD_CARD) endif ############################## Setting Essential Checks and Building Rules ############################## -RUN_DEPS += $(EXE_FILE) $(BINARY_CONTAINERS) $(EMCONFIG) +RUN_DEPS += host xclbin $(EMCONFIG) RUN_DEPS += $(SD_CARD) .PHONY: mkflag all run @@ -300,17 +287,26 @@ mkflag: mkdir -p $(BUILD_DIR) rm -rf $(BUILD_DIR)/makefile_args.txt @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done -all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + run: all #hw_emu ifneq (,$(filter hw_emu, $(TARGET))) ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) else @echo $(RUN_DEPS) - $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) 2>&1 | tee $(SD_CARD)/qemu_output.log + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 endif @@ -321,17 +317,11 @@ ifeq ($(HOST_ARCH), x86) LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) -else -ifeq ($(ps_on_x86), on) - LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ - XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) - else @echo $(RUN_DEPS) - $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) 2>&1 | tee $(SD_CARD)/qemu_output.log + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 -endif endif endif #hw @@ -356,35 +346,41 @@ endif ############################## Setting Targets ############################## -.PHONY: clean cleanall emconfig +.PHONY: clean cleanall emconfig gen_instances valid_params emconfig: $(EMCONFIG) .PHONY: host ifeq ($(HOST_ARCH), x86) -host: check_xrt $(EXE_FILE) +host: check_xrt $(EXE_FILE) else -host: check_sysroot $(EXE_FILE) +host: check_sysroot $(EXE_FILE) endif .PHONY: xclbin ifeq ($(HOST_ARCH), x86) -xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) else -xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) endif +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + ############################## Cleaning Rules ############################## cleanh: - -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ - -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db cleank: -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin - -$(RMDIR) _x_temp.* + -$(RMDIR) _x_temp.* _x* $(INST_FILES) cleanall: cleanh cleank -$(RMDIR) $(BUILD_DIR) emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str - -$(RMDIR) $(CUR_DIR)/Work $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut - -$(RMDIR) + -$(RMDIR) $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) clean: cleanh \ No newline at end of file diff --git a/sparse/L2/tests/cscmv/utils.mk b/sparse/L2/tests/cscmv/utils.mk index 624f7633e1..8a4456fbde 100644 --- a/sparse/L2/tests/cscmv/utils.mk +++ b/sparse/L2/tests/cscmv/utils.mk @@ -1,5 +1,5 @@ -# -# Copyright 2019-2022 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# vitis makefile-generator v2.0.7 +# vitis makefile-generator v2.0.9 # #+------------------------------------------------------------------------------- # The following parameters are assigned with default values. These parameters can @@ -23,6 +23,9 @@ REPORT := no PROFILE := no DEBUG := no +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + #'estimate' for estimate report generation #'system' for system report generation ifneq ($(REPORT), no) @@ -40,15 +43,11 @@ ifeq ($(DEBUG), yes) VPP_LDFLAGS += --dk protocol:all:all:all endif -#Check environment setup +#Check vitis setup ifndef XILINX_VITIS XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) export XILINX_VITIS endif -ifndef XILINX_XRT - XILINX_XRT = /opt/xilinx/xrt - export XILINX_XRT -endif .PHONY: check_device check_device: @@ -70,9 +69,68 @@ check_device: then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ fi; +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name vitis < 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +ifeq (,$(XPLATFORM)) +# 2.2 as exact name vitis >= 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/base_platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.3 as a pattern vitis < 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +# 2.4 as a pattern vitis >= 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/base_platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.4 +endif # 2.3 +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + #get HOST_ARCH by PLATFORM -ifneq (,$(PLATFORM)) -HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +HOST_ARCH_temp = $(shell platforminfo -p $(XPLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') ifeq ($(HOST_ARCH_temp), x86) HOST_ARCH := x86 else ifeq ($(HOST_ARCH_temp), cortex-a9) @@ -80,14 +138,17 @@ HOST_ARCH := aarch32 else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) HOST_ARCH := aarch64 endif -endif - # Special processing for tool version/platform type VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) -# 1) for versal flow from 2022.1 -DEVICE_TYPE = $(shell platforminfo -p $(PLATFORM) | grep 'FPGA Family' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') -ifeq ($(DEVICE_TYPE), versal) +AIE_TYPE := $(shell platforminfo $(XPLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) LINK_TARGET_FMT := xsa else @@ -109,8 +170,38 @@ ifneq ($(HOST_ARCH), x86) ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) ifeq ($(TARGET), sw_emu) ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on endif #Checks for Device Family @@ -162,17 +253,8 @@ ifeq (,$(wildcard $(ROOTFS))) endif endif -#Checks for g++ -ifeq ($(HOST_ARCH), x86) -X86_CXX := on -else -ifeq ($(ps_on_x86), on) -X86_CXX := on -endif -endif - CXX := g++ -ifeq ($(X86_CXX), on) +ifeq ($(HOST_ARCH), x86) ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) CXX_VER := 8.3.0 else @@ -254,63 +336,6 @@ LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) endif endif -ifneq (,$(wildcard $(PLATFORM))) -# Use PLATFORM as a file path -XPLATFORM := $(PLATFORM) -else -# Use PLATFORM as a file name pattern -# 1. search paths specified by variable -ifneq (,$(PLATFORM_REPO_PATHS)) -# 1.1 as exact name -XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) -# 1.2 as a pattern -ifeq (,$(XPLATFORM)) -XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) -XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) -endif # 1.2 -endif # 1 -# 2. search Vitis installation -ifeq (,$(XPLATFORM)) -# 2.1 as exact name -XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) -# 2.2 as a pattern -ifeq (,$(XPLATFORM)) -XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) -XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) -endif # 2.2 -endif # 2 -# 3. search default locations -ifeq (,$(XPLATFORM)) -# 3.1 as exact name -XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) -# 3.2 as a pattern -ifeq (,$(XPLATFORM)) -XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) -XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) -endif # 3.2 -endif # 3 -endif - -define MSG_PLATFORM -No platform matched pattern '$(PLATFORM)'. -Available platforms are: $(XPLATFORMS) -To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. -endef -export MSG_PLATFORM - - -.PHONY: check_platform -check_platform: -ifeq (,$(XPLATFORM)) - @echo "$${MSG_PLATFORM}" && false -endif -#Check ends - -# device2xsa - create a filesystem friendly name from device name -# $(1) - full name of device -PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) - - # Cleaning stuff RM = rm -f RMDIR = rm -rf diff --git a/sparse/L2/tests/cscmvSingleHbm/Makefile b/sparse/L2/tests/cscmvSingleHbm/Makefile index 0c37c562c7..e682e520cb 100644 --- a/sparse/L2/tests/cscmvSingleHbm/Makefile +++ b/sparse/L2/tests/cscmvSingleHbm/Makefile @@ -1,4 +1,5 @@ -# Copyright 2019-2022 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,35 +12,31 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# vitis makefile-generator v2.0.7 +# vitis makefile-generator v2.0.9 ############################## Help Section ############################## .PHONY: help help:: $(ECHO) "Makefile Usage:" - $(ECHO) " make all TARGET= PLATFORM= HOST_ARCH=" + $(ECHO) " make all TARGET= PLATFORM=" $(ECHO) " Command to generate the design for specified Target and Shell." - $(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH is required for SoC shells" $(ECHO) "" - $(ECHO) " make run TARGET= PLATFORM= HOST_ARCH=" + $(ECHO) " make run TARGET= PLATFORM=" $(ECHO) " Command to run application in emulation." - $(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH required for SoC shells" $(ECHO) "" - $(ECHO) " make xclbin TARGET= PLATFORM= HOST_ARCH=" + $(ECHO) " make xclbin TARGET= PLATFORM=" $(ECHO) " Command to build xclbin application." - $(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH is required for SoC shells" $(ECHO) "" $(ECHO) " make host TARGET=" $(ECHO) " Command to build host application." - $(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH is required for SoC shells" $(ECHO) "" $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" - $(ECHO) " b. User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" $(ECHO) " export K_IMAGE=< path-to-Image-files >" $(ECHO) " export ROOTFS=< path-to-rootfs >" @@ -47,7 +44,7 @@ help:: $(ECHO) " make clean " $(ECHO) " Command to remove the generated non-hardware files." $(ECHO) "" - $(ECHO) " make cleanall" + $(ECHO) " make cleanall TARGET=" $(ECHO) " Command to remove all the generated files." $(ECHO) "" @@ -67,7 +64,7 @@ ifeq ($(PLATFORM),) PLATFORM := $(DEVICE) endif ifeq ($(PLATFORM),) -PLATFORM := xilinx_u280_gen3x16_xdma_1_202120_1 +PLATFORM := xilinx_u280_gen3x16_xdma_1_202211_1 endif # #################### Checking if PLATFORM in whitelist ############################ @@ -97,13 +94,8 @@ LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps VPP_LDFLAGS += --optimize 2 -R 2 else ifeq ($(HOST_ARCH), aarch64) -ifeq ($(ps_on_x86), on) -CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label -LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel -else CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil -endif VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps VPP_LDFLAGS += --optimize 2 -R 2 endif @@ -111,12 +103,6 @@ CXXFLAGS += $(EXTRA_CXXFLAGS) VPP_FLAGS += $(EXTRA_VPP_FLAGS) ########################## Setting up Host Variables ########################## -ifeq ($(TARGET),sw_emu) -CXXFLAGS += -D SW_EMU_TEST -endif -ifeq ($(TARGET),hw_emu) -CXXFLAGS += -D HW_EMU_TEST -endif #Inclue Required Host Source Files ifeq ($(ps_on_x86), on) @@ -138,7 +124,7 @@ endif EXE_NAME := cscmv.exe EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) -EXE_FILE_DEPS := $(HOST_SRCS) $(EXE_FILE_DEPS) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) HOST_ARGS := $(BUILD_DIR)/cscmv.xclbin $(CUR_DIR)/data/app.bin ifneq ($(HOST_ARCH), x86) @@ -159,7 +145,7 @@ endif ######################### binary container global settings ########################## VPP_FLAGS_cscmvSeqKernel += --hls.clock 300000000:cscmvSeqKernel -ifneq ($(HOST_ARCH), x86) +ifneq ($(HOST_ARCH_temp), x86) VPP_LDFLAGS_cscmv += --clock.defaultFreqHz 300000000 else VPP_LDFLAGS_cscmv += --kernel_frequency 300 @@ -167,7 +153,7 @@ endif VPP_LDFLAGS_cscmv_temp := --config $(CUR_DIR)/conn_u280_seq.cfg --config $(CUR_DIR)/opts_seq.cfg VPP_LDFLAGS_cscmv += $(VPP_LDFLAGS_cscmv_temp) -ifeq ($(HOST_ARCH), x86) +ifneq ($(SD_CARD_NEEDED), on) BINARY_CONTAINERS += $(BUILD_DIR)/cscmv.xclbin else BINARY_CONTAINERS += $(BUILD_DIR)/cscmv_pkg.$(LINK_TARGET_FMT) @@ -186,22 +172,15 @@ $(BINARY_CONTAINERS): $(BINARY_CONTAINERS_DEPS) $(VPP) -l $(VPP_FLAGS) --temp_dir $(TEMP_DIR) --report_dir $(BUILD_REPORT_DIR)/cscmv $(VPP_LDFLAGS) $(VPP_LDFLAGS_cscmv) $(AIE_LDFLAGS) -o $@ $^ ############################## Setting Rules for Host (Building Host Executable) ############################## -ifeq ($(HOST_ARCH), x86) -$(EXE_FILE): $(EXE_FILE_DEPS) | check_xrt +$(EXE_FILE): $(EXE_FILE_DEPS) mkdir -p $(BUILD_DIR) $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) -else -$(EXE_FILE): $(EXE_FILE_DEPS) | check_sysroot - mkdir -p $(BUILD_DIR) - $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) - -endif - $(EMCONFIG): emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + ############################## Preparing sdcard folder ############################## -ifneq ($(HOST_ARCH), x86) +ifeq ($(SD_CARD_NEEDED), on) RUN_SCRIPT := $(BUILD_DIR)/run_script.sh $(RUN_SCRIPT): rm -rf $(RUN_SCRIPT) @@ -223,8 +202,8 @@ endif @echo 'fi' >> $(RUN_SCRIPT) @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) @echo 'exit $$return_code' >> $(RUN_SCRIPT) -DATA_FILE := -DATA_DIR := +DATA_FILE := $(custom_data_file) +DATA_DIR := $(custom_data_dir) SD_FILES += $(RUN_SCRIPT) SD_FILES += $(EXE_FILE) SD_FILES += $(EMCONFIG) @@ -235,7 +214,7 @@ SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) PACKAGE_FILES := $(BINARY_CONTAINERS) PACKAGE_FILES += $(AIE_CONTAINER) SD_CARD := $(CUR_DIR)/package_$(TARGET) -$(SD_CARD): $(EXE_FILE) $(BINARY_CONTAINERS) $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs @echo "Generating sd_card folder...." mkdir -p $(SD_CARD) chmod a+rx $(BUILD_DIR)/run_script.sh @@ -250,19 +229,27 @@ ifeq ($(ps_on_x86), on) @echo "### ***** running PS X86 SE_EMU ***** ###" $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 endif -#3. General Embeded flow +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow ifeq ($(dfx_hw), off) ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) @echo "### ***** sd_card generation done! ***** ###" endif endif +endif .PHONY: sd_card sd_card: $(SD_CARD) endif ############################## Setting Essential Checks and Building Rules ############################## -RUN_DEPS += $(EXE_FILE) $(BINARY_CONTAINERS) $(EMCONFIG) +RUN_DEPS += host xclbin $(EMCONFIG) RUN_DEPS += $(SD_CARD) .PHONY: mkflag all run @@ -270,17 +257,26 @@ mkflag: mkdir -p $(BUILD_DIR) rm -rf $(BUILD_DIR)/makefile_args.txt @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done -all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + run: all #hw_emu ifneq (,$(filter hw_emu, $(TARGET))) ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) else @echo $(RUN_DEPS) - $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) 2>&1 | tee $(SD_CARD)/qemu_output.log + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 endif @@ -291,17 +287,11 @@ ifeq ($(HOST_ARCH), x86) LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) -else -ifeq ($(ps_on_x86), on) - LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ - XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) - else @echo $(RUN_DEPS) - $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) 2>&1 | tee $(SD_CARD)/qemu_output.log + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 -endif endif endif #hw @@ -326,35 +316,41 @@ endif ############################## Setting Targets ############################## -.PHONY: clean cleanall emconfig +.PHONY: clean cleanall emconfig gen_instances valid_params emconfig: $(EMCONFIG) .PHONY: host ifeq ($(HOST_ARCH), x86) -host: check_xrt $(EXE_FILE) +host: check_xrt $(EXE_FILE) else -host: check_sysroot $(EXE_FILE) +host: check_sysroot $(EXE_FILE) endif .PHONY: xclbin ifeq ($(HOST_ARCH), x86) -xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) else -xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) endif +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + ############################## Cleaning Rules ############################## cleanh: - -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ - -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db cleank: -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin - -$(RMDIR) _x_temp.* + -$(RMDIR) _x_temp.* _x* $(INST_FILES) cleanall: cleanh cleank -$(RMDIR) $(BUILD_DIR) emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str - -$(RMDIR) $(CUR_DIR)/Work $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut - -$(RMDIR) + -$(RMDIR) $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) clean: cleanh \ No newline at end of file diff --git a/sparse/L2/tests/cscmvSingleHbm/utils.mk b/sparse/L2/tests/cscmvSingleHbm/utils.mk index 624f7633e1..8a4456fbde 100644 --- a/sparse/L2/tests/cscmvSingleHbm/utils.mk +++ b/sparse/L2/tests/cscmvSingleHbm/utils.mk @@ -1,5 +1,5 @@ -# -# Copyright 2019-2022 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# vitis makefile-generator v2.0.7 +# vitis makefile-generator v2.0.9 # #+------------------------------------------------------------------------------- # The following parameters are assigned with default values. These parameters can @@ -23,6 +23,9 @@ REPORT := no PROFILE := no DEBUG := no +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + #'estimate' for estimate report generation #'system' for system report generation ifneq ($(REPORT), no) @@ -40,15 +43,11 @@ ifeq ($(DEBUG), yes) VPP_LDFLAGS += --dk protocol:all:all:all endif -#Check environment setup +#Check vitis setup ifndef XILINX_VITIS XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) export XILINX_VITIS endif -ifndef XILINX_XRT - XILINX_XRT = /opt/xilinx/xrt - export XILINX_XRT -endif .PHONY: check_device check_device: @@ -70,9 +69,68 @@ check_device: then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ fi; +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name vitis < 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +ifeq (,$(XPLATFORM)) +# 2.2 as exact name vitis >= 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/base_platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.3 as a pattern vitis < 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +# 2.4 as a pattern vitis >= 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/base_platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.4 +endif # 2.3 +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + #get HOST_ARCH by PLATFORM -ifneq (,$(PLATFORM)) -HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +HOST_ARCH_temp = $(shell platforminfo -p $(XPLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') ifeq ($(HOST_ARCH_temp), x86) HOST_ARCH := x86 else ifeq ($(HOST_ARCH_temp), cortex-a9) @@ -80,14 +138,17 @@ HOST_ARCH := aarch32 else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) HOST_ARCH := aarch64 endif -endif - # Special processing for tool version/platform type VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) -# 1) for versal flow from 2022.1 -DEVICE_TYPE = $(shell platforminfo -p $(PLATFORM) | grep 'FPGA Family' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') -ifeq ($(DEVICE_TYPE), versal) +AIE_TYPE := $(shell platforminfo $(XPLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) LINK_TARGET_FMT := xsa else @@ -109,8 +170,38 @@ ifneq ($(HOST_ARCH), x86) ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) ifeq ($(TARGET), sw_emu) ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on endif #Checks for Device Family @@ -162,17 +253,8 @@ ifeq (,$(wildcard $(ROOTFS))) endif endif -#Checks for g++ -ifeq ($(HOST_ARCH), x86) -X86_CXX := on -else -ifeq ($(ps_on_x86), on) -X86_CXX := on -endif -endif - CXX := g++ -ifeq ($(X86_CXX), on) +ifeq ($(HOST_ARCH), x86) ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) CXX_VER := 8.3.0 else @@ -254,63 +336,6 @@ LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) endif endif -ifneq (,$(wildcard $(PLATFORM))) -# Use PLATFORM as a file path -XPLATFORM := $(PLATFORM) -else -# Use PLATFORM as a file name pattern -# 1. search paths specified by variable -ifneq (,$(PLATFORM_REPO_PATHS)) -# 1.1 as exact name -XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) -# 1.2 as a pattern -ifeq (,$(XPLATFORM)) -XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) -XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) -endif # 1.2 -endif # 1 -# 2. search Vitis installation -ifeq (,$(XPLATFORM)) -# 2.1 as exact name -XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) -# 2.2 as a pattern -ifeq (,$(XPLATFORM)) -XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) -XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) -endif # 2.2 -endif # 2 -# 3. search default locations -ifeq (,$(XPLATFORM)) -# 3.1 as exact name -XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) -# 3.2 as a pattern -ifeq (,$(XPLATFORM)) -XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) -XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) -endif # 3.2 -endif # 3 -endif - -define MSG_PLATFORM -No platform matched pattern '$(PLATFORM)'. -Available platforms are: $(XPLATFORMS) -To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. -endef -export MSG_PLATFORM - - -.PHONY: check_platform -check_platform: -ifeq (,$(XPLATFORM)) - @echo "$${MSG_PLATFORM}" && false -endif -#Check ends - -# device2xsa - create a filesystem friendly name from device name -# $(1) - full name of device -PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) - - # Cleaning stuff RM = rm -f RMDIR = rm -rf diff --git a/sparse/L2/tests/fp64/spmv/Makefile b/sparse/L2/tests/fp64/spmv/Makefile index a6d80b56c5..cde62b824e 100644 --- a/sparse/L2/tests/fp64/spmv/Makefile +++ b/sparse/L2/tests/fp64/spmv/Makefile @@ -1,4 +1,5 @@ -# Copyright 2019-2022 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# vitis makefile-generator v2.0.8 +# vitis makefile-generator v2.0.9 ############################## Help Section ############################## .PHONY: help @@ -35,7 +36,7 @@ help:: $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" - $(ECHO) " b. User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" $(ECHO) " export K_IMAGE=< path-to-Image-files >" $(ECHO) " export ROOTFS=< path-to-rootfs >" @@ -43,7 +44,7 @@ help:: $(ECHO) " make clean " $(ECHO) " Command to remove the generated non-hardware files." $(ECHO) "" - $(ECHO) " make cleanall" + $(ECHO) " make cleanall TARGET=" $(ECHO) " Command to remove all the generated files." $(ECHO) "" @@ -63,7 +64,7 @@ ifeq ($(PLATFORM),) PLATFORM := $(DEVICE) endif ifeq ($(PLATFORM),) -PLATFORM := xilinx_u280_gen3x16_xdma_1_202120_1 +PLATFORM := xilinx_u280_gen3x16_xdma_1_202211_1 endif # #################### Checking if PLATFORM in whitelist ############################ @@ -102,23 +103,17 @@ CXXFLAGS += $(EXTRA_CXXFLAGS) VPP_FLAGS += $(EXTRA_VPP_FLAGS) ########################## Setting up Host Variables ########################## -ifeq ($(TARGET),sw_emu) -CXXFLAGS += -D SW_EMU_TEST -endif -ifeq ($(TARGET),hw_emu) -CXXFLAGS += -D HW_EMU_TEST -endif #Inclue Required Host Source Files ifeq ($(ps_on_x86), on) HOST_SRCS += $(XFLIB_DIR)/L2/tests/fp64/spmv/main.cpp $(XFLIB_DIR)/../blas/L2/src/xcl2/xcl2.cpp CXXFLAGS += -D SPARSE_dataType=double -D SPARSE_indexType=uint16_t -D SPARSE_parEntries=4 -D SPARSE_hbmChannels=16 -D SPARSE_hbmMemBits=256 -CXXFLAGS += -I $(XFLIB_DIR)/.. -I $(XFLIB_DIR)/../blas/L2/include/xcl2 -I $(XFLIB_DIR)/L2/include/sw/fp64 -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/sw -I $(CUR_DIR)//src -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/hw +CXXFLAGS += -I $(XFLIB_DIR)/.. -I $(XFLIB_DIR)/../blas/L2/include/xcl2 -I $(XFLIB_DIR)/L2/include/sw/fp64 -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/sw -I $(CUR_DIR)/src -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/hw CXXFLAGS += -g -O0 else HOST_SRCS += $(XFLIB_DIR)/L2/tests/fp64/spmv/main.cpp $(XFLIB_DIR)/../blas/L2/src/xcl2/xcl2.cpp CXXFLAGS += -D SPARSE_dataType=double -D SPARSE_indexType=uint16_t -D SPARSE_parEntries=4 -D SPARSE_hbmChannels=16 -D SPARSE_hbmMemBits=256 -CXXFLAGS += -I $(XFLIB_DIR)/.. -I $(XFLIB_DIR)/../blas/L2/include/xcl2 -I $(XFLIB_DIR)/L2/include/sw/fp64 -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/sw -I $(CUR_DIR)//src -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/hw +CXXFLAGS += -I $(XFLIB_DIR)/.. -I $(XFLIB_DIR)/../blas/L2/include/xcl2 -I $(XFLIB_DIR)/L2/include/sw/fp64 -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/sw -I $(CUR_DIR)/src -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/L1/include/sw -I $(XFLIB_DIR)/L2/include/hw -I $(XFLIB_DIR)/L2/include/hw CXXFLAGS += -g -O0 endif @@ -129,7 +124,7 @@ endif EXE_NAME := host.exe EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) -EXE_FILE_DEPS := $(HOST_SRCS) $(EXE_FILE_DEPS) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) HOST_ARGS := $(BUILD_DIR)/spmv.xclbin $(CUR_DIR)/sig_dat $(CUR_DIR)/vec_dat nasa2910 ifneq ($(HOST_ARCH), x86) @@ -267,8 +262,8 @@ endif @echo 'fi' >> $(RUN_SCRIPT) @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) @echo 'exit $$return_code' >> $(RUN_SCRIPT) -DATA_FILE := -DATA_DIR := +DATA_FILE := $(custom_data_file) +DATA_DIR := $(custom_data_dir) SD_FILES += $(RUN_SCRIPT) SD_FILES += $(EXE_FILE) SD_FILES += $(EMCONFIG) @@ -294,13 +289,21 @@ ifeq ($(ps_on_x86), on) @echo "### ***** running PS X86 SE_EMU ***** ###" $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 endif -#3. General Embeded flow +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow ifeq ($(dfx_hw), off) ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) @echo "### ***** sd_card generation done! ***** ###" endif endif +endif .PHONY: sd_card sd_card: $(SD_CARD) @@ -321,12 +324,19 @@ run: all #hw_emu ifneq (,$(filter hw_emu, $(TARGET))) ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) else @echo $(RUN_DEPS) - $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 endif @@ -339,7 +349,7 @@ ifeq ($(HOST_ARCH), x86) else @echo $(RUN_DEPS) - $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 endif @@ -366,7 +376,7 @@ endif ############################## Setting Targets ############################## -.PHONY: clean cleanall emconfig +.PHONY: clean cleanall emconfig gen_instances valid_params emconfig: $(EMCONFIG) .PHONY: host @@ -383,18 +393,24 @@ else xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) endif +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + ############################## Cleaning Rules ############################## cleanh: - -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ - -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db cleank: -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin - -$(RMDIR) _x_temp.* + -$(RMDIR) _x_temp.* _x* $(INST_FILES) cleanall: cleanh cleank -$(RMDIR) $(BUILD_DIR) emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str - -$(RMDIR) $(CUR_DIR)/Work $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut - -$(RMDIR) + -$(RMDIR) $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) clean: cleanh \ No newline at end of file diff --git a/sparse/L2/tests/fp64/spmv/utils.mk b/sparse/L2/tests/fp64/spmv/utils.mk index 49ad0db7ef..8a4456fbde 100644 --- a/sparse/L2/tests/fp64/spmv/utils.mk +++ b/sparse/L2/tests/fp64/spmv/utils.mk @@ -1,5 +1,5 @@ -# -# Copyright 2019-2022 Xilinx, Inc. +# Copyright (C) 2019-2022, Xilinx, Inc. +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# vitis makefile-generator v2.0.8 +# vitis makefile-generator v2.0.9 # #+------------------------------------------------------------------------------- # The following parameters are assigned with default values. These parameters can @@ -23,6 +23,9 @@ REPORT := no PROFILE := no DEBUG := no +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + #'estimate' for estimate report generation #'system' for system report generation ifneq ($(REPORT), no) @@ -66,9 +69,68 @@ check_device: then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ fi; +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name vitis < 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +ifeq (,$(XPLATFORM)) +# 2.2 as exact name vitis >= 2022.2 +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/base_platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.3 as a pattern vitis < 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +# 2.4 as a pattern vitis >= 2022.2 +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/base_platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.4 +endif # 2.3 +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + #get HOST_ARCH by PLATFORM -ifneq (,$(PLATFORM)) -HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +HOST_ARCH_temp = $(shell platforminfo -p $(XPLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') ifeq ($(HOST_ARCH_temp), x86) HOST_ARCH := x86 else ifeq ($(HOST_ARCH_temp), cortex-a9) @@ -76,15 +138,17 @@ HOST_ARCH := aarch32 else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) HOST_ARCH := aarch64 endif -endif - - # Special processing for tool version/platform type VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) -# 1) for versal flow from 2022.1 -DEVICE_TYPE = $(shell platforminfo -p $(PLATFORM) | grep 'FPGA Family' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') -ifeq ($(DEVICE_TYPE), versal) +AIE_TYPE := $(shell platforminfo $(XPLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) LINK_TARGET_FMT := xsa else @@ -110,6 +174,13 @@ HOST_ARCH := x86 endif endif endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif #when x86 arch, check XRT setup ifeq ($(HOST_ARCH), x86) @@ -129,6 +200,9 @@ endif ifeq ($(ps_on_x86), on) SD_CARD_NEEDED := on endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif #Checks for Device Family ifeq ($(HOST_ARCH), aarch32) @@ -262,63 +336,6 @@ LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) endif endif -ifneq (,$(wildcard $(PLATFORM))) -# Use PLATFORM as a file path -XPLATFORM := $(PLATFORM) -else -# Use PLATFORM as a file name pattern -# 1. search paths specified by variable -ifneq (,$(PLATFORM_REPO_PATHS)) -# 1.1 as exact name -XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) -# 1.2 as a pattern -ifeq (,$(XPLATFORM)) -XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) -XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) -endif # 1.2 -endif # 1 -# 2. search Vitis installation -ifeq (,$(XPLATFORM)) -# 2.1 as exact name -XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) -# 2.2 as a pattern -ifeq (,$(XPLATFORM)) -XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) -XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) -endif # 2.2 -endif # 2 -# 3. search default locations -ifeq (,$(XPLATFORM)) -# 3.1 as exact name -XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) -# 3.2 as a pattern -ifeq (,$(XPLATFORM)) -XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) -XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) -endif # 3.2 -endif # 3 -endif - -define MSG_PLATFORM -No platform matched pattern '$(PLATFORM)'. -Available platforms are: $(XPLATFORMS) -To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. -endef -export MSG_PLATFORM - - -.PHONY: check_platform -check_platform: -ifeq (,$(XPLATFORM)) - @echo "$${MSG_PLATFORM}" && false -endif -#Check ends - -# device2xsa - create a filesystem friendly name from device name -# $(1) - full name of device -PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) - - # Cleaning stuff RM = rm -f RMDIR = rm -rf