Skip to content

Commit

Permalink
Squashed 'sparse' changes from 1b75f16..cf4065d (#729)
Browse files Browse the repository at this point in the history
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 <sdausr@xilinx.com>
  • Loading branch information
2 people authored and GitHub Enterprise committed Oct 20, 2022
1 parent 57d75cc commit 4496e21
Show file tree
Hide file tree
Showing 13 changed files with 511 additions and 239 deletions.
10 changes: 5 additions & 5 deletions sparse/L2/benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ We provide a benchmark for the SpMV function of the Vitis SPARSE library. The be
### Vitis SPARSE Library
- Alveo U280 installed and configured as per https://www.xilinx.com/products/boards-and-kits/alveo/u280.html#gettingStarted (when running hardware)
- Xilinx runtime (XRT) installed
- Xilinx Vitis 2021.1 installed and configured
- Xilinx Vitis 2022.2 installed and configured

### Python3
Follow the steps as per https://xilinx.github.io/Vitis_Libraries/blas/2020.2/user_guide/L1/pyenvguide.html to set up Python3 environment.
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.

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

### Download code

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

```
git clone https://github.com/Xilinx/Vitis_Libraries.git
cd Vitis_Libraries
git checkout master
git checkout main
cd sparse/L2/benchmarks/spmv_double
```

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

```
source <install path>/Vitis/2021.1/settings64.sh
source <install path>/Vitis/2022.1/settings64.sh
source /opt/xilinx/xrt/setup.sh
```

Expand Down
Binary file modified sparse/L2/tests/cscmv/data/app.bin
Binary file not shown.
Binary file added sparse/L2/tests/cscmv/data/inVec.bin
Binary file not shown.
Binary file added sparse/L2/tests/cscmv/data/outVec.bin
Binary file not shown.
467 changes: 297 additions & 170 deletions sparse/L2/tests/fp64/spmv/Makefile

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion sparse/L2/tests/fp64/spmv/description.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@
"includepaths": [
"LIB_DIR/..",
"LIB_DIR/../blas/L2/include/xcl2",
"LIB_DIR/L2/include/sw/fp64"
"LIB_DIR/L2/include/sw/fp64",
"LIB_DIR/L1/include/hw",
"LIB_DIR/L1/include/sw",
"LIB_DIR/L2/include/hw",
"LIB_DIR/L2/include/sw",
"PROJECT/src"
],
"symbols": [
"SPARSE_dataType=double",
Expand Down Expand Up @@ -67,6 +72,11 @@
"LIB_DIR/L1/include/hw/",
"LIB_DIR/L2/include/hw/fp64",
"LIB_DIR/..",
"LIB_DIR/../blas/L1/include/hw",
"LIB_DIR/L1/include/hw",
"LIB_DIR/L1/include/sw",
"LIB_DIR/L2/include/hw",
"LIB_DIR/L2/include/sw",
"LIB_DIR/../blas/L1/include/hw"
]
}
Expand Down
202 changes: 158 additions & 44 deletions sparse/L2/tests/fp64/spmv/utils.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2019-2020 Xilinx, Inc.
# Copyright 2019-2022 Xilinx, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -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.8
#
#+-------------------------------------------------------------------------------
# The following parameters are assigned with default values. These parameters can
Expand All @@ -25,29 +26,109 @@ DEBUG := no
#'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;

#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:]]*//')
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
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)
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

#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

#Checks for Device Family
ifeq ($(HOST_ARCH), aarch32)
Expand All @@ -56,24 +137,49 @@ 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++
VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1)
ifeq ($(HOST_ARCH), x86)
ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1)
CXX_VER := 8.3.0
Expand All @@ -94,16 +200,40 @@ endif
$(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:
Expand All @@ -124,80 +254,70 @@ 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)
ifneq (,$(wildcard $(PLATFORM)))
# Use PLATFORM as a file path
XPLATFORM := $(PLATFORM)
else
# Use DEVICE as a file name pattern
# 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)/$(DEVICE)/$(DEVICE).xpfm)))
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 ~ /$(DEVICE)/')))
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/$(DEVICE)/$(DEVICE).xpfm))
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 ~ /$(DEVICE)/')))
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/$(DEVICE)/$(DEVICE).xpfm))
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 ~ /$(DEVICE)/')))
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/')))
endif # 3.2
endif # 3
endif

define MSG_PLATFORM
No platform matched pattern '$(DEVICE)'.
No platform matched pattern '$(PLATFORM)'.
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.
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

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))))
PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM))))


# Cleaning stuff
RM = rm -f
Expand All @@ -206,9 +326,3 @@ RMDIR = rm -rf
MV = mv -f
CP = cp -rf
ECHO:= @echo
ifneq (,$(shell echo $(XPLATFORM) | awk '/xilinx_u280_xdma_201920_3/'))
VPP_FLAGS += --advanced.param compiler.ignorePlatformCompatibilityCheck=true
ifeq ($(TARGET), hw)
VPP_LDFLAGS += --advanced.param compiler.userPreSysLinkOverlayTcl=preSysLink.tcl
endif
endif
Loading

0 comments on commit 4496e21

Please sign in to comment.