public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [OG12] [committed] amdgcn: Enable SIMD vectorization of math library functions
@ 2022-11-02  0:50 Kwok Cheung Yeung
  2022-11-08 15:14 ` Kwok Cheung Yeung
  2023-01-20 14:16 ` [og12] Fix 'libgomp.c/simd-math-1.c' configuration (was: [OG12] [committed] amdgcn: Enable SIMD vectorization of math library functions) Thomas Schwinge
  0 siblings, 2 replies; 4+ messages in thread
From: Kwok Cheung Yeung @ 2022-11-02  0:50 UTC (permalink / raw)
  To: gcc-patches; +Cc: Catherine Moore, Andrew Stubbs

Hello

I have committed the following patches onto the devel/omp/gcc-12 
development branch:

863579c4e30 amdgcn: Enable SIMD vectorization of math functions
bd9a6106b95 amdgcn: Add SIMD versions of math routines to libgcc
d3a2a1cc424 amdgcn: Add builtins for vector floor/floorf
a3c04a367a9 amdgcn: Fix expansion of builtin for vector fabs operation

These patches implement a vectorized version of most of the C math 
library for AMD GCN. These routines will be used when math functions are 
used in auto-vectorized code.

Note that -fno-math-errno must be specified on the command line in most 
cases before the compiler will consider using these functions.

Vectors smaller than the native 64 element ones are also supported (by 
masking off the unused lanes), which can be useful for SLP vectorized code.

Kwok Yeung

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

* Re: [OG12] [committed] amdgcn: Enable SIMD vectorization of math library functions
  2022-11-02  0:50 [OG12] [committed] amdgcn: Enable SIMD vectorization of math library functions Kwok Cheung Yeung
@ 2022-11-08 15:14 ` Kwok Cheung Yeung
  2023-01-20 14:16 ` [og12] Fix 'libgomp.c/simd-math-1.c' configuration (was: [OG12] [committed] amdgcn: Enable SIMD vectorization of math library functions) Thomas Schwinge
  1 sibling, 0 replies; 4+ messages in thread
From: Kwok Cheung Yeung @ 2022-11-08 15:14 UTC (permalink / raw)
  To: gcc-patches

Hello

These additional patches were pushed onto the devel/omp/gcc-12 branch to 
fix various issues with the SIMD math library:

ecf1603b7ad amdgcn: Fix expansion of GCN_BUILTIN_LDEXPV builtin
6c40e3f5daa amdgcn: Various fixes for SIMD math library
8e6c5b18e10 amdgcn: Fixed intermittent failure in vectorized version of rint

Kwok

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

