@@ -85,9 +85,6 @@ HipBinAmd::HipBinAmd() {
85
85
platformInfo.runtime = rocclr;
86
86
platformInfo.compiler = clang;
87
87
platformInfoAMD_ = platformInfo;
88
- constructRocclrHomePath (); // constructs RocclrHomePath
89
- constructHsaPath (); // constructs hsa path
90
- constructCompilerPath ();
91
88
}
92
89
93
90
// returns the Rocclr Home path
@@ -241,9 +238,6 @@ void HipBinAmd::constructCompilerPath() {
241
238
hipClangPath_ = complierPath;
242
239
}
243
240
244
-
245
-
246
-
247
241
// returns clang path.
248
242
const string& HipBinAmd::getCompilerPath () const {
249
243
return hipClangPath_;
@@ -388,8 +382,6 @@ bool HipBinAmd::detectPlatform() {
388
382
return detected;
389
383
}
390
384
391
-
392
-
393
385
string HipBinAmd::getHipLibPath () const {
394
386
string hipLibPath;
395
387
const EnvVariables& env = getEnvVariables ();
@@ -537,47 +529,10 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
537
529
}
538
530
539
531
string HIPLDARCHFLAGS;
540
-
541
- initializeHipCXXFlags ();
542
- initializeHipCFlags ();
543
- initializeHipLdFlags ();
544
532
string HIPCXXFLAGS, HIPCFLAGS, HIPLDFLAGS;
545
- HIPCFLAGS = getHipCFlags ();
546
- HIPCXXFLAGS = getHipCXXFlags ();
547
- HIPLDFLAGS = getHipLdFlags ();
548
- string hipLibPath;
549
- string hipIncludePath, deviceLibPath;
550
- hipLibPath = getHipLibPath ();
551
- const string& roccmPath = getRoccmPath ();
552
- const string& hipPath = getHipPath ();
553
- const PlatformInfo& platformInfo = getPlatformInfo ();
554
- const string& rocclrHomePath = getRocclrHomePath ();
555
- const string& hipClangPath = getCompilerPath ();
556
- hipIncludePath = getHipInclude ();
557
- deviceLibPath = getDeviceLibPath ();
558
- const string& hipVersion = getHipVersion ();
559
- if (verbose & 0x2 ) {
560
- cout << " HIP_PATH=" << hipPath << endl;
561
- cout << " HIP_PLATFORM=" << PlatformTypeStr (platformInfo.platform ) <<endl;
562
- cout << " HIP_COMPILER=" << CompilerTypeStr (platformInfo.compiler ) <<endl;
563
- cout << " HIP_RUNTIME=" << RuntimeTypeStr (platformInfo.runtime ) <<endl;
564
- cout << " ROCM_PATH=" << roccmPath << endl;
565
- cout << " HIP_ROCCLR_HOME=" << rocclrHomePath << endl;
566
- cout << " HIP_CLANG_PATH=" << hipClangPath <<endl;
567
- cout << " HIP_INCLUDE_PATH=" << hipIncludePath <<endl;
568
- cout << " HIP_LIB_PATH=" << hipLibPath <<endl;
569
- cout << " DEVICE_LIB_PATH=" << deviceLibPath <<endl;
570
- }
571
-
572
- if (verbose & 0x4 ) {
573
- cout << " hipcc-args: " ;
574
- for (unsigned int i = 1 ; i< argv.size (); i++) {
575
- cout << argv.at (i) << " " ;
576
- }
577
- cout << endl;
578
- }
579
-
580
533
534
+ // ARGV Processing Loop
535
+ // TODO(hipcc): create a proper Options Processing function/routine
581
536
for (unsigned int argcount = 1 ; argcount < argv.size (); argcount++) {
582
537
// Save $arg, it can get changed in the loop.
583
538
string arg = argv.at (argcount);
@@ -613,6 +568,11 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
613
568
setStdLib = 1 ;
614
569
}
615
570
571
+ // Process --rocm-path option
572
+ const string& rocmPathOption = " --rocm-path=" ;
573
+ if (arg.compare (0 ,rocmPathOption.length (),rocmPathOption) == 0 )
574
+ rocm_pathOption_ = arg.substr (rocmPathOption.length ());
575
+
616
576
// Check target selection option: --offload-arch= and --amdgpu-target=...
617
577
for (unsigned int i = 0 ; i <targetOpts.size (); i++) {
618
578
string targetOpt = targetOpts.at (i);
@@ -949,8 +909,56 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
949
909
if (!swallowArg)
950
910
toolArgs += " " + arg;
951
911
prevArg = arg;
952
- } // end of for loop
953
- // No AMDGPU target specified at commandline. So look for HCC_AMDGPU_TARGET
912
+ } // end of ARGV Processing Loop
913
+
914
+ // now construct Paths ...
915
+ constructRoccmPath (); // constructs Roccm Path
916
+ constructHipPath (); // constructs HIP Path
917
+ readHipVersion (); // stores the hip version
918
+ constructCompilerPath ();
919
+ constructRocclrHomePath ();
920
+ constructHsaPath ();
921
+
922
+ initializeHipCXXFlags ();
923
+ initializeHipCFlags ();
924
+ initializeHipLdFlags ();
925
+ HIPCFLAGS = getHipCFlags ();
926
+ HIPCXXFLAGS = getHipCXXFlags ();
927
+ HIPLDFLAGS = getHipLdFlags ();
928
+
929
+ string hipLibPath;
930
+ string hipIncludePath, deviceLibPath;
931
+ hipLibPath = getHipLibPath ();
932
+ const string& roccmPath = getRoccmPath ();
933
+ const string& hipPath = getHipPath ();
934
+ const PlatformInfo& platformInfo = getPlatformInfo ();
935
+ const string& rocclrHomePath = getRocclrHomePath ();
936
+ const string& hipClangPath = getCompilerPath ();
937
+ hipIncludePath = getHipInclude ();
938
+ deviceLibPath = getDeviceLibPath ();
939
+ const string& hipVersion = getHipVersion ();
940
+ if (verbose & 0x2 ) {
941
+ cout << " HIP_PATH=" << hipPath << endl;
942
+ cout << " HIP_PLATFORM=" << PlatformTypeStr (platformInfo.platform ) <<endl;
943
+ cout << " HIP_COMPILER=" << CompilerTypeStr (platformInfo.compiler ) <<endl;
944
+ cout << " HIP_RUNTIME=" << RuntimeTypeStr (platformInfo.runtime ) <<endl;
945
+ cout << " ROCM_PATH=" << roccmPath << endl;
946
+ cout << " HIP_ROCCLR_HOME=" << rocclrHomePath << endl;
947
+ cout << " HIP_CLANG_PATH=" << hipClangPath <<endl;
948
+ cout << " HIP_INCLUDE_PATH=" << hipIncludePath <<endl;
949
+ cout << " HIP_LIB_PATH=" << hipLibPath <<endl;
950
+ cout << " DEVICE_LIB_PATH=" << deviceLibPath <<endl;
951
+ }
952
+
953
+ if (verbose & 0x4 ) {
954
+ cout << " hipcc-args: " ;
955
+ for (unsigned int i = 1 ; i< argv.size (); i++) {
956
+ cout << argv.at (i) << " " ;
957
+ }
958
+ cout << endl;
959
+ }
960
+
961
+ // No AMDGPU target specified at commandline. So look for HCC_AMDGPU_TARGET
954
962
if (default_amdgpu_target == 1 ) {
955
963
if (!var.hccAmdGpuTargetEnv_ .empty ()) {
956
964
targetsStr = var.hccAmdGpuTargetEnv_ ;
0 commit comments