From 49a9ab80b0be009fd0495645dd39fa51200dfdba Mon Sep 17 00:00:00 2001 From: Evgeny Mankov Date: Fri, 28 Jul 2023 15:43:01 +0200 Subject: [PATCH 1/6] [fix][SWDEV-413305][nvcc] Recovering the fallback building of HIP programs via nvcc [Synopsis] + There is no support for an explicit `-x cu` in hipcc anymore + Thus, the building via `nvcc` relies only on `HIP_PLATFORM`, which should be set to 'nvidia' in order to invoke `nvcc` compilation with implicit providing `-x cu` + But such an implicit setting of `-x cu` never happens + As a result, the compilation via `nvcc` starts actually, but ends up with the following error: `nvcc fatal : Don't know what to do with 'MatrixTranspose.hip'` [Solution] + Not taking into account the excessive variable `$hasCXX` in the condition for an implicit setting of `-x cu` + [Reason] `$hasCXX` is never set for the `nvcc` path [Testing] 1. [Windows + MS cl as host compiler] Steps: - set HIP_PLATFORM=nvidia - set HIP_PATH= - set CUDA_PATH= - set set path=c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\Hostx64\x64\;%path% - perl hipcc.pl MatrixTranspose.hip -o MatrixTranspose -v --gpu-architecture=sm_XX - run MatrixTranspose.exe [NOTES] - The path to the MS cl compiler is needed cause nvcc uses it for host compilation - Setting the `--gpu-architecture` depends on NVIDIA GPU to run on - The execution results are correct according to the margin of error = 0.000001 2. [Linux] To be accomplished by PSDB --- bin/hipcc.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/hipcc.pl b/bin/hipcc.pl index 1c11dfa..f332971 100755 --- a/bin/hipcc.pl +++ b/bin/hipcc.pl @@ -532,7 +532,7 @@ sub get_normalized_path { $ENV{HCC_EXTRA_LIBRARIES}="\n"; } -if ($hasCXX and $HIP_PLATFORM eq 'nvidia') { +if ($HIP_PLATFORM eq 'nvidia') { $HIPCXXFLAGS .= " -x cu"; } From 11830f13bebe11474f5ec12db76f396991786811 Mon Sep 17 00:00:00 2001 From: Evgeny Mankov Date: Fri, 28 Jul 2023 18:18:38 +0200 Subject: [PATCH 2/6] [fix][SWDEV-413305][nvcc] Recovering the fallback building of HIP programs via nvcc - Step 2 - Minor refactoring [IMP] + The unused variable `$hasCU` is left untouched in its place - probably there are someone's unfinished continuous changes to merge there + The same testing is done manually: the `nvcc` command line left almost the same, only the `-x cu` changed its place --- bin/hipcc.pl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bin/hipcc.pl b/bin/hipcc.pl index f332971..42c3f48 100755 --- a/bin/hipcc.pl +++ b/bin/hipcc.pl @@ -450,8 +450,9 @@ sub get_normalized_path { if ($HIP_PLATFORM eq "amd") { $hasHIP = 1; $toolArgs .= " -x hip"; - } else { + } elsif ($HIP_PLATFORM eq "nvidia") { $hasCU = 1; + $toolArgs .= " -x cu"; } } } @@ -532,10 +533,6 @@ sub get_normalized_path { $ENV{HCC_EXTRA_LIBRARIES}="\n"; } -if ($HIP_PLATFORM eq 'nvidia') { - $HIPCXXFLAGS .= " -x cu"; -} - if ($buildDeps and $HIP_PLATFORM eq 'nvidia') { $HIPCXXFLAGS .= " -M -D__CUDACC__"; $HIPCFLAGS .= " -M -D__CUDACC__"; From 49171184262862da4e15c0e0cfe6706cc287d77d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Jul 2023 05:46:05 +0000 Subject: [PATCH 3/6] Bump rocm-docs-core from 0.19.0 to 0.20.0 in /docs/.sphinx Bumps [rocm-docs-core](https://github.com/RadeonOpenCompute/rocm-docs-core) from 0.19.0 to 0.20.0. - [Release notes](https://github.com/RadeonOpenCompute/rocm-docs-core/releases) - [Changelog](https://github.com/RadeonOpenCompute/rocm-docs-core/blob/develop/CHANGELOG.md) - [Commits](https://github.com/RadeonOpenCompute/rocm-docs-core/compare/v0.19.0...v0.20.0) --- updated-dependencies: - dependency-name: rocm-docs-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- docs/.sphinx/requirements.in | 2 +- docs/.sphinx/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/.sphinx/requirements.in b/docs/.sphinx/requirements.in index e53f3df..c6a8856 100644 --- a/docs/.sphinx/requirements.in +++ b/docs/.sphinx/requirements.in @@ -1 +1 @@ -rocm-docs-core==0.19.0 +rocm-docs-core==0.20.0 diff --git a/docs/.sphinx/requirements.txt b/docs/.sphinx/requirements.txt index 8779b8e..5e40863 100644 --- a/docs/.sphinx/requirements.txt +++ b/docs/.sphinx/requirements.txt @@ -92,7 +92,7 @@ requests==2.28.2 # via # pygithub # sphinx -rocm-docs-core==0.19.0 +rocm-docs-core==0.20.0 # via -r requirements.in smmap==5.0.0 # via gitdb From 2a64876c51d02e12f264d103cc972f6c6349ed77 Mon Sep 17 00:00:00 2001 From: Konstantin Zhuravlyov Date: Wed, 2 Aug 2023 11:51:16 -0400 Subject: [PATCH 4/6] Add '-x cu' for c++ file extensions --- bin/hipcc.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/hipcc.pl b/bin/hipcc.pl index 42c3f48..4459175 100755 --- a/bin/hipcc.pl +++ b/bin/hipcc.pl @@ -444,6 +444,9 @@ sub get_normalized_path { } elsif ($HIP_PLATFORM eq "amd") { $hasHIP = 1; $toolArgs .= " -x hip"; + } elsif ($HIP_PLATFORM eq "nvidia") { + $hasCU = 1; + $toolArgs .= " -x cu"; } } elsif ((($arg =~ /\.cu$/ or $arg =~ /\.cuh$/) and $HIP_COMPILE_CXX_AS_HIP ne '0') or ($arg =~ /\.hip$/)) { $needCXXFLAGS = 1; From e4db242674ddaf8cc55c857bec044cd243f76e1c Mon Sep 17 00:00:00 2001 From: Konstantin Zhuravlyov Date: Wed, 2 Aug 2023 11:57:25 -0400 Subject: [PATCH 5/6] Move "-x cu" to the right place --- bin/hipcc.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/hipcc.pl b/bin/hipcc.pl index 4459175..fa5ef5e 100755 --- a/bin/hipcc.pl +++ b/bin/hipcc.pl @@ -441,12 +441,13 @@ sub get_normalized_path { $needCXXFLAGS = 1; if ($HIP_COMPILE_CXX_AS_HIP eq '0' or $HIP_PLATFORM ne "amd" or $hasOMPTargets eq 1) { $hasCXX = 1; + if ($HIP_PLATFORM eq "nvidia") { + $hasCU = 1; + $toolArgs .= " -x cu"; + } } elsif ($HIP_PLATFORM eq "amd") { $hasHIP = 1; $toolArgs .= " -x hip"; - } elsif ($HIP_PLATFORM eq "nvidia") { - $hasCU = 1; - $toolArgs .= " -x cu"; } } elsif ((($arg =~ /\.cu$/ or $arg =~ /\.cuh$/) and $HIP_COMPILE_CXX_AS_HIP ne '0') or ($arg =~ /\.hip$/)) { $needCXXFLAGS = 1; From 6602234e0ea342ebef38a4689280ea00198bdd4c Mon Sep 17 00:00:00 2001 From: Konstantin Zhuravlyov Date: Wed, 2 Aug 2023 12:20:34 -0400 Subject: [PATCH 6/6] Remove $hasCU --- bin/hipcc.pl | 3 --- 1 file changed, 3 deletions(-) diff --git a/bin/hipcc.pl b/bin/hipcc.pl index fa5ef5e..513a427 100755 --- a/bin/hipcc.pl +++ b/bin/hipcc.pl @@ -230,7 +230,6 @@ sub get_normalized_path { my $hasOMPTargets = 0; # If OMP targets is mentioned my $hasC = 0; # options contain a c-style file my $hasCXX = 0; # options contain a cpp-style file (NVCC must force recognition as GPU file) -my $hasCU = 0; # options contain a cu-style file (HCC must force recognition as GPU file) my $hasHIP = 0; # options contain a hip-style file (HIP-Clang must pass offloading options) my $printHipVersion = 0; # print HIP version my $printCXXFlags = 0; # print HIPCXXFLAGS @@ -442,7 +441,6 @@ sub get_normalized_path { if ($HIP_COMPILE_CXX_AS_HIP eq '0' or $HIP_PLATFORM ne "amd" or $hasOMPTargets eq 1) { $hasCXX = 1; if ($HIP_PLATFORM eq "nvidia") { - $hasCU = 1; $toolArgs .= " -x cu"; } } elsif ($HIP_PLATFORM eq "amd") { @@ -455,7 +453,6 @@ sub get_normalized_path { $hasHIP = 1; $toolArgs .= " -x hip"; } elsif ($HIP_PLATFORM eq "nvidia") { - $hasCU = 1; $toolArgs .= " -x cu"; } }