Hi,
This patch adds some necessary bits to enable OpenACC testings for
amdgcn offloading.
The two "check_effective" procedures are not actually needed yet, but
later patches to test cases will use them.
OK to commit?
Thanks
Andrew
Enable OpenACC GCN testing.
2019-11-14 Andrew Stubbs <a...@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: Set acc_mem_shared for amdgcn.
* testsuite/libgomp.oacc-c/c.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 14d9b5f1305..802c6ea275f 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -316,6 +316,9 @@ proc offload_target_to_openacc_device_type { offload_target } {
nvptx* {
return "nvidia"
}
+ amdgcn* {
+ return "gcn"
+ }
default {
error "Unknown offload target: $offload_target"
}
@@ -444,3 +447,28 @@ 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;
+}
+
diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
index dcefa792ca4..b2502a5f94c 100644
--- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -106,6 +106,9 @@ if { $lang_test_file_found } {
set acc_mem_shared 0
}
+ gcn {
+ set acc_mem_shared 0
+ }
default {
error "Unknown OpenACC device type: $openacc_device_type (offload target: $offload_target)"
}
diff --git a/libgomp/testsuite/libgomp.oacc-c/c.exp b/libgomp/testsuite/libgomp.oacc-c/c.exp
index 55cd40f1e99..420237eafe9 100644
--- a/libgomp/testsuite/libgomp.oacc-c/c.exp
+++ b/libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -69,6 +69,9 @@ foreach offload_target [concat [split $offload_targets ","] "disable"] {
set acc_mem_shared 0
}
+ gcn {
+ set acc_mem_shared 0
+ }
default {
error "Unknown OpenACC device type: $openacc_device_type (offload target: $offload_target)"
}
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index 852f372b319..1a731dd4c24 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
@@ -94,6 +94,9 @@ if { $lang_test_file_found } {
set acc_mem_shared 0
}
+ gcn {
+ set acc_mem_shared 0
+ }
default {
error "Unknown OpenACC device type: $openacc_device_type (offload target: $offload_target)"
}