forked from ROCm/roctracer
-
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.
SWDEV-307394: Fixing Download HSA-Class Issue
Exchanging the git clone of the hsa-class to a local downloaded version pushed to the roctracer repo Change-Id: Id45a38b2d355102c2e0dee1e4bfde50398369047
- Loading branch information
Showing
28 changed files
with
3,886 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,5 @@ | |
*.swp | ||
*.Po | ||
build | ||
test/hsa | ||
test/MatrixTranspose/MatrixTranspose | ||
test/MatrixTranspose_test/MatrixTranspose |
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,20 @@ | ||
Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. | ||
[MITx11 license] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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,4 @@ | ||
# HSA-class | ||
``` | ||
HSA high level C++ API | ||
``` |
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,80 @@ | ||
#!/bin/sh -x | ||
SO_EXT="hsaco" | ||
|
||
TEST_NAME=$1 | ||
DST_DIR=$2 | ||
ROCM_DIR=$3 | ||
TGT_LIST=$4 | ||
|
||
if [ -z "$TEST_NAME" ] ; then | ||
echo "Usage: $0 <test name> <dst dir>" | ||
echo " Will look for <test name>.cl and will build <test name>.$SO_EXT dynamic code object library" | ||
exit 1 | ||
fi | ||
OBJ_NAME=$(echo "_$(basename $TEST_NAME)" | sed -e 's/_./\U&\E/g' -e 's/_//g') | ||
|
||
if [ -z "$DST_DIR" ] ; then | ||
DST_DIR=$(dirname TEST_NAME) | ||
fi | ||
|
||
if [ -z "$ROCM_DIR" ] ; then | ||
ROCM_DIR=/opt/rocm | ||
fi | ||
|
||
if [ -z "$TGT_LIST" ] ; then | ||
TGT_LIST=`$ROCM_DIR/bin/rocminfo | grep "amdgcn-amd-amdhsa--" | head -n 1 | sed -n "s/^.*amdgcn-amd-amdhsa--\(\w*\).*$/\1/p"` | ||
fi | ||
|
||
if [ -z "$TGT_LIST" ] ; then | ||
echo "Error: GPU targets not found" | ||
exit 1 | ||
fi | ||
|
||
OCL_VER="2.0" | ||
|
||
if [ -e $ROCM_DIR/llvm ] ; then | ||
LLVM_DIR=$ROCM_DIR/llvm | ||
LIB_DIR=$ROCM_DIR/lib | ||
else | ||
LLVM_DIR=$ROCM_DIR/hcc | ||
LIB_DIR=$LLVM_DIR/lib | ||
fi | ||
|
||
# Determine whether using new or old device-libs layout | ||
if [ -e $LIB_DIR/bitcode/opencl.amdgcn.bc ]; then | ||
BC_DIR=$LIB_DIR/bitcode | ||
elif [ -e $LIB_DIR/opencl.amdgcn.bc ]; then | ||
BC_DIR=$LIB_DIR | ||
elif [ -e $ROCM_DIR/amdgcn/bitcode/opencl.bc ]; then | ||
BC_DIR=$ROCM_DIR/amdgcn/bitcode | ||
else | ||
echo "Error: Cannot find amdgcn bitcode directory" | ||
exit 1 | ||
fi | ||
|
||
CLANG_ROOT=$LLVM_DIR/lib/clang | ||
CLANG_DIR=`ls -d $CLANG_ROOT/* | head -n 1` | ||
if [ "$CLANG_DIR" = "" ] ; then | ||
echo "Error: LLVM clang library was not found" | ||
exit 1 | ||
fi | ||
|
||
BIN_DIR=$LLVM_DIR/bin | ||
INC_DIR=$CLANG_DIR/include | ||
if [ -e $BC_DIR/opencl.amdgcn.bc ]; then | ||
BITCODE_OPTS="-nogpulib \ | ||
-Xclang -mlink-bitcode-file -Xclang $BC_DIR/opencl.amdgcn.bc \ | ||
-Xclang -mlink-bitcode-file -Xclang $BC_DIR/ockl.amdgcn.bc \ | ||
-Xclang -mlink-bitcode-file -Xclang $BC_DIR/ocml.amdgcn.bc" | ||
else | ||
BITCODE_OPTS="--hip-device-lib-path=$BC_DIR" | ||
fi | ||
|
||
for GFXIP in $TGT_LIST ; do | ||
OBJ_PREF=$GFXIP | ||
OBJ_FILE="${OBJ_PREF}_${OBJ_NAME}.$SO_EXT" | ||
$BIN_DIR/clang -cl-std=CL$OCL_VER -include $INC_DIR/opencl-c.h $BITCODE_OPTS -target amdgcn-amd-amdhsa -mcpu=$GFXIP $TEST_NAME.cl -o $DST_DIR/$OBJ_FILE | ||
echo "'$OBJ_FILE' generated" | ||
done | ||
|
||
exit 0 |
Oops, something went wrong.