diff options
| -rw-r--r-- | src/cuda-sim/memory.cc | 3 | ||||
| -rw-r--r-- | src/debug.cc | 23 | ||||
| -rw-r--r-- | src/debug.h | 1 | ||||
| -rw-r--r-- | src/gpgpu-sim/gpu-sim.h | 24 |
4 files changed, 27 insertions, 24 deletions
diff --git a/src/cuda-sim/memory.cc b/src/cuda-sim/memory.cc index 9554f55..4b2acdf 100644 --- a/src/cuda-sim/memory.cc +++ b/src/cuda-sim/memory.cc @@ -28,6 +28,7 @@ #include "memory.h" #include <stdlib.h> #include "../debug.h" +#include "../../libcuda/gpgpu_context.h" template<unsigned BSIZE> memory_space_impl<BSIZE>::memory_space_impl( std::string name, unsigned hash_size ) { @@ -88,7 +89,7 @@ template<unsigned BSIZE> void memory_space_impl<BSIZE>::write( mem_addr_t addr, for( i=m_watchpoints.begin(); i!=m_watchpoints.end(); i++ ) { mem_addr_t wa = i->second; if( ((addr<=wa) && ((addr+length)>wa)) || ((addr>wa) && (addr < (wa+4))) ) - hit_watchpoint(i->first,thd,pI); + thd->get_gpu()->gpgpu_ctx->the_gpgpusim->g_the_gpu->hit_watchpoint(i->first,thd,pI); } } } diff --git a/src/debug.cc b/src/debug.cc index ae15760..c00ff9e 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -36,28 +36,7 @@ #include <stdio.h> #include <string.h> -class watchpoint_event { -public: - watchpoint_event() - { - m_thread=NULL; - m_inst=NULL; - } - watchpoint_event(const ptx_thread_info *thd, const ptx_instruction *pI) - { - m_thread=thd; - m_inst = pI; - } - const ptx_thread_info *thread() const { return m_thread; } - const ptx_instruction *inst() const { return m_inst; } -private: - const ptx_thread_info *m_thread; - const ptx_instruction *m_inst; -}; - -std::map<unsigned,watchpoint_event> g_watchpoint_hits; - -void hit_watchpoint( unsigned watchpoint_num, ptx_thread_info *thd, const ptx_instruction *pI ) +void gpgpu_sim::hit_watchpoint( unsigned watchpoint_num, ptx_thread_info *thd, const ptx_instruction *pI ) { g_watchpoint_hits[watchpoint_num]=watchpoint_event(thd,pI); } diff --git a/src/debug.h b/src/debug.h index 1005bd5..4e79a9f 100644 --- a/src/debug.h +++ b/src/debug.h @@ -86,6 +86,5 @@ private: class ptx_thread_info; class ptx_instruction; bool thread_at_brkpt( ptx_thread_info *thd_info, const class brk_pt &b ); -void hit_watchpoint( unsigned watchpoint_num, ptx_thread_info *thd, const ptx_instruction *pI ); #endif diff --git a/src/gpgpu-sim/gpu-sim.h b/src/gpgpu-sim/gpu-sim.h index 119b934..78f0505 100644 --- a/src/gpgpu-sim/gpu-sim.h +++ b/src/gpgpu-sim/gpu-sim.h @@ -424,6 +424,26 @@ struct occupancy_stats { }; class gpgpu_context; +class ptx_instruction; + +class watchpoint_event { +public: + watchpoint_event() + { + m_thread=NULL; + m_inst=NULL; + } + watchpoint_event(const ptx_thread_info *thd, const ptx_instruction *pI) + { + m_thread=thd; + m_inst = pI; + } + const ptx_thread_info *thread() const { return m_thread; } + const ptx_instruction *inst() const { return m_inst; } +private: + const ptx_thread_info *m_thread; + const ptx_instruction *m_inst; +}; class gpgpu_sim : public gpgpu_t { public: @@ -496,6 +516,8 @@ public: */ simt_core_cluster * getSIMTCluster(); + void hit_watchpoint( unsigned watchpoint_num, ptx_thread_info *thd, const ptx_instruction *pI ); + // backward pointer class gpgpu_context* gpgpu_ctx; @@ -560,6 +582,8 @@ private: std::vector<std::string> m_executed_kernel_names; //< names of kernel for stat printout std::vector<unsigned> m_executed_kernel_uids; //< uids of kernel launches for stat printout + std::map<unsigned,watchpoint_event> g_watchpoint_hits; + std::string executed_kernel_info_string(); //< format the kernel information into a string for stat printout void clear_executed_kernel_info(); //< clear the kernel information after stat printout |
