annotate libgomp/testsuite/lib/libgomp.exp @ 143:76e1cf5455ef

add cbc_gc test
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 19:24:05 +0900
parents 84e7813d76e9
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 # Damn dejagnu for not having proper library search paths for load_lib.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 # We have to explicitly load everything that gcc-dg.exp wants to load.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 proc load_gcc_lib { filename } {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 global srcdir loaded_libs
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 load_file $srcdir/../../gcc/testsuite/lib/$filename
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 set loaded_libs($filename) ""
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 load_lib dg.exp
111
kono
parents: 55
diff changeset
12
kono
parents: 55
diff changeset
13 # Required to use gcc-dg.exp - however, the latter should NOT be
kono
parents: 55
diff changeset
14 # loaded until ${tool}_target_compile is defined since it uses that
kono
parents: 55
diff changeset
15 # to determine default LTO options.
kono
parents: 55
diff changeset
16
kono
parents: 55
diff changeset
17 load_gcc_lib multiline.exp
kono
parents: 55
diff changeset
18 load_gcc_lib prune.exp
kono
parents: 55
diff changeset
19 load_gcc_lib target-libpath.exp
kono
parents: 55
diff changeset
20 load_gcc_lib wrapper.exp
kono
parents: 55
diff changeset
21 load_gcc_lib target-supports.exp
kono
parents: 55
diff changeset
22 load_gcc_lib target-utils.exp
kono
parents: 55
diff changeset
23 load_gcc_lib gcc-defs.exp
kono
parents: 55
diff changeset
24 load_gcc_lib timeout.exp
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 load_gcc_lib file-format.exp
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 load_gcc_lib target-supports-dg.exp
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 load_gcc_lib scanasm.exp
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 load_gcc_lib scandump.exp
111
kono
parents: 55
diff changeset
29 load_gcc_lib scanlang.exp
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 load_gcc_lib scanrtl.exp
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 load_gcc_lib scantree.exp
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
32 load_gcc_lib scanltranstree.exp
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
33 load_gcc_lib scanoffloadtree.exp
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 load_gcc_lib scanipa.exp
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
35 load_gcc_lib scanwpaipa.exp
111
kono
parents: 55
diff changeset
36 load_gcc_lib timeout-dg.exp
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 load_gcc_lib torture-options.exp
111
kono
parents: 55
diff changeset
38 load_gcc_lib fortran-modules.exp
kono
parents: 55
diff changeset
39
kono
parents: 55
diff changeset
40 # Try to load a test support file, built during libgomp configuration.
kono
parents: 55
diff changeset
41 load_file libgomp-test-support.exp
kono
parents: 55
diff changeset
42
kono
parents: 55
diff changeset
43 # Populate offload_targets_s (offloading targets separated by a space), and
kono
parents: 55
diff changeset
44 # offload_targets_s_openacc (the same, but with OpenACC names; OpenACC spells
kono
parents: 55
diff changeset
45 # some of them a little differently).
kono
parents: 55
diff changeset
46 set offload_targets_s [split $offload_targets ","]
kono
parents: 55
diff changeset
47 set offload_targets_s_openacc {}
kono
parents: 55
diff changeset
48 foreach offload_target_openacc $offload_targets_s {
kono
parents: 55
diff changeset
49 # Translate to OpenACC names, or skip if not yet supported.
kono
parents: 55
diff changeset
50 switch $offload_target_openacc {
kono
parents: 55
diff changeset
51 intelmic {
kono
parents: 55
diff changeset
52 continue
kono
parents: 55
diff changeset
53 }
kono
parents: 55
diff changeset
54 nvptx {
kono
parents: 55
diff changeset
55 set offload_target_openacc "nvidia"
kono
parents: 55
diff changeset
56 }
kono
parents: 55
diff changeset
57 hsa {
kono
parents: 55
diff changeset
58 continue
kono
parents: 55
diff changeset
59 }
kono
parents: 55
diff changeset
60 }
kono
parents: 55
diff changeset
61 lappend offload_targets_s_openacc "$offload_target_openacc"
kono
parents: 55
diff changeset
62 }
kono
parents: 55
diff changeset
63 lappend offload_targets_s_openacc "host"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 set dg-do-what-default run
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 #
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 # GCC_UNDER_TEST is the compiler under test.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 #
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 set libgomp_compile_options ""
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 #
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 # libgomp_init
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 #
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 if [info exists TOOL_OPTIONS] {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 set multilibs [get_multilibs $TOOL_OPTIONS]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 } else {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 set multilibs [get_multilibs]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 proc libgomp_init { args } {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 global srcdir blddir objdir tool_root_dir
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 global libgomp_initialized
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 global tmpdir
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 global blddir
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 global gluefile wrap_flags
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 global ALWAYS_CFLAGS
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 global CFLAGS
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 global TOOL_EXECUTABLE TOOL_OPTIONS
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 global GCC_UNDER_TEST
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 global TESTING_IN_BUILD_TREE
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 global target_triplet
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 global always_ld_library_path
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 set blddir [lookfor_file [get_multilibs] libgomp]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 # We set LC_ALL and LANG to C so that we get the same error
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 # messages as expected.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 setenv LC_ALL C
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 setenv LANG C
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
104 # Many hosts now default to a non-ASCII C locale, however, so
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
105 # they can set a charset encoding here if they need.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
106 if { [ishost "*-*-cygwin*"] } {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
107 setenv LC_ALL C.ASCII
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
108 setenv LANG C.ASCII
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
109 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
110
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 if ![info exists GCC_UNDER_TEST] then {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 if [info exists TOOL_EXECUTABLE] {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 set GCC_UNDER_TEST $TOOL_EXECUTABLE
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 } else {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 set GCC_UNDER_TEST "[find_gcc]"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
118
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 if ![info exists tmpdir] {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 set tmpdir "/tmp"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 if [info exists gluefile] {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 unset gluefile
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
126
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 if {![info exists CFLAGS]} {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 set CFLAGS ""
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 # Locate libgcc.a so we don't need to account for different values of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 # SHLIB_EXT on different platforms
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 if {$gccdir != ""} {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 set gccdir [file dirname $gccdir]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 # Compute what needs to be put into LD_LIBRARY_PATH
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 set always_ld_library_path ".:${blddir}/.libs"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
140
111
kono
parents: 55
diff changeset
141 # Add liboffloadmic build directory in LD_LIBRARY_PATH to support
kono
parents: 55
diff changeset
142 # non-fallback testing for Intel MIC targets
kono
parents: 55
diff changeset
143 global offload_targets
kono
parents: 55
diff changeset
144 if { [string match "*,intelmic,*" ",$offload_targets,"] } {
kono
parents: 55
diff changeset
145 append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
kono
parents: 55
diff changeset
146 append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
kono
parents: 55
diff changeset
147 # libstdc++ is required by liboffloadmic
kono
parents: 55
diff changeset
148 append always_ld_library_path ":${blddir}/../libstdc++-v3/src/.libs"
kono
parents: 55
diff changeset
149 # libgcc_s is required by libstdc++
kono
parents: 55
diff changeset
150 append always_ld_library_path ":${blddir}/../libgcc"
kono
parents: 55
diff changeset
151 }
kono
parents: 55
diff changeset
152
kono
parents: 55
diff changeset
153 global offload_additional_lib_paths
kono
parents: 55
diff changeset
154 if { $offload_additional_lib_paths != "" } {
kono
parents: 55
diff changeset
155 append always_ld_library_path "${offload_additional_lib_paths}"
kono
parents: 55
diff changeset
156 }
kono
parents: 55
diff changeset
157
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 # Compute what needs to be added to the existing LD_LIBRARY_PATH.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 if {$gccdir != ""} {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 # Add AIX pthread directory first.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 if { [llength [glob -nocomplain ${gccdir}/pthread/libgcc_s*.a]] >= 1 } {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 append always_ld_library_path ":${gccdir}/pthread"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 append always_ld_library_path ":${gccdir}"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 set compiler [lindex $GCC_UNDER_TEST 0]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 if { [is_remote host] == 0 && [which $compiler] != 0 } {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 foreach i "[exec $compiler --print-multi-lib]" {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 set mldir ""
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171 set mldir [string trimright $mldir "\;@"]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 if { "$mldir" == "." } {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 continue
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 append always_ld_library_path ":${gccdir}/${mldir}"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 set ALWAYS_CFLAGS ""
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 if { $blddir != "" } {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
185 # targets that use libgomp.a%s in their specs need a -B option
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
186 # for uninstalled testing.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
187 lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 }
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
191 # The top-level include directory, for gomp-constants.h.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
192 lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/../../include"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
111
kono
parents: 55
diff changeset
194
kono
parents: 55
diff changeset
195 # For build-tree testing, also consider the library paths used for builing.
kono
parents: 55
diff changeset
196 # For installed testing, we assume all that to be provided in the sysroot.
kono
parents: 55
diff changeset
197 if { $blddir != "" } {
kono
parents: 55
diff changeset
198 global cuda_driver_include
kono
parents: 55
diff changeset
199 global cuda_driver_lib
kono
parents: 55
diff changeset
200 if { $cuda_driver_include != "" } {
kono
parents: 55
diff changeset
201 # Stop gfortran from freaking out:
kono
parents: 55
diff changeset
202 # Warning: Nonexistent include directory "[...]"
kono
parents: 55
diff changeset
203 if {[file exists $cuda_driver_include]} {
kono
parents: 55
diff changeset
204 lappend ALWAYS_CFLAGS "additional_flags=-I$cuda_driver_include"
kono
parents: 55
diff changeset
205 }
kono
parents: 55
diff changeset
206 }
kono
parents: 55
diff changeset
207 if { $cuda_driver_lib != "" } {
kono
parents: 55
diff changeset
208 lappend ALWAYS_CFLAGS "additional_flags=-L$cuda_driver_lib"
kono
parents: 55
diff changeset
209 append always_ld_library_path ":$cuda_driver_lib"
kono
parents: 55
diff changeset
210 }
kono
parents: 55
diff changeset
211 global hsa_runtime_lib
kono
parents: 55
diff changeset
212 if { $hsa_runtime_lib != "" } {
kono
parents: 55
diff changeset
213 append always_ld_library_path ":$hsa_runtime_lib"
kono
parents: 55
diff changeset
214 }
kono
parents: 55
diff changeset
215 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
216
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 # We use atomic operations in the testcases to validate results.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 if { ([istarget i?86-*-*] || [istarget x86_64-*-*])
111
kono
parents: 55
diff changeset
219 && [check_effective_target_ia32] } {
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 lappend ALWAYS_CFLAGS "additional_flags=-march=i486"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
222
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 if [istarget *-*-darwin*] {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
225 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
226
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 if [istarget sparc*-*-*] {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 lappend ALWAYS_CFLAGS "additional_flags=-mcpu=v9"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
230
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
231 if [info exists TOOL_OPTIONS] {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 lappend ALWAYS_CFLAGS "additional_flags=$TOOL_OPTIONS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
234
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
235 # Make sure that lines are not wrapped. That can confuse the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
236 # error-message parsing machinery.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
237 lappend ALWAYS_CFLAGS "additional_flags=-fmessage-length=0"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
238
111
kono
parents: 55
diff changeset
239 # Disable caret
kono
parents: 55
diff changeset
240 lappend ALWAYS_CFLAGS "additional_flags=-fno-diagnostics-show-caret"
kono
parents: 55
diff changeset
241
kono
parents: 55
diff changeset
242 # Disable HSA warnings by default.
kono
parents: 55
diff changeset
243 lappend ALWAYS_CFLAGS "additional_flags=-Wno-hsa"
kono
parents: 55
diff changeset
244
kono
parents: 55
diff changeset
245 # Disable color diagnostics
kono
parents: 55
diff changeset
246 lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
kono
parents: 55
diff changeset
247
kono
parents: 55
diff changeset
248 # Used for support non-fallback offloading.
kono
parents: 55
diff changeset
249 # Help GCC to find target mkoffload.
kono
parents: 55
diff changeset
250 global offload_additional_options
kono
parents: 55
diff changeset
251 if { $offload_additional_options != "" } {
kono
parents: 55
diff changeset
252 lappend ALWAYS_CFLAGS "additional_flags=${offload_additional_options}"
kono
parents: 55
diff changeset
253 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
254 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
255
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
256 #
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
257 # libgomp_target_compile -- compile a source file
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
258 #
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
259
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
260 proc libgomp_target_compile { source dest type options } {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
261 global blddir
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
262 global libgomp_compile_options
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
263 global gluefile wrap_flags
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
264 global ALWAYS_CFLAGS
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
265 global GCC_UNDER_TEST
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
266 global lang_test_file
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
267 global lang_library_path
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
268 global lang_link_flags
111
kono
parents: 55
diff changeset
269 global lang_include_flags
kono
parents: 55
diff changeset
270 global lang_source_re
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
271
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
272 if { [info exists lang_test_file] } {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
273 if { $blddir != "" } {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
274 # Some targets use libgfortran.a%s in their specs, so they need
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
275 # a -B option for uninstalled testing.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
276 lappend options "additional_flags=-B${blddir}/${lang_library_path}"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
277 lappend options "ldflags=-L${blddir}/${lang_library_path}"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
278 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 lappend options "ldflags=${lang_link_flags}"
111
kono
parents: 55
diff changeset
280 if { [info exists lang_include_flags] \
kono
parents: 55
diff changeset
281 && [regexp ${lang_source_re} ${source}] } {
kono
parents: 55
diff changeset
282 lappend options "additional_flags=${lang_include_flags}"
kono
parents: 55
diff changeset
283 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
284 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
285
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
287 lappend options "libs=${gluefile}"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 lappend options "ldflags=${wrap_flags}"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
289 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
290
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
291 lappend options "additional_flags=[libio_include_flags]"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
292 lappend options "timeout=[timeout_value]"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
293 lappend options "compiler=$GCC_UNDER_TEST"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
294
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
295 set options [concat $libgomp_compile_options $options]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
296
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
297 if [info exists ALWAYS_CFLAGS] {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
298 set options [concat "$ALWAYS_CFLAGS" $options]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
299 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
300
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
301 set options [dg-additional-files-options $options $source]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
302
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
303 set result [target_compile $source $dest $type $options]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
304
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
305 return $result
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
306 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
307
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
308 proc libgomp_option_help { } {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
309 send_user " --additional_options,OPTIONS\t\tUse OPTIONS to compile the testcase files. OPTIONS should be comma-separated.\n"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
310 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
311
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
312 proc libgomp_option_proc { option } {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
313 if [regexp "^--additional_options," $option] {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
314 global libgomp_compile_options
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
315 regsub "--additional_options," $option "" option
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 foreach x [split $option ","] {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
317 lappend libgomp_compile_options "additional_flags=$x"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
318 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
319 return 1
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 } else {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
321 return 0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
322 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
323 }
111
kono
parents: 55
diff changeset
324
kono
parents: 55
diff changeset
325 # Return 1 if offload device is available.
kono
parents: 55
diff changeset
326 proc check_effective_target_offload_device { } {
kono
parents: 55
diff changeset
327 return [check_runtime_nocache offload_device_available_ {
kono
parents: 55
diff changeset
328 #include <omp.h>
kono
parents: 55
diff changeset
329 int main ()
kono
parents: 55
diff changeset
330 {
kono
parents: 55
diff changeset
331 int a;
kono
parents: 55
diff changeset
332 #pragma omp target map(from: a)
kono
parents: 55
diff changeset
333 a = omp_is_initial_device ();
kono
parents: 55
diff changeset
334 return a;
kono
parents: 55
diff changeset
335 }
kono
parents: 55
diff changeset
336 } ]
kono
parents: 55
diff changeset
337 }
kono
parents: 55
diff changeset
338
kono
parents: 55
diff changeset
339 # Return 1 if offload device is available and it has non-shared address space.
kono
parents: 55
diff changeset
340 proc check_effective_target_offload_device_nonshared_as { } {
kono
parents: 55
diff changeset
341 return [check_runtime_nocache offload_device_nonshared_as {
kono
parents: 55
diff changeset
342 int main ()
kono
parents: 55
diff changeset
343 {
kono
parents: 55
diff changeset
344 int a = 8;
kono
parents: 55
diff changeset
345 #pragma omp target map(to: a)
kono
parents: 55
diff changeset
346 a++;
kono
parents: 55
diff changeset
347 return a != 8;
kono
parents: 55
diff changeset
348 }
kono
parents: 55
diff changeset
349 } ]
kono
parents: 55
diff changeset
350 }
kono
parents: 55
diff changeset
351
kono
parents: 55
diff changeset
352 # Return 1 if offload device is available and it has shared address space.
kono
parents: 55
diff changeset
353 proc check_effective_target_offload_device_shared_as { } {
kono
parents: 55
diff changeset
354 return [check_runtime_nocache offload_device_shared_as {
kono
parents: 55
diff changeset
355 int main ()
kono
parents: 55
diff changeset
356 {
kono
parents: 55
diff changeset
357 int x = 10;
kono
parents: 55
diff changeset
358 #pragma omp target map(to: x)
kono
parents: 55
diff changeset
359 x++;
kono
parents: 55
diff changeset
360 return x == 10;
kono
parents: 55
diff changeset
361 }
kono
parents: 55
diff changeset
362 } ]
kono
parents: 55
diff changeset
363 }
kono
parents: 55
diff changeset
364
kono
parents: 55
diff changeset
365 # Return 1 if configured for nvptx offloading.
kono
parents: 55
diff changeset
366
kono
parents: 55
diff changeset
367 proc check_effective_target_openacc_nvidia_accel_configured { } {
kono
parents: 55
diff changeset
368 global offload_targets
kono
parents: 55
diff changeset
369 if { ![string match "*,nvptx,*" ",$offload_targets,"] } {
kono
parents: 55
diff changeset
370 return 0
kono
parents: 55
diff changeset
371 }
kono
parents: 55
diff changeset
372 # PR libgomp/65099: Currently, we only support offloading in 64-bit
kono
parents: 55
diff changeset
373 # configurations.
kono
parents: 55
diff changeset
374 return [is-effective-target lp64]
kono
parents: 55
diff changeset
375 }
kono
parents: 55
diff changeset
376
kono
parents: 55
diff changeset
377 # Return 1 if at least one nvidia board is present.
kono
parents: 55
diff changeset
378
kono
parents: 55
diff changeset
379 proc check_effective_target_openacc_nvidia_accel_present { } {
kono
parents: 55
diff changeset
380 return [check_runtime openacc_nvidia_accel_present {
kono
parents: 55
diff changeset
381 #include <openacc.h>
kono
parents: 55
diff changeset
382 int main () {
kono
parents: 55
diff changeset
383 return !(acc_get_num_devices (acc_device_nvidia) > 0);
kono
parents: 55
diff changeset
384 }
kono
parents: 55
diff changeset
385 } "" ]
kono
parents: 55
diff changeset
386 }
kono
parents: 55
diff changeset
387
kono
parents: 55
diff changeset
388 # Return 1 if at least one nvidia board is present, and the nvidia device type
kono
parents: 55
diff changeset
389 # is selected by default by means of setting the environment variable
kono
parents: 55
diff changeset
390 # ACC_DEVICE_TYPE.
kono
parents: 55
diff changeset
391
kono
parents: 55
diff changeset
392 proc check_effective_target_openacc_nvidia_accel_selected { } {
kono
parents: 55
diff changeset
393 if { ![check_effective_target_openacc_nvidia_accel_present] } {
kono
parents: 55
diff changeset
394 return 0;
kono
parents: 55
diff changeset
395 }
kono
parents: 55
diff changeset
396 global offload_target_openacc
kono
parents: 55
diff changeset
397 if { $offload_target_openacc == "nvidia" } {
kono
parents: 55
diff changeset
398 return 1;
kono
parents: 55
diff changeset
399 }
kono
parents: 55
diff changeset
400 return 0;
kono
parents: 55
diff changeset
401 }
kono
parents: 55
diff changeset
402
kono
parents: 55
diff changeset
403 # Return 1 if the host target is selected for offloaded
kono
parents: 55
diff changeset
404
kono
parents: 55
diff changeset
405 proc check_effective_target_openacc_host_selected { } {
kono
parents: 55
diff changeset
406 global offload_target_openacc
kono
parents: 55
diff changeset
407 if { $offload_target_openacc == "host" } {
kono
parents: 55
diff changeset
408 return 1;
kono
parents: 55
diff changeset
409 }
kono
parents: 55
diff changeset
410 return 0;
kono
parents: 55
diff changeset
411 }
kono
parents: 55
diff changeset
412
kono
parents: 55
diff changeset
413 # Return 1 if the selected OMP device is actually a HSA device
kono
parents: 55
diff changeset
414
kono
parents: 55
diff changeset
415 proc check_effective_target_hsa_offloading_selected_nocache {} {
kono
parents: 55
diff changeset
416 global tool
kono
parents: 55
diff changeset
417
kono
parents: 55
diff changeset
418 set src {
kono
parents: 55
diff changeset
419 int main () {
kono
parents: 55
diff changeset
420 int v = 1;
kono
parents: 55
diff changeset
421 #pragma omp target map(from:v)
kono
parents: 55
diff changeset
422 v = 0;
kono
parents: 55
diff changeset
423 return v;
kono
parents: 55
diff changeset
424 }
kono
parents: 55
diff changeset
425 }
kono
parents: 55
diff changeset
426
kono
parents: 55
diff changeset
427 set result [check_compile hsa_offloading_src executable $src]
kono
parents: 55
diff changeset
428 set lines [lindex $result 0]
kono
parents: 55
diff changeset
429 set exe [lindex $result 1]
kono
parents: 55
diff changeset
430
kono
parents: 55
diff changeset
431 set ok 0
kono
parents: 55
diff changeset
432 if { [string match "" $lines] } {
kono
parents: 55
diff changeset
433 # No error messages, let us switch on HSA debugging output and run it
kono
parents: 55
diff changeset
434 set prev_HSA_DEBUG [getenv HSA_DEBUG]
kono
parents: 55
diff changeset
435 setenv HSA_DEBUG "1"
kono
parents: 55
diff changeset
436 set result [remote_load target "./$exe"]
kono
parents: 55
diff changeset
437 if { [string match "" $prev_HSA_DEBUG] } {
kono
parents: 55
diff changeset
438 unsetenv HSA_DEBUG
kono
parents: 55
diff changeset
439 } else {
kono
parents: 55
diff changeset
440 setenv HSA_DEBUG $prev_HSA_DEBUG
kono
parents: 55
diff changeset
441 }
kono
parents: 55
diff changeset
442 set status [lindex $result 0]
kono
parents: 55
diff changeset
443 if { $status != "pass" } {
kono
parents: 55
diff changeset
444 remote_file build delete $exe
kono
parents: 55
diff changeset
445 verbose "HSA availability test failed"
kono
parents: 55
diff changeset
446 return 0
kono
parents: 55
diff changeset
447 }
kono
parents: 55
diff changeset
448 set output [lindex $result 1]
kono
parents: 55
diff changeset
449 if { [string match "*HSA debug: Going to dispatch kernel*" $output] } {
kono
parents: 55
diff changeset
450 verbose "HSA availability detected"
kono
parents: 55
diff changeset
451 set ok 1
kono
parents: 55
diff changeset
452 }
kono
parents: 55
diff changeset
453 }
kono
parents: 55
diff changeset
454 remote_file build delete $exe
kono
parents: 55
diff changeset
455 return $ok
kono
parents: 55
diff changeset
456 }
kono
parents: 55
diff changeset
457
kono
parents: 55
diff changeset
458 # Return 1 if the selected OMP device is actually a HSA device and
kono
parents: 55
diff changeset
459 # cache the result
kono
parents: 55
diff changeset
460
kono
parents: 55
diff changeset
461 proc check_effective_target_hsa_offloading_selected {} {
kono
parents: 55
diff changeset
462 return [check_cached_effective_target hsa_offloading_selected {
kono
parents: 55
diff changeset
463 check_effective_target_hsa_offloading_selected_nocache
kono
parents: 55
diff changeset
464 }]
kono
parents: 55
diff changeset
465 }