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