Skip to content

Commit 4496e21

Browse files
SDA USRsdausr
authored and
GitHub Enterprise
committed
Squashed 'sparse' changes from 1b75f16..cf4065d (#729)
cf4065d Merge pull request #123 from RepoOps/update_readme_5 4890779 update README fa29498 update README 61c2cb5 Merge pull request #119 from RepoOps/update_doc_url_3 b871455 fix url 2f7fb05 Merge pull request #122 from tuol/cr_1142093_2 59cf572 fix input of cscmv de579fa Merge pull request #121 from tuol/cr_1140416 c00a509 update makefile and description.json for L2_tests_fp64_spmv 0a0771e update url and branch in doc a69541e Merge pull request #118 from tuol/fix_version dfc5cb7 update version to 2022.2 Co-authored-by: sdausr <[email protected]>
1 parent 57d75cc commit 4496e21

File tree

13 files changed

+511
-239
lines changed

13 files changed

+511
-239
lines changed

sparse/L2/benchmarks/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ We provide a benchmark for the SpMV function of the Vitis SPARSE library. The be
77
### Vitis SPARSE Library
88
- Alveo U280 installed and configured as per https://www.xilinx.com/products/boards-and-kits/alveo/u280.html#gettingStarted (when running hardware)
99
- Xilinx runtime (XRT) installed
10-
- Xilinx Vitis 2021.1 installed and configured
10+
- Xilinx Vitis 2022.2 installed and configured
1111

1212
### Python3
13-
Follow the steps as per https://xilinx.github.io/Vitis_Libraries/blas/2020.2/user_guide/L1/pyenvguide.html to set up Python3 environment.
13+
Follow the steps as per https://docs.xilinx.com/r/en-US/Vitis_Libraries/blas/user_guide/L1/pyenvguide.html to set up Python3 environment.
1414

1515
### Datasets
1616
- Datasets from https://sparse.tamu.edu/ will be downloaded during benchmarking process
@@ -47,12 +47,12 @@ Table 1 Datasets for benchmarking
4747

4848
### Download code
4949

50-
The sparse benchmark can be downloaded from [vitis libraries](https://github.com/Xilinx/Vitis_Libraries.git) ``master`` branch.
50+
The sparse benchmark can be downloaded from [vitis libraries](https://github.com/Xilinx/Vitis_Libraries.git) ``main`` branch.
5151

5252
```
5353
git clone https://github.com/Xilinx/Vitis_Libraries.git
5454
cd Vitis_Libraries
55-
git checkout master
55+
git checkout main
5656
cd sparse/L2/benchmarks/spmv_double
5757
```
5858

@@ -61,7 +61,7 @@ The sparse benchmark can be downloaded from [vitis libraries](https://github.com
6161
Setup hardware build and run envrionment using the Vitis and XRT scripts:
6262

6363
```
64-
source <install path>/Vitis/2021.1/settings64.sh
64+
source <install path>/Vitis/2022.1/settings64.sh
6565
source /opt/xilinx/xrt/setup.sh
6666
```
6767

sparse/L2/tests/cscmv/data/app.bin

-667 KB
Binary file not shown.

sparse/L2/tests/cscmv/data/inVec.bin

192 Bytes
Binary file not shown.

sparse/L2/tests/cscmv/data/outVec.bin

192 Bytes
Binary file not shown.

sparse/L2/tests/fp64/spmv/Makefile

+297-170
Large diffs are not rendered by default.

sparse/L2/tests/fp64/spmv/description.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@
3737
"includepaths": [
3838
"LIB_DIR/..",
3939
"LIB_DIR/../blas/L2/include/xcl2",
40-
"LIB_DIR/L2/include/sw/fp64"
40+
"LIB_DIR/L2/include/sw/fp64",
41+
"LIB_DIR/L1/include/hw",
42+
"LIB_DIR/L1/include/sw",
43+
"LIB_DIR/L2/include/hw",
44+
"LIB_DIR/L2/include/sw",
45+
"PROJECT/src"
4146
],
4247
"symbols": [
4348
"SPARSE_dataType=double",
@@ -67,6 +72,11 @@
6772
"LIB_DIR/L1/include/hw/",
6873
"LIB_DIR/L2/include/hw/fp64",
6974
"LIB_DIR/..",
75+
"LIB_DIR/../blas/L1/include/hw",
76+
"LIB_DIR/L1/include/hw",
77+
"LIB_DIR/L1/include/sw",
78+
"LIB_DIR/L2/include/hw",
79+
"LIB_DIR/L2/include/sw",
7080
"LIB_DIR/../blas/L1/include/hw"
7181
]
7282
}

sparse/L2/tests/fp64/spmv/utils.mk

+158-44
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2019-2020 Xilinx, Inc.
2+
# Copyright 2019-2022 Xilinx, Inc.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -12,6 +12,7 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15+
# vitis makefile-generator v2.0.8
1516
#
1617
#+-------------------------------------------------------------------------------
1718
# The following parameters are assigned with default values. These parameters can
@@ -25,29 +26,109 @@ DEBUG := no
2526
#'estimate' for estimate report generation
2627
#'system' for system report generation
2728
ifneq ($(REPORT), no)
28-
LDCLFLAGS += --report estimate
29-
LDCLFLAGS += --report system
29+
VPP_LDFLAGS += --report estimate
30+
VPP_LDFLAGS += --report system
3031
endif
3132

3233
#Generates profile summary report
3334
ifeq ($(PROFILE), yes)
34-
LDCLFLAGS += --profile_kernel data:all:all:all
35+
VPP_LDFLAGS += --profile_kernel data:all:all:all
3536
endif
3637

3738
#Generates debug summary report
3839
ifeq ($(DEBUG), yes)
39-
LDCLFLAGS += --dk protocol:all:all:all
40+
VPP_LDFLAGS += --dk protocol:all:all:all
4041
endif
4142

42-
#Check environment setup
43+
#Check vitis setup
4344
ifndef XILINX_VITIS
4445
XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION)
4546
export XILINX_VITIS
4647
endif
48+
49+
.PHONY: check_device
50+
check_device:
51+
@set -eu; \
52+
inallowlist=False; \
53+
inblocklist=False; \
54+
for dev in $(PLATFORM_ALLOWLIST); \
55+
do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \
56+
then inallowlist=True; fi; \
57+
done ;\
58+
for dev in $(PLATFORM_BLOCKLIST); \
59+
do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \
60+
then inblocklist=True; fi; \
61+
done ;\
62+
if [[ $$inallowlist == False ]]; \
63+
then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \
64+
fi; \
65+
if [[ $$inblocklist == True ]]; \
66+
then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\
67+
fi;
68+
69+
#get HOST_ARCH by PLATFORM
70+
ifneq (,$(PLATFORM))
71+
HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//')
72+
ifeq ($(HOST_ARCH_temp), x86)
73+
HOST_ARCH := x86
74+
else ifeq ($(HOST_ARCH_temp), cortex-a9)
75+
HOST_ARCH := aarch32
76+
else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp)))
77+
HOST_ARCH := aarch64
78+
endif
79+
endif
80+
81+
82+
83+
# Special processing for tool version/platform type
84+
VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1)
85+
# 1) for versal flow from 2022.1
86+
DEVICE_TYPE = $(shell platforminfo -p $(PLATFORM) | grep 'FPGA Family' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//')
87+
ifeq ($(DEVICE_TYPE), versal)
88+
ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1)
89+
LINK_TARGET_FMT := xsa
90+
else
91+
LINK_TARGET_FMT := xclbin
92+
endif
93+
else
94+
LINK_TARGET_FMT := xclbin
95+
endif
96+
# 2) dfx flow
97+
dfx_hw := off
98+
ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_)
99+
ifeq ($(TARGET),hw)
100+
dfx_hw := on
101+
endif
102+
endif
103+
# 3) for embeded sw_emu flow from 2022.2
104+
ps_on_x86 := off
105+
ifneq ($(HOST_ARCH), x86)
106+
ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1)
107+
ifeq ($(TARGET), sw_emu)
108+
ps_on_x86 := on
109+
HOST_ARCH := x86
110+
endif
111+
endif
112+
endif
113+
114+
#when x86 arch, check XRT setup
115+
ifeq ($(HOST_ARCH), x86)
47116
ifndef XILINX_XRT
48117
XILINX_XRT = /opt/xilinx/xrt
49118
export XILINX_XRT
50119
endif
120+
endif
121+
122+
#check if need sd_card
123+
ifeq ($(HOST_ARCH), aarch32)
124+
SD_CARD_NEEDED := on
125+
endif
126+
ifeq ($(HOST_ARCH), aarch64)
127+
SD_CARD_NEEDED := on
128+
endif
129+
ifeq ($(ps_on_x86), on)
130+
SD_CARD_NEEDED := on
131+
endif
51132

