summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/stream_manager.cc2
-rw-r--r--src/stream_manager.h80
2 files changed, 41 insertions, 41 deletions
diff --git a/src/stream_manager.cc b/src/stream_manager.cc
index d0eecdd..0d67e10 100644
--- a/src/stream_manager.cc
+++ b/src/stream_manager.cc
@@ -198,7 +198,7 @@ bool stream_operation::do_operation( gpgpu_sim *gpu )
//only allows next op to go if event is done
//otherwise stays in the stream queue
printf("stream wait event processing...\n");
- if(m_event->done()){
+ if(m_event->num_updates()>=m_cnt){
printf("stream wait event done\n");
m_stream->record_next_done();
}
diff --git a/src/stream_manager.h b/src/stream_manager.h
index eb4c6ff..e73d71a 100644
--- a/src/stream_manager.h
+++ b/src/stream_manager.h
@@ -43,6 +43,45 @@
// unsigned m_pending_streams;
//};
+struct CUevent_st {
+public:
+ CUevent_st( bool blocking )
+ {
+ m_uid = ++m_next_event_uid;
+ m_blocking = blocking;
+ m_updates = 0;
+ m_wallclock = 0;
+ m_gpu_tot_sim_cycle = 0;
+ m_issued = 0;
+ m_done = false;
+ }
+ void update( double cycle, time_t clk )
+ {
+ m_updates++;
+ m_wallclock=clk;
+ m_gpu_tot_sim_cycle=cycle;
+ m_done = true;
+ }
+ //void set_done() { assert(!m_done); m_done=true; }
+ int get_uid() const { return m_uid; }
+ unsigned num_updates() const { return m_updates; }
+ bool done() const { return m_updates==m_issued; }
+ time_t clock() const { return m_wallclock; }
+ void issue(){ m_issued++; }
+ unsigned int num_issued() const{ return m_issued; }
+private:
+ int m_uid;
+ bool m_blocking;
+ bool m_done;
+ int m_updates;
+ unsigned int m_issued;
+ time_t m_wallclock;
+ double m_gpu_tot_sim_cycle;
+
+ static int m_next_event_uid;
+};
+
+
enum stream_operation_type {
stream_no_op,
stream_memcpy_host_to_device,
@@ -107,6 +146,7 @@ public:
m_kernel=NULL;
m_type=stream_wait_event;
m_event=e;
+ m_cnt = m_event->num_issued();
m_stream=stream;
m_done=false;
}
@@ -163,7 +203,6 @@ public:
void print( FILE *fp ) const;
struct CUstream_st *get_stream() { return m_stream; }
void set_stream( CUstream_st *stream ) { m_stream = stream; }
-
private:
struct CUstream_st *m_stream;
@@ -183,45 +222,6 @@ private:
kernel_info_t *m_kernel;
struct CUevent_st *m_event;
};
-
-struct CUevent_st {
-public:
- CUevent_st( bool blocking )
- {
- m_uid = ++m_next_event_uid;
- m_blocking = blocking;
- m_updates = 0;
- m_wallclock = 0;
- m_gpu_tot_sim_cycle = 0;
- m_issued = 0;
- m_done = false;
- }
- void update( double cycle, time_t clk )
- {
- m_updates++;
- m_wallclock=clk;
- m_gpu_tot_sim_cycle=cycle;
- m_done = true;
- }
- //void set_done() { assert(!m_done); m_done=true; }
- int get_uid() const { return m_uid; }
- unsigned num_updates() const { return m_updates; }
- bool done() const { return m_done; }
- time_t clock() const { return m_wallclock; }
- void issue(){ m_issued++; }
- unsigned int num_issued() const{ return m_issued; }
-private:
- int m_uid;
- bool m_blocking;
- bool m_done;
- int m_updates;
- unsigned int m_issued;
- time_t m_wallclock;
- double m_gpu_tot_sim_cycle;
-
- static int m_next_event_uid;
-};
-
struct CUstream_st {
public:
CUstream_st();