diff options
| author | Jin Wang <[email protected]> | 2016-06-30 08:48:40 -0400 |
|---|---|---|
| committer | Jin Wang <[email protected]> | 2016-07-05 09:16:53 -0400 |
| commit | 38f811ab4d094e56b2065e1c8cb39327ad9f157b (patch) | |
| tree | f3ebb545f4994ff8690823ed44ce82f27b255dc8 | |
| parent | cf507ddb207337bc7a67ded7c4438f0cb0bed26f (diff) | |
ADD: delete streams created by cta when deleting kernel
| -rw-r--r-- | src/abstract_hardware_model.cc | 12 | ||||
| -rw-r--r-- | src/abstract_hardware_model.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/abstract_hardware_model.cc b/src/abstract_hardware_model.cc index f3c5b21..4db5f2f 100644 --- a/src/abstract_hardware_model.cc +++ b/src/abstract_hardware_model.cc @@ -574,6 +574,7 @@ kernel_info_t::kernel_info_t( dim3 gridDim, dim3 blockDim, class function_info * kernel_info_t::~kernel_info_t() { assert( m_active_threads.empty() ); + destroy_cta_streams(); delete m_param_mem; } @@ -668,6 +669,17 @@ void kernel_info_t::print_parent_info() { } } +void kernel_info_t::destroy_cta_streams() { + printf("Destroy streams for kernel %d: ", get_uid()); size_t stream_size = 0; + for(auto s = m_cta_streams.begin(); s != m_cta_streams.end(); s++) { + stream_size += s->second.size(); + for(auto ss = s->second.begin(); ss != s->second.end(); ss++) + g_stream_manager->destroy_stream(*ss); + s->second.clear(); + } + printf("size %lu\n", stream_size); + m_cta_streams.clear(); +} simt_stack::simt_stack( unsigned wid, unsigned warpSize) { diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h index a0bf80d..3a268ad 100644 --- a/src/abstract_hardware_model.h +++ b/src/abstract_hardware_model.h @@ -282,6 +282,7 @@ public: CUstream_st * create_stream_cta(dim3 ctaid); CUstream_st * get_default_stream_cta(dim3 ctaid); bool cta_has_stream(dim3 ctaid, CUstream_st* stream); + void destroy_cta_streams(); void print_parent_info(); private: |