52133
#Checks for Device Family
53134
ifeq ($(HOST_ARCH), aarch32)
@@ -56,24 +137,49 @@ else ifeq ($(HOST_ARCH), aarch64)
56137
DEV_FAM = Ultrascale
57138
endif
58139

59-
B_NAME = $(shell dirname $(XPLATFORM))
60-
61140
#Checks for Correct architecture
62141
ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86))
63142
$(error HOST_ARCH variable not set, please set correctly and rerun)
64143
endif
65144

66-
#Checks for SYSROOT
145+
.PHONY: check_version check_sysroot check_kimage check_rootfs
146+
check_version:
147+
ifneq (, $(shell which git))
148+
ifneq (,$(wildcard $(XFLIB_DIR)/.git))
149+
@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 -
150+
endif
151+
endif
152+
153+
#Set/Check SYSROOT/K_IMAGE/ROOTFS
154+
ifneq ($(HOST_ARCH), x86)
155+
ifneq (,$(findstring zc706, $(PLATFORM_NAME)))
156+
K_IMAGE ?= $(SYSROOT)/../../uImage
157+
else
158+
K_IMAGE ?= $(SYSROOT)/../../Image
159+
endif
160+
ROOTFS ?= $(SYSROOT)/../../rootfs.ext4
161+
endif
162+
67163
check_sysroot:
68164
ifneq ($(HOST_ARCH), x86)
69-
ifndef SYSROOT
165+
ifeq (,$(wildcard $(SYSROOT)))
70166
$(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun)
71167
endif
72168
endif
169+
check_kimage:
170+
ifneq ($(HOST_ARCH), x86)
171+
ifeq (,$(wildcard $(K_IMAGE)))
172+
$(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun)
173+
endif
174+
endif
175+
check_rootfs:
176+
ifneq ($(HOST_ARCH), x86)
177+
ifeq (,$(wildcard $(ROOTFS)))
178+
$(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun)
179+
endif
180+
endif
73181

