Enable OpenACC GCN testing.
authorAndrew Stubbs <ams@codesourcery.com>
Tue, 3 Dec 2019 12:53:53 +0000 (12:53 +0000)
committerAndrew Stubbs <ams@gcc.gnu.org>
Tue, 3 Dec 2019 12:53:53 +0000 (12:53 +0000)
2019-12-03  Andrew Stubbs  <ams@codesourcery.com>

libgomp/
* testsuite/lib/libgomp.exp (offload_target_to_openacc_device_type):
Recognize amdgcn.
(check_effective_target_openacc_amdgcn_accel_present): New proc.
(check_effective_target_openacc_amdgcn_accel_selected): New proc.
* testsuite/libgomp.oacc-c++/c++.exp: Add support for amdgcn.
* testsuite/libgomp.oacc-c/c.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.

From-SVN: r278935

libgomp/ChangeLog
libgomp/testsuite/lib/libgomp.exp
libgomp/testsuite/libgomp.oacc-c++/c++.exp
libgomp/testsuite/libgomp.oacc-c/c.exp
libgomp/testsuite/libgomp.oacc-fortran/fortran.exp

index 86761d3d479d951a7f5d403767d86f50bbb59600..af5add845d04a4a42c1af0419be89132b0da76b5 100644 (file)
@@ -1,3 +1,13 @@
+2019-12-03  Andrew Stubbs  <ams@codesourcery.com>
+
+       * testsuite/lib/libgomp.exp (offload_target_to_openacc_device_type):
+       Recognize amdgcn.
+       (check_effective_target_openacc_amdgcn_accel_present): New proc.
+       (check_effective_target_openacc_amdgcn_accel_selected): New proc.
+       * testsuite/libgomp.oacc-c++/c++.exp: Add support for amdgcn.
+       * testsuite/libgomp.oacc-c/c.exp: Likewise.
+       * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
+
 2019-12-03  Szabolcs Nagy  <szabolcs.nagy@arm.com>
 
        PR libgomp/91938
index 06e3186d966b853de4c52164743928d9712ea3f3..f52ed7184e44313520b6754730d6d2a658d3474d 100644 (file)
@@ -318,6 +318,9 @@ proc libgomp_option_proc { option } {
 # not supported, and 'host' for offload target 'disable'.
 proc offload_target_to_openacc_device_type { offload_target } {
     switch -glob $offload_target {
+       amdgcn* {
+           return "gcn"
+       }
        disable {
            return "host"
        }
@@ -479,3 +482,29 @@ proc check_effective_target_hsa_offloading_selected {} {
        check_effective_target_hsa_offloading_selected_nocache
     }]
 }
+
+# Return 1 if at least one AMD GCN board is present.
+
+proc check_effective_target_openacc_amdgcn_accel_present { } {
+    return [check_runtime openacc_amdgcn_accel_present {
+       #include <openacc.h>
+       int main () {
+       return !(acc_get_num_devices (acc_device_gcn) > 0);
+       }
+    } "" ]
+}
+
+# Return 1 if at least one AMD GCN board is present, and the AMD GCN device
+# type is selected by default.
+
+proc check_effective_target_openacc_amdgcn_accel_selected { } {
+    if { ![check_effective_target_openacc_amdgcn_accel_present] } {
+       return 0;
+    }
+    global offload_target
+    if { [string match "amdgcn*" $offload_target] } {
+        return 1;
+    }
+    return 0;
+}
+
index dcefa792ca40a44909fe4818066d261c3458f925..c06c2a097e38f9da33e65160857f640457731c9c 100644 (file)
@@ -88,6 +88,15 @@ if { $lang_test_file_found } {
                unsupported "$subdir $offload_target offloading"
                continue
            }
+           gcn {
+               if { ![check_effective_target_openacc_amdgcn_accel_present] } {
+                   # Don't bother; execution testing is going to FAIL.
+                   untested "$subdir $offload_target offloading: supported, but hardware not accessible"
+                   continue
+               }
+
+               set acc_mem_shared 0
+           }
            host {
                set acc_mem_shared 1
            }
index 55cd40f1e99196d0986fa56d58ed71bc17e057e0..7f13242fd59d6119167436b311a92de8f1ada394 100644 (file)
@@ -51,6 +51,15 @@ foreach offload_target [concat [split $offload_targets ","] "disable"] {
            unsupported "$subdir $offload_target offloading"
            continue
        }
+       gcn {
+           if { ![check_effective_target_openacc_amdgcn_accel_present] } {
+               # Don't bother; execution testing is going to FAIL.
+               untested "$subdir $offload_target offloading: supported, but hardware not accessible"
+               continue
+           }
+
+           set acc_mem_shared 0
+       }
        host {
            set acc_mem_shared 1
        }
index 852f372b319606e452f3879512fba57697c9f97e..60f0889a07cffdd1ce4d380c56d494afae7387fa 100644 (file)
@@ -82,6 +82,15 @@ if { $lang_test_file_found } {
                unsupported "$subdir $offload_target offloading"
                continue
            }
+           gcn {
+               if { ![check_effective_target_openacc_amdgcn_accel_present] } {
+                   # Don't bother; execution testing is going to FAIL.
+                   untested "$subdir $offload_target offloading: supported, but hardware not accessible"
+                   continue
+               }
+
+               set acc_mem_shared 0
+           }
            host {
                set acc_mem_shared 1
            }