Merge pull request #4512 from ammallya/main

Reverting rbt and clr
This commit is contained in:
ammallya
2025-03-18 11:27:49 -07:00
committed by GitHub
2 changed files with 18 additions and 97 deletions

View File

@@ -10,8 +10,6 @@ printUsage() {
echo " -r, --release Make a release build instead of a debug build"
echo " -a, --address_sanitizer Enable address sanitizer"
echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) "
echo " -w, --wheel Creates python wheel package of hip-on-rocclr.
It needs to be used along with -r option"
echo " -o, --outdir <pkg_type> Print path of output directory containing packages of type referred to by pkg_type"
echo " -t, --offload-arch=<arch> Specify arch for catch tests ex: --offload-arch=gfx1030 --offload-arch=gfx1100"
echo " -p, --package <type> Specify packaging format"
@@ -27,6 +25,7 @@ printUsage() {
source "$(dirname "${BASH_SOURCE}")/compute_utils.sh"
MAKEOPTS="$DASH_JAY"
PROJ_NAME="hip-on-rocclr"
BUILD_PATH="$(getBuildPath $PROJ_NAME)"
TARGET="build"
@@ -37,6 +36,7 @@ PACKAGE_RPM="$PACKAGE_ROOT/rpm/$PROJ_NAME"
PREFIX_PATH="$PACKAGE_ROOT"
CORE_BUILD_DIR="$(getBuildPath hsa-core)"
ROCclr_BUILD_DIR="$(getBuildPath rocclr)"
HIPCC_BUILD_DIR="$(getBuildPath hipcc)"
CATCH_BUILD_DIR="$(getBuildPath catch)"
CATCH_SRC="$HIP_CATCH_TESTS_ROOT/catch"
SAMPLES_SRC="$HIP_CATCH_TESTS_ROOT/samples"
@@ -53,10 +53,9 @@ MAKETARGET="deb"
PKGTYPE="deb"
OFFLOAD_ARCH=()
DEFAULT_OFFLOAD_ARCH=(gfx900 gfx906 gfx908 gfx90a gfx942 gfx1030 gfx1031 gfx1033 gfx1034 gfx1035 gfx1100 gfx1101 gfx1102 gfx1103 gfx1150 gfx1151 gfx1200 gfx1201)
DEFAULT_OFFLOAD_ARCH=(gfx900 gfx906 gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1031 gfx1033 gfx1034 gfx1035 gfx1100 gfx1101 gfx1102 gfx1200 gfx1201)
#parse the arguments
VALID_STR=`getopt -o hcraswt:o: --long help,clean,release,address_sanitizer,static,wheel,offload-arch=:,outdir: -- "$@"`
VALID_STR=`getopt -o hcrast:o: --long help,clean,release,address_sanitizer,static,offload-arch=:,outdir: -- "$@"`
eval set -- "$VALID_STR"
while true ;
@@ -73,13 +72,11 @@ do
set_address_sanitizer_on ; shift ;;
(-s | --static)
SHARED_LIBS="OFF" ; shift ;;
(-w | --wheel)
WHEEL_PACKAGE=true ; shift ;;
(-t | --offload-arch=)
OFFLOAD_ARCH+=( "$2" ); ((CLEAN_OR_OUT|=2)); shift 2 ;;
(-o | --outdir)
TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;;
--) shift; break;; # end delimiter
--) shift; break;;
(*)
echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;;
@@ -101,10 +98,7 @@ if [ $RET_CONFLICT -ge 30 ]; then
exit $RET_CONFLICT
fi
clean_hip_on_rocclr() {
# Delete cmake output directory
rm -rf "$BUILD_PATH"
rm -rf "$PACKAGE_DEB"
rm -rf "$PACKAGE_RPM"
@@ -112,23 +106,17 @@ clean_hip_on_rocclr() {
}
build_hip_on_rocclr() {
# TODO This if condition is a temporary workaround so that mainline builds dont error out
# until build migrated from hipamd to clr repo
if [ -e "$CLR_ROOT/CMakeLists.txt" ]; then
# We are in a branch that has migrated to clr repo
_HIP_CMAKELIST_DIR="$CLR_ROOT"
_HIP_CMAKELIST_OPT="-DCLR_BUILD_HIP=ON -DCLR_BUILD_OCL=OFF"
if [ -e "$HIPOTHER_ROOT/hipnv" ]; then
# We are in a branch that has hipnv headers migrated
_HIP_CMAKELIST_OPT="$_HIP_CMAKELIST_OPT -DHIPNV_DIR=$HIPOTHER_ROOT/hipnv"
fi
elif [ ! -e "$HIPAMD_ROOT/CMakeLists.txt" ]; then
# We seem to have hit a branch in which both the old and the new repo don't exist
echo "No $HIPAMD_ROOT/CMakeLists.txt file, skipping hip on rocclr" >&2
echo "No $HIPAMD_ROOT/CMakeLists.txt file, skipping hip on rocclr"
exit 0 # This is not an error
exit 0
else
# We are in a branch that has not yet migrated to clr repo yet
_HIP_CMAKELIST_DIR="$HIPAMD_ROOT"
_HIP_CMAKELIST_OPT=""
fi
@@ -137,7 +125,6 @@ build_hip_on_rocclr() {
mkdir -p "$BUILD_PATH"
pushd "$BUILD_PATH"
# FIXME: Remove -DROCclr_DIR/LIBROCclr_STATIC_DIR
if [ ! -e Makefile ]; then
echo "Building HIP-On-ROCclr CMake environment"
print_lib_type $SHARED_LIBS
@@ -153,7 +140,7 @@ build_hip_on_rocclr() {
-DCMAKE_SKIP_BUILD_RPATH=TRUE \
-DCPACK_INSTALL_PREFIX="$ROCM_INSTALL_PATH" \
-DROCM_PATH="$ROCM_INSTALL_PATH" \
-DHIPCC_BIN_DIR="$ROCM_PATH/bin" \
-DHIPCC_BIN_DIR="$HIPCC_BUILD_DIR" \
-DHIP_CATCH_TEST=1 \
$_HIP_CMAKELIST_OPT \
"$_HIP_CMAKELIST_DIR"
@@ -178,13 +165,8 @@ build_catch_tests() {
rm -rf "$CATCH_BUILD_DIR"
mkdir -p "$CATCH_BUILD_DIR"
pushd "$CATCH_BUILD_DIR"
# use the newly built hip as HIP for catch
export HIP_PATH="$ROCM_INSTALL_PATH"
export ROCM_PATH="$ROCM_INSTALL_PATH"
# Note: The rocm_common_cmake_params will provide CMAKE_EXE_LINKER_FLAGS_INIT
# for binaries located in /opt/rocm/bin
# hip-catch binaries are located in each test folder under /opt/rocm/share/hip/catch_test/
# Append the EXE LINKER flags with ROCm library path
cmake \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DBUILD_SHARED_LIBS=$SHARED_LIBS \
@@ -195,7 +177,6 @@ build_catch_tests() {
$(rocm_common_cmake_params) \
-DCPACK_RPM_DEBUGINFO_PACKAGE=FALSE \
-DCPACK_DEBIAN_DEBUGINFO_PACKAGE=FALSE \
-DCMAKE_EXE_LINKER_FLAGS_INIT=-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ROCM_EXE_RPATH:$ROCM_INSTALL_PATH/lib:/opt/rocm/lib \
-DCPACK_INSTALL_PREFIX="$ROCM_INSTALL_PATH" \
"$CATCH_SRC"
@@ -209,7 +190,6 @@ build_catch_tests() {
}
package_samples() {
# TODO: To be removed once the issue related to ASAN builds are fixed
if [ "$ASAN_CMAKE_PARAMS" == "true" ] ; then
echo "Disable the packaging of HIP samples" >&2
return
@@ -218,17 +198,13 @@ package_samples() {
if [ ! -e "$SAMPLES_SRC/CMakeLists.txt" ]; then
echo "HIP samples source not found at: $SAMPLES_SRC" >&2
echo "Using samples package from hip project: $BUILD_PATH" >&2
# TODO: change to return failure after hip-tests samples change is available in mainline
return
fi
# package samples
rm -rf "$SAMPLES_BUILD_DIR"
mkdir -p "$SAMPLES_BUILD_DIR"
pushd "$SAMPLES_BUILD_DIR"
# The cmake path is different for asan and non-asan builds.
# Fetch after getting build type. Default will be non-asan build
local CMAKE_PATH="$(getCmakePath)"
# use the newly built hip as HIP for samples
export HIP_PATH="$ROCM_INSTALL_PATH"
export ROCM_PATH="$ROCM_INSTALL_PATH"
cmake \
@@ -315,24 +291,10 @@ print_output_directory() {
}
case $TARGET in
(clean)
clean_hip_on_rocclr
clean_hip_tests
;;
(build)
build_hip_on_rocclr
build_catch_tests
package_hip_on_rocclr
package_samples
build_wheel "$BUILD_PATH" "$PROJ_NAME"
copy_hip_tests
;;
(outdir)
print_output_directory
;;
(*)
die "Invalid target $TARGET"
;;
(clean) clean_hip_on_rocclr; clean_hip_tests ;;
(build) build_hip_on_rocclr; build_catch_tests; package_hip_on_rocclr; package_samples; copy_hip_tests;;
(outdir) print_output_directory ;;
(*) die "Invalid target $TARGET" ;;
esac
echo "Operation complete"

View File

@@ -12,8 +12,6 @@ printUsage() {
echo " -p, --package <type> Specify packaging format"
echo " -r, --release Make a release build instead of a debug build"
echo " -a, --address_sanitizer Enable address sanitizer"
echo " -w, --wheel Creates python wheel package of bandwidth test.
It needs to be used along with -r option"
echo " -o, --outdir <pkg_type> Print path of output directory containing packages of
type referred to by pkg_type"
echo " -h, --help Prints this help"
@@ -26,35 +24,22 @@ printUsage() {
return 0
}
#
# Build environment variables. The value of test
# root is imported from the envsetu.sh
#
PROJ_NAME="rocm_bandwidth_test"
TEST_BIN_DIR="$(getBinPath)"
TEST_NAME="rocm-bandwidth-test"
TEST_UTILS_DIR="$(getUtilsPath)"
TEST_SRC_DIR="$PROJ_NAME"
TEST_SRC_DIR="rocm_bandwidth_test"
TEST_BLD_DIR="$(getBuildPath $TEST_SRC_DIR)"
#
# Env variables for packaging rocm_bandwidth_test
#
ROCM_PKG_PREFIX="$ROCM_INSTALL_PATH"
TEST_PKG_ROOT="$(getPackageRoot)"
TEST_PKG_DEB="$(getPackageRoot)/deb/$TEST_SRC_DIR"
TEST_PKG_RPM="$(getPackageRoot)/rpm/$TEST_SRC_DIR"
#
# Build the name of run script
#
ROCR_LIB_DIR="$(getPackageRoot)/lib"
ROCR_INC_DIR="$(getPackageRoot)/hsa/include"
RUN_SCRIPT=$(echo $(basename "${BASH_SOURCE}") | sed "s/build_/run_/")
#
# Specify the default build type as debug
# DASH_JAY - Bind number of threads to use value set
# by user in their shell config file (.bashrc)
#
TARGET="build"
MAKETARGET="all"
BUILD_TYPE="Debug"
@@ -64,16 +49,11 @@ CLEAN_OR_OUT=0;
PKGTYPE="deb"
#parse the arguments
VALID_STR=`getopt -o hcraswo:p: --long help,clean,release,static,wheel,address_sanitizer,outdir:,package: -- "$@"`
VALID_STR=`getopt -o hcraso:p: --long help,clean,release,static,address_sanitizer,outdir:,package: -- "$@"`
eval set -- "$VALID_STR"
#
# Override default bindings if user specifies an option
#
while true ;
do
#echo "parocessing $1"
case "$1" in
(-h | --help)
printUsage ; exit 0;;
@@ -86,8 +66,6 @@ do
set_address_sanitizer_on ; shift ;;
(-s | --static)
ack_and_skip_static ;;
(-w | --wheel)
WHEEL_PACKAGE=true ; shift ;;
(-o | --outdir)
TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;;
(-p | --package)
@@ -106,9 +84,6 @@ if [ $RET_CONFLICT -ge 30 ]; then
exit $RET_CONFLICT
fi
#
# Clean the test build from system
#
clean_rocm_bandwidth_test() {
echo "Cleaning $TEST_NAME"
@@ -119,16 +94,10 @@ clean_rocm_bandwidth_test() {
rm -f $TEST_UTILS_DIR/$RUN_SCRIPT
}
#
# Build the test by runninh cmake
#
build_rocm_bandwidth_test() {
echo "Building $TEST_NAME"
#
# If build directory does not exist create it
#
if [ ! -d "$TEST_BLD_DIR" ]; then
mkdir -p "$TEST_BLD_DIR"
pushd "$TEST_BLD_DIR"
@@ -146,32 +115,22 @@ build_rocm_bandwidth_test() {
-DADDRESS_SANITIZER="$ADDRESS_SANITIZER" \
"$ROCM_BANDWIDTH_TEST_ROOT"
# Go back to the directory you came from
popd
fi
# Run the make cmd to build test
echo "Building $TEST_NAME"
cmake --build "$TEST_BLD_DIR" -- $MAKEARG -C $TEST_BLD_DIR
# Run the make cmd to install test
echo "Installing $TEST_NAME"
cmake --build "$TEST_BLD_DIR" -- $MAKEARG -C $TEST_BLD_DIR install
# Run the make cmd to package test
echo "Packaging $TEST_NAME"
cmake --build "$TEST_BLD_DIR" -- $MAKEARG -C $TEST_BLD_DIR package
# Run the copy cmd to place test in bin folder
mkdir -p "$TEST_BIN_DIR"
echo "Copying $TEST_NAME to $TEST_BIN_DIR"
progressCopy "$TEST_BLD_DIR/$TEST_NAME" "$TEST_BIN_DIR"
# Run the copy cmd to place run script in utils folder
mkdir -p "$TEST_UTILS_DIR"
echo "Copying $RUN_SCRIPT to $TEST_UTILS_DIR"
progressCopy "$SCRIPT_ROOT/$RUN_SCRIPT" "$TEST_UTILS_DIR"
copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$TEST_PKG_DEB" $TEST_BLD_DIR/*.deb
copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$TEST_PKG_RPM" $TEST_BLD_DIR/*.rpm
@@ -192,7 +151,7 @@ verifyEnvSetup
case $TARGET in
(clean) clean_rocm_bandwidth_test ;;
(build) build_rocm_bandwidth_test; build_wheel "$TEST_BLD_DIR" "$PROJ_NAME" ;;
(build) build_rocm_bandwidth_test ;;
(outdir) print_output_directory ;;
(*) die "Invalid target $TARGET" ;;
esac