[Flang][RISCV] Set vscale_range based off zvl*b (#77277)
[llvm-project.git] / flang / module / omp_lib.h
blobefc9ceb16968bbf3ef67ab7555466b3e81c50069
1 !===-- module/omp_lib.h ------------------------------------------*- F90 -*-===!
3 ! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 ! See https://llvm.org/LICENSE.txt for license information.
5 ! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 !===------------------------------------------------------------------------===!
9 !dir$ free
11 integer, parameter :: omp_integer_kind = selected_int_kind(9) ! 32-bit int
12 integer, parameter :: omp_logical_kind = 1 ! C_BOOL
14 integer, parameter :: omp_sched_kind = omp_integer_kind
15 integer, parameter :: omp_proc_bind_kind = omp_integer_kind
16 integer, parameter :: omp_pause_resource_kind = omp_integer_kind
17 integer, parameter :: omp_sync_hint_kind = omp_integer_kind
18 integer, parameter :: omp_lock_hint_kind = omp_sync_hint_kind
19 integer, parameter :: omp_event_handle_kind = omp_integer_kind
20 integer, parameter :: omp_alloctrait_key_kind = omp_integer_kind
21 integer, parameter :: omp_alloctrait_val_kind = omp_integer_kind
22 integer, parameter :: omp_allocator_handle_kind = omp_integer_kind
23 integer, parameter :: omp_memspace_handle_kind = omp_integer_kind
24 integer, parameter :: omp_lock_kind = int_ptr_kind()
25 integer, parameter :: omp_nest_lock_kind = int_ptr_kind()
26 integer, parameter :: omp_depend_kind = omp_integer_kind
28 integer(kind=omp_sched_kind), parameter :: &
29 omp_sched_static = 1, &
30 omp_sched_dynamic = 2, &
31 omp_sched_guided = 3, &
32 omp_sched_auto = 4
34 integer(kind=omp_proc_bind_kind), parameter :: &
35 omp_proc_bind_false = 0, &
36 omp_proc_bind_true = 1, &
37 omp_proc_bind_master = 2, &
38 omp_proc_bind_close = 3, &
39 omp_proc_bind_spread = 4
41 integer(kind=omp_pause_resource_kind), parameter :: &
42 omp_pause_soft = 1, &
43 omp_pause_hard = 2
45 integer(kind=omp_sync_hint_kind), parameter :: &
46 omp_sync_hint_none = 0, &
47 omp_sync_hint_uncontended = 1, &
48 omp_sync_hint_contended = 2, &
49 omp_sync_hint_nonspeculative = 4, &
50 omp_sync_hint_speculative = 8
51 integer(kind=omp_lock_hint_kind), parameter :: &
52 omp_lock_hint_none = omp_sync_hint_none, &
53 omp_lock_hint_uncontended = omp_sync_hint_uncontended, &
54 omp_lock_hint_contended = omp_sync_hint_contended, &
55 omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative, &
56 omp_lock_hint_speculative = omp_sync_hint_speculative
58 integer(kind=omp_event_handle_kind), parameter :: &
59 omp_allow_completion_event = 0, &
60 omp_task_fulfill_event = 1
62 integer(kind=omp_alloctrait_key_kind), parameter :: &
63 omp_atk_sync_hint = 1, &
64 omp_atk_alignment = 2, &
65 omp_atk_access = 3, &
66 omp_atk_pool_size = 4, &
67 omp_atk_fallback = 5, &
68 omp_atk_fb_data = 6, &
69 omp_atk_pinned = 7, &
70 omp_atk_partition = 8
72 integer(kind=omp_alloctrait_val_kind), parameter :: &
73 omp_atv_false = 0, &
74 omp_atv_true = 1, &
75 omp_atv_default = 2, &
76 omp_atv_contended = 3, &
77 omp_atv_uncontended = 4, &
78 omp_atv_sequential = 5, &
79 omp_atv_private = 6, &
80 omp_atv_all = 7, &
81 omp_atv_thread = 8, &
82 omp_atv_pteam = 9, &
83 omp_atv_cgroup = 10, &
84 omp_atv_default_mem_fb = 11, &
85 omp_atv_null_fb = 12, &
86 omp_atv_abort_fb = 13, &
87 omp_atv_allocator_fb = 14, &
88 omp_atv_environment = 15, &
89 omp_atv_nearest = 16, &
90 omp_atv_blocked = 17, &
91 omp_atv_interleaved = 18
93 type, bind(c) :: omp_alloctrait
94 integer(kind=omp_alloctrait_key_kind) :: key, value
95 end type omp_alloctrait
97 integer(kind=omp_allocator_handle_kind), parameter :: omp_null_allocator = 0
99 integer(kind=omp_memspace_handle_kind), parameter :: &
100 omp_default_mem_space = 0, &
101 omp_large_cap_mem_space = 0, &
102 omp_const_mem_space = 0, &
103 omp_high_bw_mem_space = 0, &
104 omp_low_lat_mem_space = 0, &
105 omp_default_mem_alloc = 1, &
106 omp_large_cap_mem_alloc = omp_default_mem_alloc, &
107 omp_const_mem_alloc = 1, &
108 omp_high_bw_mem_alloc = 1, &
109 omp_low_lat_mem_alloc = 1, &
110 omp_thread_mem_alloc = omp_atv_thread, &
111 omp_pteam_mem_alloc = omp_atv_pteam, &
112 omp_cgroup_mem_alloc = omp_atv_cgroup
114 integer(kind=omp_integer_kind), parameter :: openmp_version = 200805
116 interface
118 subroutine omp_set_num_threads(nthreads) bind(c)
119 import
120 integer(kind=omp_integer_kind), value :: nthreads
121 end subroutine omp_set_num_threads
123 function omp_get_num_threads() bind(c)
124 import
125 integer(kind=omp_integer_kind) :: omp_get_num_threads
126 end function omp_get_num_threads
128 function omp_get_max_threads() bind(c)
129 import
130 integer(kind=omp_integer_kind) :: omp_get_max_threads
131 end function omp_get_max_threads
133 function omp_get_thread_num() bind(c)
134 import
135 integer(kind=omp_integer_kind) :: omp_get_thread_num
136 end function omp_get_thread_num
138 function omp_get_num_procs() bind(c)
139 import
140 integer(kind=omp_integer_kind) :: omp_get_num_procs
141 end function omp_get_num_procs
143 function omp_in_parallel() bind(c)
144 import
145 logical(kind=omp_logical_kind) :: omp_in_parallel
146 end function omp_in_parallel
148 subroutine omp_set_dynamic(enable) bind(c)
149 import
150 logical(kind=omp_logical_kind), value :: enable
151 end subroutine omp_set_dynamic
153 function omp_get_dynamic() bind(c)
154 import
155 logical(kind=omp_logical_kind) :: omp_get_dynamic
156 end function omp_get_dynamic
158 function omp_get_cancelation() bind(c)
159 import
160 logical(kind=omp_logical_kind) :: omp_get_cancelation
161 end function omp_get_cancelation
163 subroutine omp_set_nested(enable) bind(c)
164 import
165 logical(kind=omp_logical_kind), value :: enable
166 end subroutine omp_set_nested
168 function omp_get_nested() bind(c)
169 import
170 logical(kind=omp_logical_kind) ::omp_get_nested
171 end function omp_get_nested
173 subroutine omp_set_schedule(kind, modifier) bind(c)
174 import
175 integer(kind=omp_integer_kind), value :: kind, modifier
176 end subroutine omp_set_schedule
178 subroutine omp_get_schedule(kind, modifier) bind(c)
179 import
180 integer(kind=omp_integer_kind), intent(out) :: kind, modifier
181 end subroutine omp_get_schedule
183 function omp_get_thread_limit() bind(c)
184 import
185 integer(kind=omp_integer_kind) :: omp_get_thread_limit
186 end function omp_get_thread_limit
188 function omp_get_supported_active_levels() bind(c)
189 import
190 integer(kind=omp_integer_kind) :: omp_get_supported_active_levels
191 end function omp_get_supported_active_levels
193 subroutine omp_set_max_active_levels(max_levels) bind(c)
194 import
195 integer(kind=omp_integer_kind), value :: max_levels
196 end subroutine omp_set_max_active_levels
198 function omp_get_max_active_levels() bind(c)
199 import
200 integer(kind=omp_integer_kind) :: omp_get_max_active_levels
201 end function omp_get_max_active_levels
203 function omp_get_level() bind(c)
204 import
205 integer(kind=omp_integer_kind) :: omp_get_level
206 end function omp_get_level
208 function omp_get_ancestor_thread_num(level) bind(c)
209 import
210 integer(kind=omp_integer_kind), value :: level
211 integer(kind=omp_integer_kind) :: omp_get_ancestor_thread_num
212 end function omp_get_ancestor_thread_num
214 function omp_get_team_size(level) bind(c)
215 import
216 integer(kind=omp_integer_kind), value :: level
217 integer(kind=omp_integer_kind) :: omp_get_team_size
218 end function omp_get_team_size
220 function omp_get_active_level() bind(c)
221 import
222 integer(kind=omp_integer_kind) :: omp_get_active_level
223 end function omp_get_active_level
225 function omp_in_final() bind(c)
226 import
227 logical(kind=omp_logical_kind) :: omp_in_final
228 end function omp_in_final
230 function omp_get_proc_bind() bind(c)
231 import
232 integer(kind=omp_proc_bind_kind) :: omp_get_proc_bind
233 end function omp_get_proc_bind
235 function omp_get_num_places() bind(c)
236 import
237 integer(kind=omp_integer_kind) :: omp_get_num_places
238 end function omp_get_num_places
240 function omp_get_place_num_procs(place_num) bind(c)
241 import
242 integer(kind=omp_integer_kind), value :: place_num
243 integer(kind=omp_integer_kind) omp_get_place_num_procs
244 end function omp_get_place_num_procs
246 subroutine omp_get_place_proc_ids(place_num, ids) bind(c)
247 import
248 integer(kind=omp_integer_kind), value :: place_num
249 integer(kind=omp_integer_kind), intent(out) :: ids(*)
250 end subroutine omp_get_place_proc_ids
252 function omp_get_place_num() bind(c)
253 import
254 integer(kind=omp_integer_kind) :: omp_get_place_num
255 end function omp_get_place_num
257 function omp_get_partition_num_places() bind(c)
258 import
259 integer(kind=omp_integer_kind) :: omp_get_partition_num_places
260 end function omp_get_partition_num_places
262 subroutine omp_get_partition_place_nums(place_nums) bind(c)
263 import
264 integer(kind=omp_integer_kind), intent(out) :: place_nums(*)
265 end subroutine omp_get_partition_place_nums
267 subroutine omp_set_affinity_format(format) bind(c)
268 import
269 character(len=*), intent(in) :: format
270 end subroutine omp_set_affinity_format
272 function omp_get_affinity_format(buffer) bind(c)
273 import
274 character(len=*), intent(out) :: buffer
275 integer(kind=omp_integer_kind) :: omp_get_affinity_format
276 end function omp_get_affinity_format
278 subroutine omp_display_affinity(format) bind(c)
279 import
280 character(len=*), intent(in) :: format
281 end subroutine omp_display_affinity
283 function omp_capture_affinity(buffer, format) bind(c)
284 import
285 character(len=*), intent(out) :: buffer
286 character(len=*), intent(in) :: format
287 integer(kind=omp_integer_kind) omp_capture_affinity
288 end function omp_capture_affinity
290 subroutine omp_set_default_device(device_num) bind(c)
291 import
292 integer(kind=omp_integer_kind), value :: device_num
293 end subroutine omp_set_default_device
295 function omp_get_default_device() bind(c)
296 import
297 integer(kind=omp_integer_kind) :: omp_get_default_device
298 end function omp_get_default_device
300 function omp_get_num_devices() bind(c)
301 import
302 integer(kind=omp_integer_kind) :: omp_get_num_devices
303 end function omp_get_num_devices
305 function omp_get_device_num() bind(c)
306 import
307 integer(kind=omp_integer_kind) :: omp_get_device_num
308 end function omp_get_device_num
310 function omp_get_num_teams() bind(c)
311 import
312 integer(kind=omp_integer_kind) :: omp_get_num_teams
313 end function omp_get_num_teams
315 function omp_get_team_num() bind(c)
316 import
317 integer(kind=omp_integer_kind) :: omp_get_team_num
318 end function omp_get_team_num
320 function omp_is_initial_device() bind(c)
321 import
322 integer(kind=omp_logical_kind) :: omp_is_initial_device ! TODO: should this be LOGICAL?
323 end function omp_is_initial_device
325 function omp_get_initial_device() bind(c)
326 import
327 integer(kind=omp_integer_kind) :: omp_get_initial_device
328 end function omp_get_initial_device
330 function omp_get_max_task_priority() bind(c)
331 import
332 integer(kind=omp_integer_kind) :: omp_get_max_task_priority
333 end function omp_get_max_task_priority
335 function omp_pause_resource(kind, device_num) bind(c)
336 import
337 integer(kind=omp_pause_resource_kind), value :: kind
338 integer(kind=omp_integer_kind), value :: device_num
339 integer(kind=omp_integer_kind) :: omp_pause_resource
340 end function omp_pause_resource
342 function omp_pause_resource_all(kind) bind(c)
343 import
344 integer(kind=omp_pause_resource_kind), value :: kind
345 integer(kind=omp_integer_kind) :: omp_pause_resource_all
346 end function omp_pause_resource_all
348 ! Lock routines
349 subroutine omp_init_lock(lockvar) bind(c, name="omp_init_lock_")
350 import
351 integer(kind=omp_lock_kind), intent(out) :: lockvar
352 end subroutine omp_init_lock
354 subroutine omp_init_lock_with_hint(lockvar, hint) bind(c, name="omp_init_lock_with_hint_")
355 import
356 integer(kind=omp_lock_kind), intent(out) :: lockvar
357 integer(kind=omp_sync_hint_kind), value :: hint
358 end subroutine omp_init_lock_with_hint
360 subroutine omp_destroy_lock(lockvar) bind(c, name="omp_destroy_lock_")
361 import
362 integer(kind=omp_lock_kind), intent(inout) :: lockvar
363 end subroutine omp_destroy_lock
365 subroutine omp_set_lock(lockvar) bind(c, name="omp_set_lock_")
366 import
367 integer(kind=omp_lock_kind), intent(inout) :: lockvar
368 end subroutine omp_set_lock
370 subroutine omp_unset_lock(lockvar) bind(c, name="omp_unset_lock_")
371 import
372 integer(kind=omp_lock_kind), intent(inout) :: lockvar
373 end subroutine omp_unset_lock
375 function omp_test_lock(lockvar) bind(c, name="omp_test_lock_")
376 import
377 integer(kind=omp_lock_kind), intent(inout) :: lockvar
378 logical(kind=omp_logical_kind) :: omp_test_lock
379 end function omp_test_lock
381 subroutine omp_init_nest_lock(lockvar) bind(c, name="omp_init_nest_lock_")
382 import
383 integer(kind=omp_nest_lock_kind), intent(out) :: lockvar
384 end subroutine omp_init_nest_lock
386 subroutine omp_init_nest_lock_with_hint(lockvar, hint) bind(c, name="omp_init_nest_lock_with_hint_")
387 import
388 integer(kind=omp_nest_lock_kind), intent(out) :: lockvar
389 integer(kind=omp_sync_hint_kind), value :: hint
390 end subroutine omp_init_nest_lock_with_hint
392 subroutine omp_destroy_nest_lock(lockvar) bind(c, name="omp_destroy_nest_lock_")
393 import
394 integer(kind=omp_nest_lock_kind), intent(inout) :: lockvar
395 end subroutine omp_destroy_nest_lock
397 subroutine omp_set_nest_lock(lockvar) bind(c, name="omp_set_nest_lock_")
398 import
399 integer(kind=omp_nest_lock_kind), intent(inout) :: lockvar
400 end subroutine omp_set_nest_lock
402 subroutine omp_unset_nest_lock(lockvar) bind(c, name="omp_unset_nest_lock_")
403 import
404 integer(kind=omp_nest_lock_kind), intent(inout) :: lockvar
405 end subroutine omp_unset_nest_lock
407 function omp_test_nest_lock(lockvar) bind(c, name="omp_test_nest_lock_")
408 import
409 integer(kind=omp_integer_kind) :: omp_test_nest_lock
410 integer(kind=omp_nest_lock_kind), intent(inout) :: lockvar
411 end function omp_test_nest_lock
413 ! Timing routines
414 function omp_get_wtime() bind(c)
415 double precision omp_get_wtime
416 end function omp_get_wtime
418 function omp_get_wtick() bind(c)
419 double precision omp_get_wtick
420 end function omp_get_wtick
422 ! Event routine
423 subroutine omp_fullfill_event(event) bind(c) ! TODO: is this the correct spelling?
424 import
425 integer(kind=omp_event_handle_kind) :: event
426 end subroutine omp_fullfill_event
428 ! Device Memory Routines
430 ! Memory Management Routines
431 function omp_init_allocator(memspace, ntraits, traits) bind(c)
432 import
433 integer(kind=omp_memspace_handle_kind), value :: memspace
434 integer, value :: ntraits
435 type(omp_alloctrait), intent(in) :: traits(*)
436 integer(kind=omp_allocator_handle_kind) :: omp_init_allocator
437 end function omp_init_allocator
439 subroutine omp_destroy_allocator(allocator) bind(c)
440 import
441 integer(kind=omp_allocator_handle_kind), value :: allocator
442 end subroutine omp_destroy_allocator
444 subroutine omp_set_default_allocator(allocator) bind(c)
445 import
446 integer(kind=omp_allocator_handle_kind), value :: allocator
447 end subroutine omp_set_default_allocator
449 function omp_get_default_allocator() bind(c)
450 import
451 integer(kind=omp_allocator_handle_kind) :: omp_get_default_allocator
452 end function omp_get_default_allocator
454 end interface