From 713702eebc6870ecd9e796e1945208c1395e6a5f Mon Sep 17 00:00:00 2001 From: Siu Chi Chan Date: Wed, 5 Feb 2020 10:26:33 -0500 Subject: [PATCH] Enable code object v3 codgen when compiling with HCC (#1836) Change-Id: I590c05a418cc37ec247b89124cef17a7fe8b27e2 --- hipamd/bin/hipcc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hipamd/bin/hipcc b/hipamd/bin/hipcc index 8db2148c22..2f22b07f5f 100755 --- a/hipamd/bin/hipcc +++ b/hipamd/bin/hipcc @@ -346,6 +346,7 @@ my $runCmd = 1; my $buildDeps = 0; my $linkType = 1; my $setLinkType = 0; +my $coFormatv3 = 1; my @options = (); my @inputs = (); @@ -427,6 +428,14 @@ foreach $arg (@ARGV) } } + # code object format parsing + if ($trimarg eq '-mcode-object-v3') { + $coFormatv3 = 1; + } + if ($trimarg eq '-mno-code-object-v3') { + $coFormatv3 = 0; + } + if (($arg =~ /--genco/) and $HIP_PLATFORM eq 'clang' ) { $arg = "--cuda-device-only"; } @@ -671,6 +680,13 @@ if($HIP_PLATFORM eq "hcc" or $HIP_PLATFORM eq "clang"){ $ENV{HCC_EXTRA_LIBRARIES}="\n"; } +# hcc defaults to v2, so we need to convert to the appropriate flag +# hip-clang defaults to v3, so we don't need to do anything +if ($coFormatv3 and $HIP_PLATFORM eq 'hcc') { + $HIPLDFLAGS .= " -mcode-object-v3"; + $HIPCXXFLAGS .= " -mcode-object-v3"; +} + if ($hasC and $HIP_PLATFORM eq 'nvcc') { $HIPCXXFLAGS .= " -x cu"; }