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