|
|
e88ed2 |
/* Copyright (C) 2019 Free Software Foundation, Inc.
|
|
|
e88ed2 |
Contributed by Jakub Jelinek <jakub@redhat.com>.
|
|
|
e88ed2 |
|
|
|
e88ed2 |
This file is part of the GNU Offloading and Multi Processing Library
|
|
|
e88ed2 |
(libgomp).
|
|
|
e88ed2 |
|
|
|
e88ed2 |
Libgomp is free software; you can redistribute it and/or modify it
|
|
|
e88ed2 |
under the terms of the GNU General Public License as published by
|
|
|
e88ed2 |
the Free Software Foundation; either version 3, or (at your option)
|
|
|
e88ed2 |
any later version.
|
|
|
e88ed2 |
|
|
|
e88ed2 |
Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
e88ed2 |
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
e88ed2 |
FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
e88ed2 |
more details.
|
|
|
e88ed2 |
|
|
|
e88ed2 |
Under Section 7 of GPL version 3, you are granted additional
|
|
|
e88ed2 |
permissions described in the GCC Runtime Library Exception, version
|
|
|
e88ed2 |
3.1, as published by the Free Software Foundation.
|
|
|
e88ed2 |
|
|
|
e88ed2 |
You should have received a copy of the GNU General Public License and
|
|
|
e88ed2 |
a copy of the GCC Runtime Library Exception along with this program;
|
|
|
e88ed2 |
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
e88ed2 |
<http://www.gnu.org/licenses/>. */
|
|
|
e88ed2 |
|
|
|
e88ed2 |
/* Remapping of nonmonotonic runtime schedule and maybe nonmonotonic runtime
|
|
|
e88ed2 |
schedule loop entrypoints (the used by GCC 9 and later for runtime
|
|
|
e88ed2 |
schedule without monotonic or nonmonotonic modifiers).
|
|
|
e88ed2 |
RHEL 7 libgomp only implements the GOMP*loop*runtime* entrypoints without
|
|
|
e88ed2 |
nonmonotonic in the names, which always implement monotonic scheduling,
|
|
|
e88ed2 |
but the library doesn't implement any other scheduling, even in GCC 9
|
|
|
e88ed2 |
and monotonic scheduling is a valid implementation of non-monotonic
|
|
|
e88ed2 |
scheduling. */
|
|
|
e88ed2 |
|
|
|
e88ed2 |
#include <stdbool.h>
|
|
|
e88ed2 |
|
|
|
e88ed2 |
typedef unsigned long long ull;
|
|
|
e88ed2 |
extern bool GOMP_loop_runtime_start (long, long, long, long *, long *);
|
|
|
e88ed2 |
extern bool GOMP_loop_runtime_next (long *, long *);
|
|
|
e88ed2 |
extern void GOMP_parallel_loop_runtime (void (*)(void *), void *,
|
|
|
e88ed2 |
unsigned, long, long, long,
|
|
|
e88ed2 |
unsigned);
|
|
|
e88ed2 |
extern bool GOMP_loop_ull_runtime_start (bool, ull, ull, ull, ull *, ull *);
|
|
|
e88ed2 |
extern bool GOMP_loop_ull_runtime_next (ull *, ull *);
|
|
|
e88ed2 |
extern bool GOMP_loop_dynamic_next (long *, long *);
|
|
|
e88ed2 |
extern bool GOMP_loop_dynamic_start (long, long, long, long, long *, long *);
|
|
|
e88ed2 |
extern bool GOMP_loop_guided_next (long *, long *);
|
|
|
e88ed2 |
extern bool GOMP_loop_guided_start (long, long, long, long, long *, long *);
|
|
|
e88ed2 |
extern bool GOMP_loop_ull_dynamic_next (ull *, ull *);
|
|
|
e88ed2 |
extern bool GOMP_loop_ull_dynamic_start (bool, ull, ull, ull, ull, ull *,
|
|
|
e88ed2 |
ull *);
|
|
|
e88ed2 |
extern bool GOMP_loop_ull_guided_next (ull *, ull *);
|
|
|
e88ed2 |
extern bool GOMP_loop_ull_guided_start (bool, ull, ull, ull, ull, ull *,
|
|
|
e88ed2 |
ull *);
|
|
|
e88ed2 |
extern void GOMP_parallel_loop_dynamic (void (*)(void *), void *,
|
|
|
e88ed2 |
unsigned, long, long, long, long,
|
|
|
e88ed2 |
unsigned);
|
|
|
e88ed2 |
extern void GOMP_parallel_loop_guided (void (*)(void *), void *,
|
|
|
e88ed2 |
unsigned, long, long, long, long,
|
|
|
e88ed2 |
unsigned);
|
|
|
e88ed2 |
#define alias(x, y) __typeof (x) y __attribute__((alias (#x)))
|
|
|
e88ed2 |
|
|
|
e88ed2 |
#pragma GCC visibility push(hidden)
|
|
|
e88ed2 |
|
|
|
e88ed2 |
bool
|
|
|
e88ed2 |
GOMP_loop_nonmonotonic_runtime_start (long start, long end, long incr,
|
|
|
e88ed2 |
long *istart, long *iend)
|
|
|
e88ed2 |
{
|
|
|
e88ed2 |
return GOMP_loop_runtime_start (start, end, incr, istart, iend);
|
|
|
e88ed2 |
}
|
|
|
e88ed2 |
alias (GOMP_loop_nonmonotonic_runtime_start,
|
|
|
e88ed2 |
GOMP_loop_maybe_nonmonotonic_runtime_start);
|
|
|
e88ed2 |
|
|
|
e88ed2 |
bool
|
|
|
e88ed2 |
GOMP_loop_nonmonotonic_runtime_next (long *istart, long *iend)
|
|
|
e88ed2 |
{
|
|
|
e88ed2 |
return GOMP_loop_runtime_next (istart, iend);
|
|
|
e88ed2 |
}
|
|
|
e88ed2 |
alias (GOMP_loop_nonmonotonic_runtime_next,
|
|
|
e88ed2 |
GOMP_loop_maybe_nonmonotonic_runtime_next);
|
|
|
e88ed2 |
|
|
|
e88ed2 |
void
|
|
|
e88ed2 |
GOMP_parallel_loop_nonmonotonic_runtime (void (*fn)(void *), void *data,
|
|
|
e88ed2 |
unsigned num_threads, long start,
|
|
|
e88ed2 |
long end, long incr, unsigned flags)
|
|
|
e88ed2 |
{
|
|
|
e88ed2 |
return GOMP_parallel_loop_runtime (fn, data, num_threads, start,
|
|
|
e88ed2 |
end, incr, flags);
|
|
|
e88ed2 |
}
|
|
|
e88ed2 |
alias (GOMP_parallel_loop_nonmonotonic_runtime,
|
|
|
e88ed2 |
GOMP_parallel_loop_maybe_nonmonotonic_runtime);
|
|
|
e88ed2 |
|
|
|
e88ed2 |
bool
|
|
|
e88ed2 |
GOMP_loop_ull_nonmonotonic_runtime_start (bool up, ull start, ull end,
|
|
|
e88ed2 |
ull incr, ull *istart, ull *iend)
|
|
|
e88ed2 |
{
|
|
|
e88ed2 |
return GOMP_loop_ull_runtime_start (up, start, end, incr, istart, iend);
|
|
|
e88ed2 |
}
|
|
|
e88ed2 |
alias (GOMP_loop_ull_nonmonotonic_runtime_start,
|
|
|
e88ed2 |
GOMP_loop_ull_maybe_nonmonotonic_runtime_start);
|
|
|
e88ed2 |
|
|
|
e88ed2 |
bool
|
|
|
e88ed2 |
GOMP_loop_ull_nonmonotonic_runtime_next (ull *istart, ull *iend)
|
|
|
e88ed2 |
{
|
|
|
e88ed2 |
return GOMP_loop_ull_runtime_next (istart, iend);
|
|
|
e88ed2 |
}
|
|
|
e88ed2 |
alias (GOMP_loop_ull_nonmonotonic_runtime_next,
|
|
|
e88ed2 |
GOMP_loop_ull_maybe_nonmonotonic_runtime_next);
|
|
|
e88ed2 |
|
|
|
e88ed2 |
bool
|
|
|
e88ed2 |
GOMP_loop_nonmonotonic_dynamic_next (long *istart, long *iend)
|
|
|
e88ed2 |
{
|
|
|
e88ed2 |
return GOMP_loop_dynamic_next (istart, iend);
|
|
|
e88ed2 |
}
|
|
|
e88ed2 |
|
|
|
e88ed2 |
bool
|
|
|
e88ed2 |
GOMP_loop_nonmonotonic_dynamic_start (long start, long end, long incr,
|
|
|
e88ed2 |
long chunk_size, long *istart,
|
|
|
e88ed2 |
long *iend)
|
|
|
e88ed2 |
{
|
|
|
e88ed2 |
return GOMP_loop_dynamic_start (start, end, incr, chunk_size, istart, iend);
|
|
|
e88ed2 |
}
|
|
|
e88ed2 |
|
|
|
e88ed2 |
bool
|
|
|
e88ed2 |
GOMP_loop_nonmonotonic_guided_next (long *istart, long *iend)
|
|
|
e88ed2 |
{
|
|
|
e88ed2 |
return GOMP_loop_guided_next (istart, iend);
|
|
|
e88ed2 |
}
|
|
|
e88ed2 |
|
|
|
e88ed2 |
bool
|
|
|
e88ed2 |
GOMP_loop_nonmonotonic_guided_start (long start, long end, long incr,
|
|
|
e88ed2 |
long chunk_size, long *istart, long *iend)
|
|
|
e88ed2 |
{
|
|
|
e88ed2 |
return GOMP_loop_guided_start (start, end, incr, chunk_size, istart, iend);
|
|
|
e88ed2 |
}
|
|
|
e88ed2 |
|
|
|
e88ed2 |
bool
|
|
|
e88ed2 |
GOMP_loop_ull_nonmonotonic_dynamic_next (ull *istart, ull *iend)
|
|
|
e88ed2 |
{
|
|
|
e88ed2 |
return GOMP_loop_ull_dynamic_next (istart, iend);
|
|
|
e88ed2 |
}
|
|
|
e88ed2 |
|
|
|
e88ed2 |
bool
|
|
|
e88ed2 |
GOMP_loop_ull_nonmonotonic_dynamic_start (bool up, ull start,
|
|
|
e88ed2 |
ull end, ull incr,
|
|
|
e88ed2 |
ull chunk_size,
|
|
|
e88ed2 |
ull *istart, ull *iend)
|
|
|
e88ed2 |
{
|
|
|
e88ed2 |
return GOMP_loop_ull_dynamic_start (up, start, end, incr, chunk_size, istart,
|
|
|
e88ed2 |
iend);
|
|
|
e88ed2 |
}
|
|
|
e88ed2 |
|
|
|
e88ed2 |
bool
|
|
|
e88ed2 |
GOMP_loop_ull_nonmonotonic_guided_next (ull *istart, ull *iend)
|
|
|
e88ed2 |
{
|
|
|
e88ed2 |
return GOMP_loop_ull_guided_next (istart, iend);
|
|
|
e88ed2 |
}
|
|
|
e88ed2 |
|
|
|
e88ed2 |
bool
|
|
|
e88ed2 |
GOMP_loop_ull_nonmonotonic_guided_start (bool up, ull start, ull end,
|
|
|
e88ed2 |
ull incr, ull chunk_size,
|
|
|
e88ed2 |
ull *istart, ull *iend)
|
|
|
e88ed2 |
{
|
|
|
e88ed2 |
return GOMP_loop_ull_guided_start (up, start, end, incr, chunk_size, istart,
|
|
|
e88ed2 |
iend);
|
|
|
e88ed2 |
}
|
|
|
e88ed2 |
|
|
|
e88ed2 |
void
|
|
|
e88ed2 |
GOMP_parallel_loop_nonmonotonic_dynamic (void (*fn) (void *), void *data,
|
|
|
e88ed2 |
unsigned num_threads, long start,
|
|
|
e88ed2 |
long end, long incr, long chunk_size,
|
|
|
e88ed2 |
unsigned flags)
|
|
|
e88ed2 |
{
|
|
|
e88ed2 |
GOMP_parallel_loop_dynamic (fn, data, num_threads, start, end, incr,
|
|
|
e88ed2 |
chunk_size, flags);
|
|
|
e88ed2 |
}
|
|
|
e88ed2 |
|
|
|
e88ed2 |
void
|
|
|
e88ed2 |
GOMP_parallel_loop_nonmonotonic_guided (void (*fn) (void *), void *data,
|
|
|
e88ed2 |
unsigned num_threads, long start,
|
|
|
e88ed2 |
long end, long incr, long chunk_size,
|
|
|
e88ed2 |
unsigned flags)
|
|
|
e88ed2 |
{
|
|
|
e88ed2 |
GOMP_parallel_loop_guided (fn, data, num_threads, start, end, incr,
|
|
|
e88ed2 |
chunk_size, flags);
|
|
|
e88ed2 |
}
|
|
|
e88ed2 |
|
|
|
e88ed2 |
#pragma GCC visibility pop
|