* [og12] Fix 'libgomp.c/simd-math-1.c' configuration (was: [OG12] [committed] amdgcn: Enable SIMD vectorization of math library functions)
  2022-11-02  0:50 [OG12] [committed] amdgcn: Enable SIMD vectorization of math library functions Kwok Cheung Yeung
  2022-11-08 15:14 ` Kwok Cheung Yeung
@ 2023-01-20 14:16 ` Thomas Schwinge
  2023-01-20 16:31   ` [og12] Fix 'libgomp.c/simd-math-1.c' configuration, again (was: [og12] Fix 'libgomp.c/simd-math-1.c' configuration (was: [OG12] [committed] amdgcn: Enable SIMD vectorization of math library functions)) Thomas Schwinge
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Schwinge @ 2023-01-20 14:16 UTC (permalink / raw)
  To: Kwok Cheung Yeung, gcc-patches; +Cc: Andrew Stubbs

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

Hi!

On 2022-11-02T00:50:40+0000, Kwok Cheung Yeung <kcy@codesourcery.com> wrote:
> I have committed the following patches onto the devel/omp/gcc-12
> development branch:
>
> 863579c4e30 amdgcn: Enable SIMD vectorization of math functions

I've pushed to devel/omp/gcc-12
commit e7d4bcb974915bfe95be6c385641fc66a4201581
"Fix 'libgomp.c/simd-math-1.c' configuration", see attached.


Grüße
 Thomas


> bd9a6106b95 amdgcn: Add SIMD versions of math routines to libgcc
> d3a2a1cc424 amdgcn: Add builtins for vector floor/floorf
> a3c04a367a9 amdgcn: Fix expansion of builtin for vector fabs operation
>
> These patches implement a vectorized version of most of the C math
> library for AMD GCN. These routines will be used when math functions are
> used in auto-vectorized code.
>
> Note that -fno-math-errno must be specified on the command line in most
> cases before the compiler will consider using these functions.
>
> Vectors smaller than the native 64 element ones are also supported (by
> masking off the unused lanes), which can be useful for SLP vectorized code.
>
> Kwok Yeung


-----------------
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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-libgomp.c-simd-math-1.c-configuration.patch --]
[-- Type: text/x-diff, Size: 2101 bytes --]

From e7d4bcb974915bfe95be6c385641fc66a4201581 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Sat, 14 Jan 2023 10:28:09 +0100
Subject: [PATCH] Fix 'libgomp.c/simd-math-1.c' configuration

If nvptx offloading is configured in addition to GCN, we see:

    FAIL: libgomp.c/simd-math-1.c (test for excess errors)
    UNRESOLVED: libgomp.c/simd-math-1.c compilation failed to produce executable

    x86_64-pc-linux-gnu-accel-nvptx-none-gcc: error: unrecognized command-line option '-mstack-size=3000000'

Thus, restrict that ooption to GCN offloading compilation, and on the other
hand, there's no reason to skip this test for non-GCN offloading execution:
even if not SIMD-vectorized there, we still benefit from correctness testing.

	libgomp/
	* testsuite/libgomp.c/simd-math-1.c: Fix configuration.
---
 libgomp/ChangeLog.omp                     | 4 ++++
 libgomp/testsuite/libgomp.c/simd-math-1.c | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 629efbc5832..23e93495b62 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,7 @@
+2023-01-20  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* testsuite/libgomp.c/simd-math-1.c: Fix configuration.
+
 2023-01-19  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backported from master:
diff --git a/libgomp/testsuite/libgomp.c/simd-math-1.c b/libgomp/testsuite/libgomp.c/simd-math-1.c
index caf032a77ae..1ebdccccfeb 100644
--- a/libgomp/testsuite/libgomp.c/simd-math-1.c
+++ b/libgomp/testsuite/libgomp.c/simd-math-1.c
@@ -2,9 +2,9 @@
    sufficiently close) results as their scalar equivalents.  */
 
 /* { dg-do run } */
-/* { dg-skip-if "AMD GCN only" { ! amdgcn_offloading_enabled } } */
 /* { dg-options "-O2 -ftree-vectorize -fno-math-errno" } */
-/* { dg-additional-options "-foffload=-mstack-size=3000000 -foffload=-lm" } */
+/* { dg-additional-options -foffload-options=amdgcn-amdhsa=-mstack-size=3000000 } */
+/* { dg-additional-options -foffload-options=-lm } */
 
 #undef PRINT_RESULT
 #define VERBOSE 0
-- 
2.25.1


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

* [og12] Fix 'libgomp.c/simd-math-1.c' configuration, again (was: [og12] Fix 'libgomp.c/simd-math-1.c' configuration (was: [OG12] [committed] amdgcn: Enable SIMD vectorization of math library functions))
  2023-01-20 14:16 ` [og12] Fix 'libgomp.c/simd-math-1.c' configuration (was: [OG12] [committed] amdgcn: Enable SIMD vectorization of math library functions) Thomas Schwinge
