summaryrefslogtreecommitdiff
path: root/src/gpgpu-sim/gpu-sim.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpgpu-sim/gpu-sim.h')
-rw-r--r--src/gpgpu-sim/gpu-sim.h71
1 files changed, 60 insertions, 11 deletions
diff --git a/src/gpgpu-sim/gpu-sim.h b/src/gpgpu-sim/gpu-sim.h
index c14d0a7..f841bf9 100644
--- a/src/gpgpu-sim/gpu-sim.h
+++ b/src/gpgpu-sim/gpu-sim.h
@@ -33,6 +33,7 @@
#include "../trace.h"
#include "addrdec.h"
#include "shader.h"
+#include "gpu-cache.h"
#include <iostream>
#include <fstream>
#include <list>
@@ -62,8 +63,9 @@
#define SAMPLELOG 222
#define DUMPLOG 333
-extern tr1_hash_map<new_addr_type,unsigned> address_random_interleaving;
+class gpgpu_context;
+extern tr1_hash_map<new_addr_type,unsigned> address_random_interleaving;
enum dram_ctrl_t {
DRAM_FIFO=0,
@@ -142,13 +144,14 @@ struct power_config {
};
-
-struct memory_config {
- memory_config()
+class memory_config {
+ public:
+ memory_config(gpgpu_context* ctx)
{
m_valid = false;
gpgpu_dram_timing_opt=NULL;
gpgpu_L2_queue_config=NULL;
+ gpgpu_ctx = ctx;
}
void init()
{
@@ -291,17 +294,22 @@ struct memory_config {
unsigned write_low_watermark;
bool m_perf_sim_memcpy;
bool simple_dram_model;
+
+ gpgpu_context* gpgpu_ctx;
};
// global counters and flags (please try not to add to this list!!!)
extern unsigned long long gpu_sim_cycle;
extern unsigned long long gpu_tot_sim_cycle;
-extern unsigned long long elapsed_cycles_sm_tot;
+
extern bool g_interactive_debugger_enabled;
class gpgpu_sim_config : public power_config, public gpgpu_functional_sim_config {
public:
- gpgpu_sim_config() { m_valid = false; }
+ gpgpu_sim_config(gpgpu_context* ctx): m_shader_config(ctx), m_memory_config(ctx) {
+ m_valid = false;
+ gpgpu_ctx = ctx;
+ }
void reg_options(class OptionParser * opp);
void init()
{
@@ -347,6 +355,8 @@ private:
void init_clock_domains(void );
+ // backward pointer
+ class gpgpu_context* gpgpu_ctx;
bool m_valid;
shader_core_config m_shader_config;
memory_config m_memory_config;
@@ -422,10 +432,31 @@ 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:
- gpgpu_sim( const gpgpu_sim_config &config );
+ gpgpu_sim( const gpgpu_sim_config &config, gpgpu_context* ctx );
void set_prop( struct cudaDeviceProp *prop );
@@ -480,14 +511,14 @@ public:
/*!
* Returning the configuration of the shader core, used by the functional simulation only so far
*/
- const struct shader_core_config * getShaderCoreConfig();
+ const shader_core_config * getShaderCoreConfig();
//! Get shader core Memory Configuration
/*!
* Returning the memory configuration of the shader core, used by the functional simulation only so far
*/
- const struct memory_config * getMemoryConfig();
+ const memory_config * getMemoryConfig();
//! Get shader core SIMT cluster
@@ -496,6 +527,10 @@ 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;
private:
// clocks
@@ -542,8 +577,8 @@ private:
const gpgpu_sim_config &m_config;
const struct cudaDeviceProp *m_cuda_properties;
- const struct shader_core_config *m_shader_config;
- const struct memory_config *m_memory_config;
+ const shader_core_config *m_shader_config;
+ const memory_config *m_memory_config;
// stats
class shader_core_stats *m_shader_stats;
@@ -558,6 +593,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
@@ -570,6 +607,18 @@ public:
occupancy_stats gpu_occupancy;
occupancy_stats gpu_tot_occupancy;
+ // performance counter for stalls due to congestion.
+ unsigned int gpu_stall_dramfull;
+ unsigned int gpu_stall_icnt2sh;
+ unsigned long long partiton_reqs_in_parallel;
+ unsigned long long partiton_reqs_in_parallel_total;
+ unsigned long long partiton_reqs_in_parallel_util;
+ unsigned long long partiton_reqs_in_parallel_util_total;
+ unsigned long long gpu_sim_cycle_parition_util;
+ unsigned long long gpu_tot_sim_cycle_parition_util;
+ unsigned long long partiton_replys_in_parallel;
+ unsigned long long partiton_replys_in_parallel_total;
+
FuncCache get_cache_config(std::string kernel_name);
void set_cache_config(std::string kernel_name, FuncCache cacheConfig );