Hi Jakub, hi Andrew,

On 17.05.22 10:01, Jakub Jelinek wrote:
But the above patch only implements it partially.
What is in omp-device-properties-* is for the sake of the host compiler,
[...]
You need to also change gcc/config/gcn/gcn.cc (gcn_omp_device_kind_arch_isa)
case omp_device_arch: handling so that it accepts both "gcn" and "amdgcn"
equally.

Done with the attached patch, which I intent to commit after the lunch break,
unless there are further comments.

* * *

Additionally, I am considering to document the permitted values → second patch.
The idea is to later add more device-specific information, separately for gcn
and nvptx like simd/teams/threads handling or similar information (additional
envvar, where it makes sense etc.), which is currently spread over several
slides, wikipages, mouth-to-mouth information etc.

Thoughts regarding the second patch?

Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955
gcn/t-omp-device: Add 'amdgcn' as 'arch' [PR105602]

Improve cross-compiler handling.

gcc/ChangeLog:

	PR target/105602
	* config/gcn/t-omp-device (arch): Add 'amdgcn' besides existing 'gcn'.
	* config/gcn/gcn.cc (gcn_omp_device_kind_arch_isa): Likewise.

 gcc/config/gcn/gcn.cc       | 2 +-
 gcc/config/gcn/t-omp-device | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index e2e9335ad75..92896ab972f 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -2632,7 +2632,7 @@ gcn_omp_device_kind_arch_isa (enum omp_device_kind_arch_isa trait,
     case omp_device_kind:
       return strcmp (name, "gpu") == 0;
     case omp_device_arch:
-      return strcmp (name, "gcn") == 0;
+      return (strcmp (name, "amdgcn") == 0 || strcmp (name, "gcn") == 0);
     case omp_device_isa:
       if (strcmp (name, "fiji") == 0)
 	return gcn_arch == PROCESSOR_FIJI;
diff --git a/gcc/config/gcn/t-omp-device b/gcc/config/gcn/t-omp-device
index cd56e2f8a68..e1d9e0d2a1e 100644
--- a/gcc/config/gcn/t-omp-device
+++ b/gcc/config/gcn/t-omp-device
@@ -1,4 +1,4 @@
 omp-device-properties-gcn: $(srcdir)/config/gcn/gcn.cc
 	echo kind: gpu > $@
-	echo arch: gcn >> $@
+	echo arch: amdgcn gcn >> $@
 	echo isa: fiji gfx900 gfx906 gfx908 >> $@
libgomp.texi: Document OpenMP context selectors

libgomp/
	libgomp.texi (Offload-Target Specifics): New chapter; add section
	to document OpenMP context selectors.

diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi
index 8a7512fb959..78a8b881a40 100644
--- a/libgomp/libgomp.texi
+++ b/libgomp/libgomp.texi
@@ -113,6 +113,7 @@ changed to GNU Offloading and Multi Processing Runtime Library.
 * OpenACC Library Interoperability:: OpenACC library interoperability with the
                                NVIDIA CUBLAS library.
 * OpenACC Profiling Interface::
+* Offload-Target Specifics::   Notes on offload-target specific internals
 * The libgomp ABI::            Notes on the external ABI presented by libgomp.
 * Reporting Bugs::             How to report bugs in the GNU Offloading and
                                Multi Processing Runtime Library.
@@ -4255,6 +4256,37 @@ offloading devices (it's not clear if they should be):
 @item @code{acc_memcpy_from_device}, @code{acc_memcpy_from_device_async}
 @end itemize
 
+@c ---------------------------------------------------------------------
+@c Offload-Target Specifics
+@c ---------------------------------------------------------------------
+
+@node Offload-Target Specifics
+@chapter Offload-Target Specifics
+
+The following sections present notes on the offload-target specifics.
+
+@menu
+* OpenMP Context Selectors::
+@end menu
+
+@node OpenMP Context Selectors
+@section OpenMP Context Selectors
+
+@code{vendor} is always @code{gnu}. References are to the GCC manual.
+
+@multitable @columnfractions .60 .10 .25
+@headitem @code{arch} @tab @code{kind} @tab @code{isa}
+@item @code{intel_mic}, @code{86}, @code{86_64}, @code{386}, @code{486},
+      @code{586}, @code{686}, @code{a32}
+      @tab @code{host}
+      @tab See @code{-m...} flags in ``x86 Options'' (without @code{-m})
+@item @code{amdgcn} @code{gcn}
+      @tab @code{gpu}
+      @tab See @code{-march=} in ``AMD GCN Options''
+@item @code{nvptx}
+      @tab @code{gpu}
+      @tab See @code{-misa=} in ``Nvidia PTX Options''
+@end multitable
 
 
 @c ---------------------------------------------------------------------

Reply via email to