Files
rocm-systems/bin/hipgenisa.sh
T
Aditya Atluri 4f8c45d05a corrected offline kernel compilation on hipcc path
1. hipgenisa.sh now adds int main(){} during kernel compilation. User does not have to put it there
2. Renamed vcpy_isa.cpp to vcpy_kernel.cpp
3. Removed vcpy_isa.cu as the kernel code should be common for both paths
4. Changed Makefile and runkernel.cpp to work with above changes

Change-Id: I9f8c84706b44bb500bc493a68e959762b55a0142
2016-09-02 13:17:17 -05:00

37 lines
829 B
Bash
Executable File

#!/bin/bash
if [ $1 = " " ]
then
exit
fi
ROCM_PATH=$1
GEN_ISA=$2
FILE_NAMES=$3
OUT=$4
OUTPUT_FILE=$5
TARGET=""
if [ ${GEN_ISA:0:12} = "--target-isa" ]
then
TARGET=${GEN_ISA:13:12}
fi
SOURCE="${BASH_SOURCE[0]}"
HIP_PATH="$( command cd -P "$( dirname "$SOURCE" )/.." && pwd )"
export KMDUMPISA=1
export KMDUMPLLVM=1
mkdir /tmp/hipgenisa
cp $FILE_NAMES $FILE_NAMES.kernel.tmp.cpp
echo "
int main(){}
" >> $FILE_NAMES.kernel.tmp.cpp
$HIP_PATH/bin/hipcc $FILE_NAMES.kernel.tmp.cpp -o /tmp/hipgenisa/a.out
mv dump.* /tmp/hipgenisa/
$ROCM_PATH/hcc-lc/bin/llvm-mc -arch=amdgcn -mcpu=$TARGET -filetype=obj /tmp/hipgenisa/dump.isa -o /tmp/hipgenisa/dump.o
$ROCM_PATH/llvm/bin/clang -target amdgcn--amdhsa /tmp/hipgenisa/dump.o -o $OUTPUT_FILE
rm $FILE_NAMES.kernel.tmp.cpp
rm -r /tmp/hipgenisa
export KMDUMPISA=0
export KMDUMPLLVM=0