forked from Xilinx/XRT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HIP tests for GPU and other build improvements (Xilinx#8008)
* Added makefiles to exercise HIP tests on GPU Signed-off-by: Sonal Santan <[email protected]> * Add a switch to enable(default)/disable bundling of Alveo drivers with XRT Fix a build failure on Ubuntu 23.10 due to an illegal std::move of a temporary object returned by create_profiling_event() Signed-off-by: Sonal Santan <[email protected]> * Add check for optional alveo driver install in postinst script Signed-off-by: Sonal Santan <[email protected]> * Update copyright notice to include 2024 Signed-off-by: Sonal Santan <[email protected]> * When Alveo is disabled do not bundle ERT firmware and xbflash2 Signed-off-by: Sonal Santan <[email protected]> * Fix build error Signed-off-by: Sonal Santan <[email protected]> --------- Signed-off-by: Sonal Santan <[email protected]>
- Loading branch information
Showing
8 changed files
with
144 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# SPDX-License-Identifier: Apache License 2.0 # | ||
# Copyright (c) 2021-2022 Xilinx, Inc. All rights reserved # | ||
# Copyright (C) 2022-2024 Advanced Micro Devices, Inc. # | ||
|
||
ROCM_ROOT = /opt/rocm | ||
SRC = main.cpp | ||
OBJ = main.o | ||
HIPCC = $(ROCM_ROOT)/bin/hipcc | ||
HIPCCFLAGS= --rocm-device-lib-path=/usr/lib/x86_64-linux-gnu/amdgcn/bitcode | ||
CXX = g++ | ||
CC = g++ | ||
CXXFLAGS = -Wall -Werror -D__HIP_PLATFORM_HCC__= -D__HIP_PLATFORM_AMD__ -I$(ROCM_ROOT)/include -I$(ROCM_ROOT)/llvm/bin/../lib/clang/14.0.0 -I$(ROCM_ROOT)/hsa/include | ||
RPROF = $(ROCM_ROOT)/rocprof | ||
LDFLAGS = -L$(ROCM_ROOT)/hip/lib | ||
LDLIBS = -lamdhip64 -luuid -lm -lrt | ||
COMPILE_DB = compile_commands.json | ||
|
||
export LD_LIBRARY_PATH += :$(ROCM_ROOT)/hip/lib | ||
|
||
debug ?= 0 | ||
ifeq ($(debug), 1) | ||
CXXFLAGS +=-DDEBUG -g | ||
else | ||
CXXFLAGS +=-DNDEBUG -O2 | ||
endif | ||
|
||
all: main kernel.co nop.co | ||
|
||
main: main.o | ||
|
||
%.co: %.cpp | ||
$(HIPCC) $(HIPCCFLAGS) --genco $< -o $@ | ||
|
||
run: all | ||
@echo "LD_LIBRARY_PATH = $(LD_LIBRARY_PATH)" | ||
./main | ||
|
||
|
||
profile: all | ||
$(RPROF) --hip-trace ./main | ||
$(RPROF) --hsa-trace ./main | ||
jq '.traceEvents[] | .name' results.json | sort | uniq | ||
strace -e trace=ioctl -o strace.log ./main | ||
grep AMDKFD strace.log | awk '-F,' '{print $$2}' | sort | uniq | ||
|
||
$(COMPILE_DB): main.cpp kernel.cpp nop.cpp Makefile | ||
bear -- make debug=1 all | ||
|
||
compdb: $(COMPILE_DB) | ||
|
||
clean: | ||
rm -f main *.co results.* *.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# SPDX-License-Identifier: Apache License 2.0 # | ||
# Copyright (c) 2021-2022 Xilinx, Inc. All rights reserved # | ||
# Copyright (C) 2022-2024 Advanced Micro Devices, Inc. # | ||
|
||
ROCM_ROOT = /opt/rocm | ||
SRC = main.cpp | ||
OBJ = main.o | ||
HIPCC = $(ROCM_ROOT)/bin/hipcc | ||
HIPCCFLAGS= --rocm-device-lib-path=/usr/lib/x86_64-linux-gnu/amdgcn/bitcode | ||
CXX = g++ | ||
CC = g++ | ||
CXXFLAGS = -Wall -Werror -D__HIP_PLATFORM_HCC__= -D__HIP_PLATFORM_AMD__ -I$(ROCM_ROOT)/include -I$(ROCM_ROOT)/llvm/bin/../lib/clang/14.0.0 -I$(ROCM_ROOT)/hsa/include | ||
RPROF = $(ROCM_ROOT)/rocprof | ||
LDFLAGS = -L$(ROCM_ROOT)/hip/lib | ||
LDLIBS = -lamdhip64 -luuid -lm -lrt | ||
COMPILE_DB = compile_commands.json | ||
|
||
export LD_LIBRARY_PATH += :$(ROCM_ROOT)/hip/lib | ||
|
||
debug ?= 0 | ||
ifeq ($(debug), 1) | ||
CXXFLAGS +=-DDEBUG -g | ||
else | ||
CXXFLAGS +=-DNDEBUG -O2 | ||
endif | ||
|
||
all: main kernel.co nop.co | ||
|
||
main: main.o | ||
|
||
%.co: %.cpp | ||
$(HIPCC) $(HIPCCFLAGS) --genco $< -o $@ | ||
|
||
run: all | ||
@echo "LD_LIBRARY_PATH = $(LD_LIBRARY_PATH)" | ||
./main | ||
|
||
|
||
profile: all | ||
$(RPROF) --hip-trace ./main | ||
$(RPROF) --hsa-trace ./main | ||
jq '.traceEvents[] | .name' results.json | sort | uniq | ||
strace -e trace=ioctl -o strace.log ./main | ||
grep AMDKFD strace.log | awk '-F,' '{print $$2}' | sort | uniq | ||
|
||
$(COMPILE_DB): main.cpp kernel.cpp nop.cpp Makefile | ||
bear -- make debug=1 all | ||
|
||
compdb: $(COMPILE_DB) | ||
|
||
clean: | ||
rm -f main *.co results.* *.o |