Skip to content

Commit f3ec233

Browse files
committed
fix event done impl
1 parent b13557b commit f3ec233

File tree

2 files changed

+41
-41
lines changed

2 files changed

+41
-41
lines changed

src/stream_manager.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ bool stream_operation::do_operation( gpgpu_sim *gpu )
198198
//only allows next op to go if event is done
199199
//otherwise stays in the stream queue
200200
printf("stream wait event processing...\n");
201-
if(m_event->done()){
201+
if(m_event->num_updates()>=m_cnt){
202202
printf("stream wait event done\n");
203203
m_stream->record_next_done();
204204
}

src/stream_manager.h

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,45 @@
4343
// unsigned m_pending_streams;
4444
//};
4545

46+
struct CUevent_st {
47+
public:
48+
CUevent_st( bool blocking )
49+
{
50+
m_uid = ++m_next_event_uid;
51+
m_blocking = blocking;
52+
m_updates = 0;
53+
m_wallclock = 0;
54+
m_gpu_tot_sim_cycle = 0;
55+
m_issued = 0;
56+
m_done = false;
57+
}
58+
void update( double cycle, time_t clk )
59+
{
60+
m_updates++;
61+
m_wallclock=clk;
62+
m_gpu_tot_sim_cycle=cycle;
63+
m_done = true;
64+
}
65+
//void set_done() { assert(!m_done); m_done=true; }
66+
int get_uid() const { return m_uid; }
67+
unsigned num_updates() const { return m_updates; }
68+
bool done() const { return m_updates==m_issued; }
69+
time_t clock() const { return m_wallclock; }
70+
void issue(){ m_issued++; }
71+
unsigned int num_issued() const{ return m_issued; }
72+
private:
73+
int m_uid;
74+
bool m_blocking;
75+
bool m_done;
76+
int m_updates;
77+
unsigned int m_issued;
78+
time_t m_wallclock;
79+
double m_gpu_tot_sim_cycle;
80+
81+
static int m_next_event_uid;
82+
};
83+
84+
4685
enum stream_operation_type {
4786
stream_no_op,
4887
stream_memcpy_host_to_device,
@@ -107,6 +146,7 @@ class stream_operation {
107146
m_kernel=NULL;
108147
m_type=stream_wait_event;
109148
m_event=e;
149+
m_cnt = m_event->num_issued();
110150
m_stream=stream;
111151
m_done=false;
112152
}
@@ -163,7 +203,6 @@ class stream_operation {
163203
void print( FILE *fp ) const;
164204
struct CUstream_st *get_stream() { return m_stream; }
165205
void set_stream( CUstream_st *stream ) { m_stream = stream; }
166-
167206
private:
168207
struct CUstream_st *m_stream;
169208

@@ -183,45 +222,6 @@ class stream_operation {
183222
kernel_info_t *m_kernel;
184223
struct CUevent_st *m_event;
185224
};
186-
187-
struct CUevent_st {
188-
public:
189-
CUevent_st( bool blocking )
190-
{
191-
m_uid = ++m_next_event_uid;
192-
m_blocking = blocking;
193-
m_updates = 0;
194-
m_wallclock = 0;
195-
m_gpu_tot_sim_cycle = 0;
196-
m_issued = 0;
197-
m_done = false;
198-
}
199-
void update( double cycle, time_t clk )
200-
{
201-
m_updates++;
202-
m_wallclock=clk;
203-
m_gpu_tot_sim_cycle=cycle;
204-
m_done = true;
205-
}
206-
//void set_done() { assert(!m_done); m_done=true; }
207-
int get_uid() const { return m_uid; }
208-
unsigned num_updates() const { return m_updates; }
209-
bool done() const { return m_done; }
210-
time_t clock() const { return m_wallclock; }
211-
void issue(){ m_issued++; }
212-
unsigned int num_issued() const{ return m_issued; }
213-
private:
214-
int m_uid;
215-
bool m_blocking;
216-
bool m_done;
217-
int m_updates;
218-
unsigned int m_issued;
219-
time_t m_wallclock;
220-
double m_gpu_tot_sim_cycle;
221-
222-
static int m_next_event_uid;
223-
};
224-
225225
struct CUstream_st {
226226
public:
227227
CUstream_st();

0 commit comments

Comments
 (0)