74-
#Checks for g++
75182
CXX := g++
76-
VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1)
77183
ifeq ($(HOST_ARCH), x86)
78184
ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1)
79185
CXX_VER := 8.3.0
@@ -94,16 +200,40 @@ endif
94200
$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX))
95201
endif
96202
endif
97-
else ifeq ($(HOST_ARCH), aarch64)
203+
else
204+
ifeq ($(HOST_ARCH), aarch64)
98205
CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++
99206
else ifeq ($(HOST_ARCH), aarch32)
100207
CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++
101208
endif
209+
endif
210+
211+
#Check OS and setting env for xrt c++ api
212+
OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' )
213+
OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t')
214+
215+
# for centos and redhat
216+
ifneq ($(findstring centos,$(OSDIST)),)
217+
ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' ))
218+
ifeq ($(HOST_ARCH), x86)
219+
XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0
220+
endif
221+
endif
222+
else ifneq ($(findstring redhat,$(OSDIST)),)
223+
ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' ))
224+
ifeq ($(HOST_ARCH), x86)
225+
XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0
226+
endif
227+
endif
228+
endif
102229

103230
#Setting VPP
104231
VPP := v++
105232

106233
#Cheks for aiecompiler
234+
AIECXX := aiecompiler
235+
AIESIMULATOR := aiesimulator
236+
X86SIMULATOR := x86simulator
107237

108238
.PHONY: check_vivado
109239
check_vivado:
@@ -124,80 +254,70 @@ ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so))
124254
endif
125255

