public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch]+[RFC] AMDGCN offloading – use amdgcn-amdhsa vs. amdgcn-unknown-amdhsa
@ 2020-03-20 21:08 Tobias Burnus
  2020-03-23 10:35 ` Andrew Stubbs
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2020-03-20 21:08 UTC (permalink / raw)
  To: gcc-patches, Richard Biener, Jakub Jelinek, Matthias Klose,
	Andrew Stubbs

[-- Attachment #1: Type: text/plain, Size: 1411 bytes --]

Dear all,

normally, the target triplet does not play much of a role as
it is not really exposed to the user. However, for offloading,
it appears often:
* In distribution use, offloading support is compiled in, but
   not enabled by default; one needs to use -foffload=… explicitly.
* Even with the default build (all offload targets are enabled by
   default), one still might need to specify the host triplet – if,
   e.g., NVidia and GCN are both supported — as AMDGCN needs a
   -march=, i.e. -foffload=<triplet>=-march=...

Coming to offloading:
* for Nvidia, everyone uses "nvptx-none"
* for AMDGCN is was initially "amdgcn-unknown-amdhsa"

However, when Matthias build it for Debian, he shortened it to
"amdgcn-amdhsa" – as did Richard for SUSE. Cf
https://salsa.debian.org/toolchain-team/gcc/-/blob/master/debian/rules2
andhttps://build.opensuse.org/package/view_file/devel:gcc/gcc10/gcc.spec.in?expand=1

This shortening makes it user friendlier and I like it, but
it now causes that the offloading target is not recognized by
the testsuite – and I think one also should update the documentation.


OK – or do you have better/additional suggestions?

Cheers,

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter

[-- Attachment #2: amd-unknown.diff --]
[-- Type: text/x-patch, Size: 2209 bytes --]

AMDGCN offloading – use amdgcn-amdhsa

	gcc/
	* doc/install.texi (amdgcn-*-amdhsa): Renamed
	from amdgcn-unknown-amdhsa; change
	amdgcn-unknown-amdhsa to amdgcn-amdhsa.

	gcc/testsuite/
	* lib/target-supports.exp (check_effective_target_offload_gcn):
	Check for -foffload=amdgcn-amdhsa not ...=amdgcn-unknown-amdhsa.

diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 92961833ef6..559610802be 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -3572,22 +3572,22 @@ This is a synonym for @samp{x86_64-*-solaris2*}.
 @html
 <hr />
 @end html
-@anchor{amdgcn-unknown-amdhsa}
-@heading amdgcn-unknown-amdhsa
+@anchor{amdgcn-x-amdhsa}
+@heading amdgcn-*-amdhsa
 AMD GCN GPU target.
 
 Instead of GNU Binutils, you will need to install LLVM 6, or later, and copy
-@file{bin/llvm-mc} to @file{amdgcn-unknown-amdhsa/bin/as},
-@file{bin/lld} to @file{amdgcn-unknown-amdhsa/bin/ld},
-@file{bin/llvm-nm} to @file{amdgcn-unknown-amdhsa/bin/nm}, and
-@file{bin/llvm-ar} to both @file{bin/amdgcn-unknown-amdhsa-ar} and
-@file{bin/amdgcn-unknown-amdhsa-ranlib}.
+@file{bin/llvm-mc} to @file{amdgcn-amdhsa/bin/as},
+@file{bin/lld} to @file{amdgcn-amdhsa/bin/ld},
+@file{bin/llvm-nm} to @file{amdgcn-amdhsa/bin/nm}, and
+@file{bin/llvm-ar} to both @file{bin/amdgcn-amdhsa-ar} and
+@file{bin/amdgcn-amdhsa-ranlib}.
 
 Use Newlib (2019-01-16, or newer).
 
 To run the binaries, install the HSA Runtime from the
 @uref{https://rocm.github.io,,ROCm Platform}, and use
-@file{libexec/gcc/amdhsa-unknown-amdhsa/@var{version}/gcn-run} to launch them
+@file{libexec/gcc/amdhsa-amdhsa/@var{version}/gcn-run} to launch them
 on the GPU.
 
 @html
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 4413c26fbc9..58919a31a00 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -9562,7 +9562,7 @@ proc check_effective_target_offload_hsa { } {
 proc check_effective_target_offload_gcn { } {
     return [check_no_compiler_messages offload_gcn assembly {
 	int main () {return 0;}
-    } "-foffload=amdgcn-unknown-amdhsa" ]
+    } "-foffload=amdgcn-amdhsa" ]
 }
 
 # Return 1 if the target support -fprofile-update=atomic

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch]+[RFC] AMDGCN offloading – use amdgcn-amdhsa vs. amdgcn-unknown-amdhsa
  2020-03-20 21:08 [Patch]+[RFC] AMDGCN offloading – use amdgcn-amdhsa vs. amdgcn-unknown-amdhsa Tobias Burnus
@ 2020-03-23 10:35 ` Andrew Stubbs
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Stubbs @ 2020-03-23 10:35 UTC (permalink / raw)
  To: Tobias Burnus, gcc-patches, Richard Biener, Jakub Jelinek,
	Matthias Klose

On 20/03/2020 21:08, Tobias Burnus wrote:
> Dear all,
> 
> normally, the target triplet does not play much of a role as
> it is not really exposed to the user. However, for offloading,
> it appears often:
> * In distribution use, offloading support is compiled in, but
>    not enabled by default; one needs to use -foffload=… explicitly.
> * Even with the default build (all offload targets are enabled by
>    default), one still might need to specify the host triplet – if,
>    e.g., NVidia and GCN are both supported — as AMDGCN needs a
>    -march=, i.e. -foffload=<triplet>=-march=...
> 
> Coming to offloading:
> * for Nvidia, everyone uses "nvptx-none"
> * for AMDGCN is was initially "amdgcn-unknown-amdhsa"
> 
> However, when Matthias build it for Debian, he shortened it to
> "amdgcn-amdhsa" – as did Richard for SUSE. Cf
> https://salsa.debian.org/toolchain-team/gcc/-/blob/master/debian/rules2
> andhttps://build.opensuse.org/package/view_file/devel:gcc/gcc10/gcc.spec.in?expand=1 
> 
> 
> This shortening makes it user friendlier and I like it, but
> it now causes that the offloading target is not recognized by
> the testsuite – and I think one also should update the documentation.
> 
> 
> OK – or do you have better/additional suggestions?

The patch looks OK to me, as far as fixing the immediate problem goes.

I hadn't realised this test was so fragile though. :-(

Perhaps it should also recognise the standard names used in the OpenACC 
documentation? In this case "radeon". (I don't recall, off hand, if 
OpenMP uses standard device names.)

Andrew

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-23 10:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 21:08 [Patch]+[RFC] AMDGCN offloading – use amdgcn-amdhsa vs. amdgcn-unknown-amdhsa Tobias Burnus
2020-03-23 10:35 ` Andrew Stubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).