aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoniu Pop <antoniu.pop@gmail.com>2009-09-25 12:53:53 +0000
committerAntoniu Pop <antoniu.pop@gmail.com>2009-09-25 12:53:53 +0000
commit3b8d3e1de39e3272a1ecdcb64df022e5b89b2c2b (patch)
tree260222c24b3a134621eedc174f745675a1b671a0
parentf1bf228118228e1f4a27e2f271ded79b5f1dfa85 (diff)
2009-09-25 Antoniu Pop <antoniu.pop@gmail.com>
Adding stream window operations to libGOMP. libgomp/ * stream.c (GOMP_stream_head_window, GOMP_stream_tail_window, GOMP_stream_pop_window, GOMP_stream_push_window): New. * libgomp_g.h (GOMP_stream_head_window, GOMP_stream_tail_window, GOMP_stream_pop_window, GOMP_stream_push_window): Declared. * libgomp.map (GOMP_stream_head_window, GOMP_stream_tail_window, GOMP_stream_pop_window, GOMP_stream_push_window): Declared. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/streamization@152169 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libgomp/ChangeLog.streamization12
-rw-r--r--libgomp/libgomp.map4
-rw-r--r--libgomp/libgomp_g.h4
-rw-r--r--libgomp/stream.c41
4 files changed, 61 insertions, 0 deletions
diff --git a/libgomp/ChangeLog.streamization b/libgomp/ChangeLog.streamization
index a4d2aac7b54..bce7a9a4eae 100644
--- a/libgomp/ChangeLog.streamization
+++ b/libgomp/ChangeLog.streamization
@@ -1,3 +1,15 @@
+2009-09-25 Antoniu Pop <antoniu.pop@gmail.com>
+
+Adding stream window operations to libGOMP.
+
+ * stream.c (GOMP_stream_head_window, GOMP_stream_tail_window,
+ GOMP_stream_pop_window, GOMP_stream_push_window): New.
+
+ * libgomp_g.h (GOMP_stream_head_window, GOMP_stream_tail_window,
+ GOMP_stream_pop_window, GOMP_stream_push_window): Declared.
+ * libgomp.map (GOMP_stream_head_window, GOMP_stream_tail_window,
+ GOMP_stream_pop_window, GOMP_stream_push_window): Declared.
+
2009-09-22 Antoniu Pop <antoniu.pop@gmail.com>
Adding multi-reader support in libGOMP streams.
diff --git a/libgomp/libgomp.map b/libgomp/libgomp.map
index 98863cbffd5..a9f9d496c4c 100644
--- a/libgomp/libgomp.map
+++ b/libgomp/libgomp.map
@@ -170,10 +170,14 @@ GOMP_2.0 {
GOMP_stream_create;
GOMP_stream_register_reader;
GOMP_stream_push;
+ GOMP_stream_push_window;
GOMP_stream_commit;
GOMP_stream_tail;
+ GOMP_stream_tail_window;
GOMP_stream_head;
+ GOMP_stream_head_window;
GOMP_stream_pop;
+ GOMP_stream_pop_window;
GOMP_stream_eos_p;
GOMP_stream_set_eos;
GOMP_stream_destroy;
diff --git a/libgomp/libgomp_g.h b/libgomp/libgomp_g.h
index 6fd4814a1eb..7ff68e8be1b 100644
--- a/libgomp/libgomp_g.h
+++ b/libgomp/libgomp_g.h
@@ -183,10 +183,14 @@ extern void GOMP_single_copy_end (void *);
extern void *GOMP_stream_create (size_t, size_t, size_t, size_t);
extern size_t GOMP_stream_register_reader (void *);
extern void GOMP_stream_push (void *, void *);
+extern void GOMP_stream_push_window (void *);
extern void GOMP_stream_commit (void *);
extern void *GOMP_stream_tail (void *);
+extern void *GOMP_stream_tail_window (void *);
extern void *GOMP_stream_head (void *, size_t);
+extern void *GOMP_stream_head_window (void *, size_t);
extern void GOMP_stream_pop (void *, size_t);
+extern void GOMP_stream_pop_window (void *, size_t);
extern bool GOMP_stream_eos_p (void *, size_t);
extern void GOMP_stream_set_eos (void *);
extern void GOMP_stream_destroy (void *);
diff --git a/libgomp/stream.c b/libgomp/stream.c
index e835e48132a..2d1e087734c 100644
--- a/libgomp/stream.c
+++ b/libgomp/stream.c
@@ -221,6 +221,26 @@ GOMP_stream_head (void *s, size_t id)
return ((gomp_stream) s)->buffer + ((gomp_stream) s)->read_index[id];
}
+/* Return a pointer to the next windowfull of elements in stream S or
+ NULL if only the last window is left and is not full. FIXME: use a
+ futex for the eos ? */
+
+void *
+GOMP_stream_head_window (void *vs, size_t id)
+{
+ gomp_stream s = (gomp_stream) vs;
+
+ /* If we're in the last and only partially filled window of the
+ stream. */
+ if ((((gomp_stream) s)->eos_p
+ && (((gomp_stream) s)->read_index[id]
+ == ((gomp_stream) s)->write_index))
+ || s->read_buffer_index[id] == s->write_buffer_index)
+ return NULL;
+
+ return (void *) s->buffer + s->read_buffer_index[id];
+}
+
/* Returns a pointer to the next available location in stream S that
can hold an element. Don't commit the element: for that, a call to
gomp_stream_push is needed. */
@@ -231,6 +251,15 @@ GOMP_stream_tail (void *s)
return ((gomp_stream) s)->buffer + ((gomp_stream) s)->write_index;
}
+/* Return a pointer on the next empty window to write to. */
+
+void *
+GOMP_stream_tail_window (void *s)
+{
+ gomp_stream stream = (gomp_stream) s;
+ return (void *) stream->buffer + stream->write_buffer_index;
+}
+
/* Returns true when there are no more elements to be read from the
stream S. Returning false guarantees that at least one element
will be available for reading. Unless this function is called
@@ -299,7 +328,19 @@ GOMP_stream_push (void *s, void *elt)
}
void
+GOMP_stream_push_window (void *s)
+{
+ slide_write_window ((gomp_stream) s);
+}
+
+void
GOMP_stream_pop (void *s, size_t id)
{
gomp_stream_pop ((gomp_stream) s, id);
}
+
+void
+GOMP_stream_pop_window (void *s, size_t id)
+{
+ slide_read_window ((gomp_stream) s, id);
+}