summaryrefslogtreecommitdiff
path: root/src/cuda-sim/ptx-stats.cc
diff options
context:
space:
mode:
authorMahmoud <[email protected]>2019-08-22 12:47:51 -0400
committerMahmoud <[email protected]>2019-08-22 12:47:51 -0400
commitf946986a2337df4cd96ac6ec0956ac25644fa1a9 (patch)
tree4e97d74e95904ff4d00bb54fbfa1037818fc46fc /src/cuda-sim/ptx-stats.cc
parent56c52cf6c4b369e9fd05759e9b16ea37ff6e332c (diff)
parent2f5b3332c9b9b3fa9fea43d61276bddb24aa7df2 (diff)
Merge branch 'dev' of https://github.com/purdue-aalp/gpgpu-sim_distribution into dev-private
Diffstat (limited to 'src/cuda-sim/ptx-stats.cc')
-rw-r--r--src/cuda-sim/ptx-stats.cc37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/cuda-sim/ptx-stats.cc b/src/cuda-sim/ptx-stats.cc
index 0a9f08d..22517df 100644
--- a/src/cuda-sim/ptx-stats.cc
+++ b/src/cuda-sim/ptx-stats.cc
@@ -32,12 +32,9 @@
#include <stdio.h>
#include <map>
#include "../tr1_hash_map.h"
+#include "../../libcuda/gpgpu_context.h"
-// options
-bool enable_ptx_file_line_stats;
-char * ptx_line_stats_filename = NULL;
-
-void ptx_file_line_stats_options(option_parser_t opp)
+void ptx_stats::ptx_file_line_stats_options(option_parser_t opp)
{
option_parser_register(opp, "-enable_ptx_file_line_stats", OPT_BOOL,
&enable_ptx_file_line_stats,
@@ -118,7 +115,7 @@ typedef tr1_hash_map<ptx_file_line, ptx_file_line_stats, hash_ptx_file_line> ptx
static ptx_file_line_stats_map_t ptx_file_line_stats_tracker;
// output statistics to a file
-void ptx_file_line_stats_write_file()
+void ptx_stats::ptx_file_line_stats_write_file()
{
// check if stat collection is turned on
if (enable_ptx_file_line_stats == 0) return;
@@ -154,27 +151,27 @@ void ptx_file_line_stats_add_exec_count(const ptx_instruction *pInsn)
// attribute pipeline latency to this ptx instruction (specified by the pc)
// pipeline latency is the number of cycles a warp with this instruction spent in the pipeline
-void ptx_file_line_stats_add_latency(unsigned pc, unsigned latency)
+void ptx_stats::ptx_file_line_stats_add_latency(unsigned pc, unsigned latency)
{
- const ptx_instruction *pInsn = function_info::pc_to_instruction(pc);
+ const ptx_instruction *pInsn = gpgpu_ctx->pc_to_instruction(pc);
ptx_file_line_stats_tracker[ptx_file_line(pInsn->source_file(), pInsn->source_line())].latency += latency;
}
// attribute dram traffic to this ptx instruction (specified by the pc)
// dram traffic is counted in number of requests
-void ptx_file_line_stats_add_dram_traffic(unsigned pc, unsigned dram_traffic)
+void ptx_stats::ptx_file_line_stats_add_dram_traffic(unsigned pc, unsigned dram_traffic)
{
- const ptx_instruction *pInsn = function_info::pc_to_instruction(pc);
+ const ptx_instruction *pInsn = gpgpu_ctx->pc_to_instruction(pc);
ptx_file_line_stats_tracker[ptx_file_line(pInsn->source_file(), pInsn->source_line())].dram_traffic += dram_traffic;
}
// attribute the number of shared memory access cycles to a ptx instruction
// counts both the number of warps doing shared memory access and the number of cycles involved
-void ptx_file_line_stats_add_smem_bank_conflict(unsigned pc, unsigned n_way_bkconflict)
+void ptx_stats::ptx_file_line_stats_add_smem_bank_conflict(unsigned pc, unsigned n_way_bkconflict)
{
- const ptx_instruction *pInsn = function_info::pc_to_instruction(pc);
+ const ptx_instruction *pInsn = gpgpu_ctx->pc_to_instruction(pc);
ptx_file_line_stats& line_stats = ptx_file_line_stats_tracker[ptx_file_line(pInsn->source_file(), pInsn->source_line())];
line_stats.smem_n_way_bank_conflict_total += n_way_bkconflict;
@@ -183,9 +180,9 @@ void ptx_file_line_stats_add_smem_bank_conflict(unsigned pc, unsigned n_way_bkco
// attribute a non-coalesced mem access to a ptx instruction
// counts both the number of warps causing this and the number of memory requests generated
-void ptx_file_line_stats_add_uncoalesced_gmem(unsigned pc, unsigned n_access)
+void ptx_stats::ptx_file_line_stats_add_uncoalesced_gmem(unsigned pc, unsigned n_access)
{
- const ptx_instruction *pInsn = function_info::pc_to_instruction(pc);
+ const ptx_instruction *pInsn = gpgpu_ctx->pc_to_instruction(pc);
ptx_file_line_stats& line_stats = ptx_file_line_stats_tracker[ptx_file_line(pInsn->source_file(), pInsn->source_line())];
line_stats.gmem_n_access_total += n_access;
@@ -242,17 +239,17 @@ void ptx_file_line_stats_create_exposed_latency_tracker(int n_shader_cores)
}
// add an inflight memory instruction
-void ptx_file_line_stats_add_inflight_memory_insn(int sc_id, unsigned pc)
+void ptx_stats::ptx_file_line_stats_add_inflight_memory_insn(int sc_id, unsigned pc)
{
- const ptx_instruction *pInsn = function_info::pc_to_instruction(pc);
+ const ptx_instruction *pInsn = gpgpu_ctx->pc_to_instruction(pc);
inflight_mem_tracker[sc_id].add_count(pInsn);
}
// remove an inflight memory instruction
-void ptx_file_line_stats_sub_inflight_memory_insn(int sc_id, unsigned pc)
+void ptx_stats::ptx_file_line_stats_sub_inflight_memory_insn(int sc_id, unsigned pc)
{
- const ptx_instruction *pInsn = function_info::pc_to_instruction(pc);
+ const ptx_instruction *pInsn = gpgpu_ctx->pc_to_instruction(pc);
inflight_mem_tracker[sc_id].sub_count(pInsn);
}
@@ -265,9 +262,9 @@ void ptx_file_line_stats_commit_exposed_latency(int sc_id, int exposed_latency)
}
// attribute the number of warp divergence to a ptx instruction
-void ptx_file_line_stats_add_warp_divergence(unsigned pc, unsigned n_way_divergence)
+void ptx_stats::ptx_file_line_stats_add_warp_divergence(unsigned pc, unsigned n_way_divergence)
{
- const ptx_instruction *pInsn = function_info::pc_to_instruction(pc);
+ const ptx_instruction *pInsn = gpgpu_ctx->pc_to_instruction(pc);
ptx_file_line_stats& line_stats = ptx_file_line_stats_tracker[ptx_file_line(pInsn->source_file(), pInsn->source_line())];
line_stats.warp_divergence += n_way_divergence;