]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
OpenMP: Handle 'device_type(host)' on 'target': Repair 'libgomp.c/target-device-type...
authorThomas Schwinge <tschwinge@baylibre.com>
Thu, 16 Jul 2026 09:35:09 +0000 (11:35 +0200)
committerThomas Schwinge <tschwinge@baylibre.com>
Thu, 16 Jul 2026 10:11:24 +0000 (12:11 +0200)
Per commit 2468c79741f97c2aa0cbb4baaccb86fd4a150910
"OpenMP: Handle 'device_type(host)' on 'target'",
'libgomp.c/target-device-type-3.c':

    [...]
    // NOTE: With offloading,
    //   UNRESOLVED:
    // is expected for the "optimized" tests as those dumps are only enabled
    // for the no-host side.
    [...]
    /* { dg-final { scan-tree-dump "hhh" "optimized" { target offload_device } } } */
    /* { dg-final { scan-tree-dump-not "ggg" "optimized" { target offload_device } } } */
    /* { dg-final { scan-tree-dump-not "_omp_fn" "optimized" { target offload_device } } } */
    [...]

..., resulting in:

    +PASS: libgomp.c/target-device-type-3.c (test for excess errors)
    +PASS: libgomp.c/target-device-type-3.c execution test
    +PASS: libgomp.c/target-device-type-3.c scan-tree-dump-times ompexp "omp declare target" 1
    +PASS: libgomp.c/target-device-type-3.c scan-tree-dump-not ompexp "omp target entrypoint"
    +PASS: libgomp.c/target-device-type-3.c scan-tree-dump ompexp "__builtin_GOMP_target_ext \\(-3,"
    +UNRESOLVED: libgomp.c/target-device-type-3.c scan-tree-dump optimized "hhh"
    +UNRESOLVED: libgomp.c/target-device-type-3.c scan-tree-dump-not optimized "ggg"
    +UNRESOLVED: libgomp.c/target-device-type-3.c scan-tree-dump-not optimized "_omp_fn"

I assume that intended to test what I've now implemented?

    [...]
    -UNRESOLVED: libgomp.c/target-device-type-3.c scan-tree-dump optimized "hhh"
    -UNRESOLVED: libgomp.c/target-device-type-3.c scan-tree-dump-not optimized "ggg"
    -UNRESOLVED: libgomp.c/target-device-type-3.c scan-tree-dump-not optimized "_omp_fn"
    +PASS: libgomp.c/target-device-type-3.c scan-amdgcn-amdhsa-offload-tree-dump optimized "hhh"
    +PASS: libgomp.c/target-device-type-3.c scan-amdgcn-amdhsa-offload-tree-dump-not optimized "ggg"
    +PASS: libgomp.c/target-device-type-3.c scan-amdgcn-amdhsa-offload-tree-dump-not optimized "_omp_fn"
    +PASS: libgomp.c/target-device-type-3.c scan-nvptx-none-offload-tree-dump optimized "hhh"
    +PASS: libgomp.c/target-device-type-3.c scan-nvptx-none-offload-tree-dump-not optimized "ggg"
    +PASS: libgomp.c/target-device-type-3.c scan-nvptx-none-offload-tree-dump-not optimized "_omp_fn"

(Also, effective-target 'offload_device' tests "if [an] offload device is
available", which wasn't the right conditional here: should rather have used
'offload_target_any': "if compiling for any offload target".  But that still
wouldn't have achieved what this intended to test.)

libgomp/
* testsuite/libgomp.c/target-device-type-3.c: Repair offload tree
dump scanning.

libgomp/testsuite/libgomp.c/target-device-type-3.c

index faedcabdf2272838f23b388684e4fa13bdd7e5df..832f714db819f7555fc183383b84b8c1c0785f2b 100644 (file)
@@ -6,11 +6,6 @@
    default-device-var ICV - and it shall not create any device code for
    neither the target region nor the called functions.  */
 
-// NOTE: With offloading,
-//   UNRESOLVED:
-// is expected for the "optimized" tests as those dumps are only enabled
-// for the no-host side.
-
 
 // Due to 'device_type(nohost)', the outlined region shall not be marked
 // as 'target entrypoint' - nor should 'ggg' become implicitly
@@ -28,9 +23,9 @@
 
 // On the device side, expect only hhh:
 
-/* { dg-final { scan-tree-dump "hhh" "optimized" { target offload_device } } } */
-/* { dg-final { scan-tree-dump-not "ggg" "optimized" { target offload_device } } } */
-/* { dg-final { scan-tree-dump-not "_omp_fn" "optimized" { target offload_device } } } */
+/* { dg-final { scan-offload-tree-dump "hhh" "optimized" } } */
+/* { dg-final { scan-offload-tree-dump-not "ggg" "optimized" } } */
+/* { dg-final { scan-offload-tree-dump-not "_omp_fn" "optimized" } } */
 
 
 #include <omp.h>