aboutsummaryrefslogtreecommitdiff
path: root/src/abstract_hardware_model.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/abstract_hardware_model.cc')
-rw-r--r--src/abstract_hardware_model.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/abstract_hardware_model.cc b/src/abstract_hardware_model.cc
index cebdb25..7755477 100644
--- a/src/abstract_hardware_model.cc
+++ b/src/abstract_hardware_model.cc
@@ -34,6 +34,7 @@
#include "cuda-sim/cuda-sim.h"
#include "gpgpu-sim/gpu-sim.h"
#include "option_parser.h"
+#include "gpgpusim_entrypoint.h"
#include <algorithm>
#include <sys/stat.h>
#include <sstream>
@@ -198,6 +199,9 @@ gpgpu_t::gpgpu_t( const gpgpu_functional_sim_config &config )
if(m_function_model_config.get_ptx_inst_debug_to_file() != 0)
ptx_inst_debug_file = fopen(m_function_model_config.get_ptx_inst_debug_file(), "w");
+
+ gpu_sim_cycle=0;
+ gpu_tot_sim_cycle=0;
}
address_type line_size_based_tag_func(new_addr_type address, new_addr_type line_size)
@@ -768,14 +772,14 @@ void kernel_info_t::notify_parent_finished() {
extern unsigned long long g_total_param_size;
g_total_param_size -= ((m_kernel_entry->get_args_aligned_size() + 255)/256*256);
m_parent_kernel->remove_child(this);
- g_stream_manager->register_finished_kernel(m_parent_kernel->get_uid());
+ g_stream_manager()->register_finished_kernel(m_parent_kernel->get_uid());
}
}
CUstream_st * kernel_info_t::create_stream_cta(dim3 ctaid) {
assert(get_default_stream_cta(ctaid));
CUstream_st * stream = new CUstream_st();
- g_stream_manager->add_stream(stream);
+ g_stream_manager()->add_stream(stream);
assert(m_cta_streams.find(ctaid) != m_cta_streams.end());
assert(m_cta_streams[ctaid].size() >= 1); //must have default stream
m_cta_streams[ctaid].push_back(stream);
@@ -791,7 +795,7 @@ CUstream_st * kernel_info_t::get_default_stream_cta(dim3 ctaid) {
else {
m_cta_streams[ctaid] = std::list<CUstream_st *>();
CUstream_st * stream = new CUstream_st();
- g_stream_manager->add_stream(stream);
+ g_stream_manager()->add_stream(stream);
m_cta_streams[ctaid].push_back(stream);
return stream;
}
@@ -823,17 +827,18 @@ void kernel_info_t::destroy_cta_streams() {
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);
+ 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)
+simt_stack::simt_stack( unsigned wid, unsigned warpSize, class gpgpu_sim * gpu)
{
m_warp_id=wid;
m_warp_size = warpSize;
+ m_gpu=gpu;
reset();
}
@@ -1033,7 +1038,7 @@ void simt_stack::update( simt_mask_t &thread_done, addr_vector_t &next_pc, addre
simt_stack_entry new_stack_entry;
new_stack_entry.m_pc = tmp_next_pc;
new_stack_entry.m_active_mask = tmp_active_mask;
- new_stack_entry.m_branch_div_cycle = gpu_sim_cycle+gpu_tot_sim_cycle;
+ new_stack_entry.m_branch_div_cycle = m_gpu->gpu_sim_cycle+m_gpu->gpu_tot_sim_cycle;
new_stack_entry.m_type = STACK_ENTRY_TYPE_CALL;
m_stack.push_back(new_stack_entry);
return;
@@ -1065,7 +1070,7 @@ void simt_stack::update( simt_mask_t &thread_done, addr_vector_t &next_pc, addre
new_recvg_pc = recvg_pc;
if (new_recvg_pc != top_recvg_pc) {
m_stack.back().m_pc = new_recvg_pc;
- m_stack.back().m_branch_div_cycle = gpu_sim_cycle+gpu_tot_sim_cycle;
+ m_stack.back().m_branch_div_cycle = m_gpu->gpu_sim_cycle+m_gpu->gpu_tot_sim_cycle;
m_stack.push_back(simt_stack_entry());
}
@@ -1157,7 +1162,7 @@ void core_t::initilizeSIMTStack(unsigned warp_count, unsigned warp_size)
{
m_simt_stack = new simt_stack*[warp_count];
for (unsigned i = 0; i < warp_count; ++i)
- m_simt_stack[i] = new simt_stack(i,warp_size);
+ m_simt_stack[i] = new simt_stack(i,warp_size,m_gpu);
m_warp_size = warp_size;
m_warp_count = warp_count;
}