On 13/07/15 16:33, Sebastian Huber wrote:
On 13/07/15 16:17, Jakub Jelinek wrote:
On Mon, Jul 13, 2015 at 01:15:44PM +0200, Sebastian Huber wrote:
diff --git a/libgomp/team.c b/libgomp/team.c
index b98b233..0bcbaf8 100644
--- a/libgomp/team.c
+++ b/libgomp/team.c
@@ -134,6 +134,25 @@ gomp_thread_start (void *xdata)
return NULL;
}
+static struct gomp_team *
+get_recycable_team (unsigned nthreads)
That would be recyclable.
But I think get_last_team would be better.
Ok.
Also, please make it static inline.
Out of curiosity, does this make a difference for a static function in
a module if it has the inline or not?
+ team = gomp_malloc (sizeof (*team) + nthreads * extra);
+
+#ifndef HAVE_SYNC_BUILTINS
+ gomp_mutex_init (&team->work_share_list_free_lock);
+#endif
Avoiding gomp_mutex_destroy/gomp_mutex_init is fine,
but I must say I'm far less sure about gomp_sem_init (can you
add there a temporary assert that it has the expected value)
and even less about gomp_barrier_init (I think e.g. on Linux
generation will be very unlikely 0 that it should be, and not
sure about awaited_final value either).
Jakub
I didn't observe any testsuite failures on x86_64-unknown-linux-gnu
with this patch. I will add asserts and re-run the testsuite tomorrow.
The team->master_release semaphore is not always zero after use. I got a
test failure here:
pr29947-2.exe: libgomp/team.c:152: get_last_team: Assertion
`last_team->master_release == 0' failed.
The state of barrier seems to be all right. I added these assertions:
#include <assert.h>
static inline struct gomp_team *
get_last_team (unsigned nthreads)
{
struct gomp_thread *thr = gomp_thread ();
if (thr->ts.team == NULL)
{
struct gomp_thread_pool *pool = thr->thread_pool;
if (pool != NULL)
{
struct gomp_team *last_team = pool->last_team;
if (last_team != NULL && last_team->nthreads == nthreads)
{
pool->last_team = NULL;
assert (last_team->barrier.total == nthreads);
assert (last_team->barrier.awaited == nthreads);
assert (last_team->barrier.awaited_final == nthreads);
assert (last_team->barrier.generation % BAR_INCR != 0);
return last_team;
}
}
}
return NULL;
}
None of them fails if I run the test suite.
Running libgomp/testsuite/libgomp.c/c.exp ...
Running libgomp/testsuite/libgomp.c++/c++.exp ...
Running libgomp/testsuite/libgomp.fortran/fortran.exp ...
Running libgomp/testsuite/libgomp.graphite/graphite.exp ...
Running libgomp/testsuite/libgomp.oacc-c/c.exp ...
Running libgomp/testsuite/libgomp.oacc-c++/c++.exp ...
Running libgomp/testsuite/libgomp.oacc-fortran/fortran.exp ...
=== libgomp Summary ===
# of expected passes 5987
# of expected failures 8
# of unsupported tests 278
Should I still leave the barrier init as is?
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.