Whitespace cleanup in hipcc
Change-Id: I36d32808e9e393df44ffd80b49d09ccf68b5751e
Αυτή η υποβολή περιλαμβάνεται σε:
+24
-26
@@ -2,7 +2,7 @@
|
||||
|
||||
use File::Basename;
|
||||
|
||||
# HIP compiler driver
|
||||
# HIP compiler driver
|
||||
# Will call NVCC or HCC (depending on target) and pass the appropriate include and library options for
|
||||
# the target compiler and HIP infrastructure.
|
||||
|
||||
@@ -14,7 +14,7 @@ use File::Basename;
|
||||
# If HIP_PLATFORM is not set hipcc will attempt auto-detect based on if nvcc is found.
|
||||
#
|
||||
# Other environment variable controls:
|
||||
# HIP_PATH : Path to HIP directory, default is one dir level above location of this script
|
||||
# HIP_PATH : Path to HIP directory, default is one dir level above location of this script
|
||||
# CUDA_PATH : Path to CUDA SDK (default /usr/local/cuda). Used on NVIDIA platforms only.
|
||||
# HCC_HOME : Path to HCC SDK (default /opt/rocm/hcc). Used on AMD platforms only.
|
||||
# HSA_PATH : Path to HSA dir (default /opt/rocm/hsa). Used on AMD platforms only.
|
||||
@@ -31,9 +31,6 @@ $verbose = 0 unless defined $verbose;
|
||||
$HIP_PATH=$ENV{'HIP_PATH'};
|
||||
$HIP_PATH=dirname (dirname $0) unless defined $HIP_PATH; # use parent directory of hipcc
|
||||
|
||||
#print "HIP_PATH=$HIP_PATH\n";
|
||||
|
||||
|
||||
$CODEXL_PATH = $ENV{'CODEXL_PATH'};
|
||||
$CODEXL_PATH = "/opt/AMD/CodeXL" unless defined $CODEXL_PATH;
|
||||
$marker_path = "$CODEXL_PATH/SDK/AMDTActivityLogger";
|
||||
@@ -45,18 +42,17 @@ $HIP_VERSION= `$HIP_PATH/bin/hipconfig --version`;
|
||||
|
||||
$HIP_PLATFORM="hcc" unless defined $HIP_PLATFORM;
|
||||
|
||||
|
||||
if ($verbose & 0x2) {
|
||||
print ("HIP_PATH=$HIP_PATH\n");
|
||||
print ("HIP_PLATFORM=$HIP_PLATFORM\n");
|
||||
print ("HIP_PATH=$HIP_PATH\n");
|
||||
print ("HIP_PLATFORM=$HIP_PLATFORM\n");
|
||||
}
|
||||
|
||||
# set if user explicitly requests -stdlib=libc++. (else we default to libstdc++ for better interop with g++):
|
||||
$setStdLib = 0; # TODO - set to 0
|
||||
|
||||
if ($HIP_PLATFORM eq "hcc") {
|
||||
$HSA_PATH=$ENV{'HSA_PATH'};
|
||||
$HSA_PATH="/opt/rocm/hsa" unless defined $HSA_PATH;
|
||||
$HSA_PATH=$ENV{'HSA_PATH'};
|
||||
$HSA_PATH="/opt/rocm/hsa" unless defined $HSA_PATH;
|
||||
|
||||
$HCC_HOME=$ENV{'HCC_HOME'};
|
||||
$HCC_HOME="/opt/rocm/hcc" unless defined $HCC_HOME;
|
||||
@@ -73,12 +69,14 @@ if ($HIP_PLATFORM eq "hcc") {
|
||||
|
||||
$HIPCXXFLAGS .= " -I$HIP_PATH/include/hcc_detail/cuda";
|
||||
$HIPCXXFLAGS .= " -I$HSA_PATH/include";
|
||||
$HIPLDFLAGS = "-hc -L$HCC_HOME/lib -Wl,--rpath=$HCC_HOME/lib -lc++ -ldl -lpthread -Wl,--whole-archive -lmcwamp -Wl,--no-whole-archive";
|
||||
$HIPLDFLAGS = "-hc -L$HCC_HOME/lib -Wl,--rpath=$HCC_HOME/lib -lc++ -ldl -lpthread -Wl,--whole-archive -lmcwamp -Wl,--no-whole-archive";
|
||||
|
||||
# Suppress linker warnings in case HCC distribution contains OpenCL/SPIR symbols
|
||||
$HIPLDFLAGS .= " -Wl,--defsym=_binary_kernel_spir_end=0 -Wl,--defsym=_binary_kernel_spir_start=0 -Wl,--defsym=_binary_kernel_cl_start=0 -Wl,--defsym=_binary_kernel_cl_end=0";
|
||||
#$HIPLDFLAGS .= " -Wl,--defsym=_binary_kernel_spir_end=0 -Wl,--defsym=_binary_kernel_spir_start=0 -Wl,--defsym=_binary_kernel_cl_start=0 -Wl,--defsym=_binary_kernel_cl_end=0";
|
||||
|
||||
# Satisfy HCC dependencies
|
||||
$HIPLDFLAGS .= " -lc++abi";
|
||||
$HIPLDFLAGS .= " -L$HSA_PATH/lib -L$ROCM_PATH/lib -lhsa-runtime64 -lhc_am -lhsakmt";
|
||||
$HIPLDFLAGS .= " -L$HSA_PATH/lib -L$ROCM_PATH/lib -lhsa-runtime64 -lhc_am -lhsakmt";
|
||||
|
||||
# Add trace marker library:
|
||||
# TODO - once we cleanly separate the HIP API headers from HIP library headers this logic should move to CMakebuild option - apps do not need to see the marker library.
|
||||
@@ -92,9 +90,9 @@ if ($HIP_PLATFORM eq "hcc") {
|
||||
$HIPLDFLAGS .= " -L$marker_lib_path -lAMDTActivityLogger";
|
||||
}
|
||||
|
||||
# Add C++ libs for GCC.
|
||||
$HIPLDFLAGS .= " -lstdc++";
|
||||
$HIPLDFLAGS .= " -lm";
|
||||
# Add C++ libs for GCC.
|
||||
$HIPLDFLAGS .= " -lstdc++";
|
||||
$HIPLDFLAGS .= " -lm";
|
||||
|
||||
if ($verbose & 0x2) {
|
||||
print ("HSA_PATH=$HSA_PATH\n");
|
||||
@@ -111,10 +109,10 @@ if ($HIP_PLATFORM eq "hcc") {
|
||||
$HIPCC="$CUDA_PATH/bin/nvcc";
|
||||
$HIPCXXFLAGS .= " -I$CUDA_PATH/include";
|
||||
|
||||
$HIPLDFLAGS = "";
|
||||
$HIPLDFLAGS = "";
|
||||
} else {
|
||||
printf ("error: unknown HIP_PLATFORM = '$HIP_PLATFORM'");
|
||||
exit (-1);
|
||||
printf ("error: unknown HIP_PLATFORM = '$HIP_PLATFORM'");
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
|
||||
@@ -134,11 +132,11 @@ my @options = ();
|
||||
my @inputs = ();
|
||||
|
||||
if ($verbose & 0x4) {
|
||||
print "hipcc-args: ", join (" ", @ARGV), "\n";
|
||||
print "hipcc-args: ", join (" ", @ARGV), "\n";
|
||||
}
|
||||
|
||||
my $toolArgs = ""; # arguments to pass to the hcc or nvcc tool
|
||||
foreach $arg (@ARGV)
|
||||
foreach $arg (@ARGV)
|
||||
{
|
||||
my $swallowArg = 0;
|
||||
if ($arg eq '-c') {
|
||||
@@ -170,7 +168,7 @@ foreach $arg (@ARGV)
|
||||
|
||||
if ($arg =~ m/^-/) {
|
||||
# options start with -
|
||||
|
||||
|
||||
# Process HIPCC options here:
|
||||
if ($arg =~ m/^--hipcc/) {
|
||||
$swallowArg = 1;
|
||||
@@ -183,11 +181,11 @@ foreach $arg (@ARGV)
|
||||
}
|
||||
#print "O: <$arg>\n";
|
||||
} else {
|
||||
# input files and libraries
|
||||
# input files and libraries
|
||||
if (($arg =~ /\.cpp$/) or ($arg =~ /\.c$/) or ($arg =~ /\.cc$/) ) {
|
||||
$hasC = 1;
|
||||
$needCXXFLAGS = 1;
|
||||
}
|
||||
}
|
||||
if (($arg =~ /\.cu$/) or ($arg =~ /\.cuh$/)) {
|
||||
$hasCU = 1;
|
||||
$needCXXFLAGS = 1;
|
||||
@@ -225,7 +223,7 @@ if ($needHipHcc) {
|
||||
|
||||
# hipcc currrently requires separate compilation of source files, ie it is not possible to pass
|
||||
# CPP files combined with .O files
|
||||
# Reason is that NVCC uses the file extension to determine whether to compile in CUDA mode or
|
||||
# Reason is that NVCC uses the file extension to determine whether to compile in CUDA mode or
|
||||
# pass-through CPP mode.
|
||||
|
||||
|
||||
@@ -233,7 +231,7 @@ if ($needHipHcc) {
|
||||
my $CMD="$HIPCC";
|
||||
if ($needCXXFLAGS) {
|
||||
$CMD .= " $HIPCXXFLAGS";
|
||||
}
|
||||
}
|
||||
if ($needLDFLAGS and not $compileOnly) {
|
||||
$CMD .= " $HIPLDFLAGS";
|
||||
}
|
||||
|
||||
Αναφορά σε νέο ζήτημα
Block a user