@ 2023-01-20 16:31   ` Thomas Schwinge
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Schwinge @ 2023-01-20 16:31 UTC (permalink / raw)
  To: Kwok Cheung Yeung, gcc-patches; +Cc: Andrew Stubbs, Tobias Burnus

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

Hi!

On 2023-01-20T15:16:26+0100, I wrote:
> On 2022-11-02T00:50:40+0000, Kwok Cheung Yeung <kcy@codesourcery.com> wrote:
>> I have committed the following patches onto the devel/omp/gcc-12
>> development branch:
>>
>> 863579c4e30 amdgcn: Enable SIMD vectorization of math functions
>
> I've pushed to devel/omp/gcc-12
> commit e7d4bcb974915bfe95be6c385641fc66a4201581
> "Fix 'libgomp.c/simd-math-1.c' configuration", see attached.

I've pushed to devel/omp/gcc-12
commit bbd4eb1772893ba99aa23a4eaf8950415624964e
"Fix 'libgomp.c/simd-math-1.c' configuration, again", see attached.

Thanks for the report, Tobias!


Grüße
 Thomas


-----------------
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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-libgomp.c-simd-math-1.c-configuration-again.patch --]
[-- Type: text/x-diff, Size: 1888 bytes --]

From bbd4eb1772893ba99aa23a4eaf8950415624964e Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Fri, 20 Jan 2023 17:17:21 +0100
Subject: [PATCH] Fix 'libgomp.c/simd-math-1.c' configuration, again

Tobias pointed out that as of my recent
og12 commit e7d4bcb974915bfe95be6c385641fc66a4201581
"Fix 'libgomp.c/simd-math-1.c' configuration",
in GCC configurations without GCN offloading configured, we'd get:

    xgcc: error: GCC is not configured to support 'amdgcn-amdhsa' as '-foffload=' argument

("Interestingly", GCC doesn't complain for '-foffload-options=-lm' if there are
no offload targets configured...)

	libgomp/
	* testsuite/libgomp.c/simd-math-1.c: Fix configuration, again.
---
 libgomp/ChangeLog.omp                     | 2 ++
 libgomp/testsuite/libgomp.c/simd-math-1.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 0f8fca4e71c..134d450f44a 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,5 +1,7 @@
 2023-01-20  Thomas Schwinge  <thomas@codesourcery.com>
 
+	* testsuite/libgomp.c/simd-math-1.c: Fix configuration, again.
+
 	* testsuite/libgomp.oacc-c-c++-common/abort-3.c: Force
 	'--param openacc-kernels=parloops'.
 
diff --git a/libgomp/testsuite/libgomp.c/simd-math-1.c b/libgomp/testsuite/libgomp.c/simd-math-1.c
index 1ebdccccfeb..ea629696e55 100644
--- a/libgomp/testsuite/libgomp.c/simd-math-1.c
+++ b/libgomp/testsuite/libgomp.c/simd-math-1.c
@@ -3,7 +3,7 @@
 
 /* { dg-do run } */
 /* { dg-options "-O2 -ftree-vectorize -fno-math-errno" } */
-/* { dg-additional-options -foffload-options=amdgcn-amdhsa=-mstack-size=3000000 } */
+/* { dg-additional-options -foffload-options=amdgcn-amdhsa=-mstack-size=3000000 { target offload_target_amdgcn } } */
 /* { dg-additional-options -foffload-options=-lm } */
 
 #undef PRINT_RESULT
-- 
2.25.1


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

end of thread, other threads:[~2023-01-20 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-02  0:50 [OG12] [committed] amdgcn: Enable SIMD vectorization of math library functions Kwok Cheung Yeung
2022-11-08 15:14 ` Kwok Cheung Yeung
2023-01-20 14:16 ` [og12] Fix 'libgomp.c/simd-math-1.c' configuration (was: [OG12] [committed] amdgcn: Enable SIMD vectorization of math library functions) Thomas Schwinge
2023-01-20 16:31   ` [og12] Fix 'libgomp.c/simd-math-1.c' configuration, again (was: [og12] Fix 'libgomp.c/simd-math-1.c' configuration (was: [OG12] [committed] amdgcn: Enable SIMD vectorization of math library functions)) Thomas Schwinge

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).