126256
export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH)
257+
ifeq ($(HOST_ARCH), x86)
127258
ifeq (,$(LD_LIBRARY_PATH))
128259
LD_LIBRARY_PATH := $(XILINX_XRT)/lib
129260
else
130261
LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH)
131262
endif
132-
133-
# check target
134-
ifeq ($(filter $(TARGET),sw_emu hw_emu hw),)
135-
$(error TARGET is not sw_emu, hw_emu or hw)
136263
endif
137264

138-
ifneq (,$(wildcard $(DEVICE)))
139-
# Use DEVICE as a file path
140-
XPLATFORM := $(DEVICE)
265+
ifneq (,$(wildcard $(PLATFORM)))
266+
# Use PLATFORM as a file path
267+
XPLATFORM := $(PLATFORM)
141268
else
142-
# Use DEVICE as a file name pattern
269+
# Use PLATFORM as a file name pattern
143270
# 1. search paths specified by variable
144271
ifneq (,$(PLATFORM_REPO_PATHS))
145272
# 1.1 as exact name
146-
XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(DEVICE)/$(DEVICE).xpfm)))
273+
XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm)))
147274
# 1.2 as a pattern
148275
ifeq (,$(XPLATFORM))
149276
XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm))
150-
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE)/')))
277+
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/')))
151278
endif # 1.2
152279
endif # 1
153280
# 2. search Vitis installation
154281
ifeq (,$(XPLATFORM))
155282
# 2.1 as exact name
156-
XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(DEVICE)/$(DEVICE).xpfm))
283+
XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm))
157284
# 2.2 as a pattern
158285
ifeq (,$(XPLATFORM))
159286
XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm)
160-
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE)/')))
287+
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/')))
161288
endif # 2.2
162289
endif # 2
163290
# 3. search default locations
164291
ifeq (,$(XPLATFORM))
165292
# 3.1 as exact name
166-
XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(DEVICE)/$(DEVICE).xpfm))
293+
XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm))
167294
# 3.2 as a pattern
168295
ifeq (,$(XPLATFORM))
169296
XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm)
170-
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE)/')))
297+
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/')))
171298
endif # 3.2
172299
endif # 3
173300
endif
174301

175302
define MSG_PLATFORM
176-
No platform matched pattern '$(DEVICE)'.
303+
No platform matched pattern '$(PLATFORM)'.
177304
Available platforms are: $(XPLATFORMS)
178-
To add more platform directories, set the PLATFORM_REPO_PATHS variable or point DEVICE variable to the full path of platform .xpfm file.
305+
To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file.
179306
endef
180307
export MSG_PLATFORM
181308

182-
define MSG_DEVICE
183-
More than one platform matched: $(XPLATFORM)
184-
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.
185-
endef
186-
export MSG_DEVICE
187309

188310
.PHONY: check_platform
189311
check_platform:
190312
ifeq (,$(XPLATFORM))
191313
@echo "$${MSG_PLATFORM}" && false
192314
endif
193-
ifneq (,$(word 2,$(XPLATFORM)))
194-
@echo "$${MSG_DEVICE}" && false
195-
endif
196315
#Check ends
197316

198317
# device2xsa - create a filesystem friendly name from device name
199318
# $(1) - full name of device
200-
device2xsa = $(strip $(patsubst %.xpfm, % , $(shell basename $(DEVICE))))
319+
PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM))))
320+
201321

202322
# Cleaning stuff
203323
RM = rm -f
@@ -206,9 +326,3 @@ RMDIR = rm -rf
206326
MV = mv -f
207327
CP = cp -rf
208328
ECHO:= @echo
209-
ifneq (,$(shell echo $(XPLATFORM) | awk '/xilinx_u280_xdma_201920_3/'))
210-
VPP_FLAGS += --advanced.param compiler.ignorePlatformCompatibilityCheck=true
211-
ifeq ($(TARGET), hw)
212-
VPP_LDFLAGS += --advanced.param compiler.userPreSysLinkOverlayTcl=preSysLink.tcl
213-
endif
214-
endif

0 commit comments

Comments
 (0)