summaryrefslogtreecommitdiff
path: root/src/gpgpu-sim
diff options
context:
space:
mode:
authorVijayKandiah <[email protected]>2021-10-17 02:18:10 -0500
committerVijayKandiah <[email protected]>2021-10-17 02:18:10 -0500
commit84c6cf45131e42b1a724ebf7977987a9ddb70db9 (patch)
treee82f15238e79a03f3cc2435d4f9bb48d5023e8ae /src/gpgpu-sim
parent4a4fc87a2dcd95bfe298f2b3d18a9833a506e499 (diff)
AccelWattch dev Integration
Diffstat (limited to 'src/gpgpu-sim')
-rw-r--r--src/gpgpu-sim/dram.cc26
-rw-r--r--src/gpgpu-sim/dram.h25
-rw-r--r--src/gpgpu-sim/gpu-cache.cc22
-rw-r--r--src/gpgpu-sim/gpu-cache.h21
-rw-r--r--src/gpgpu-sim/gpu-sim.cc170
-rw-r--r--src/gpgpu-sim/gpu-sim.h63
-rw-r--r--src/gpgpu-sim/l2cache.cc30
-rw-r--r--src/gpgpu-sim/l2cache.h23
-rw-r--r--src/gpgpu-sim/power_interface.cc456
-rw-r--r--src/gpgpu-sim/power_interface.h35
-rw-r--r--src/gpgpu-sim/power_stat.cc467
-rw-r--r--src/gpgpu-sim/power_stat.h832
-rw-r--r--src/gpgpu-sim/shader.cc94
-rw-r--r--src/gpgpu-sim/shader.h413
-rw-r--r--src/gpgpu-sim/stat-tool.cc2
-rw-r--r--src/gpgpu-sim/stat-tool.h2
16 files changed, 1942 insertions, 739 deletions
diff --git a/src/gpgpu-sim/dram.cc b/src/gpgpu-sim/dram.cc
index ca47c46..545c45d 100644
--- a/src/gpgpu-sim/dram.cc
+++ b/src/gpgpu-sim/dram.cc
@@ -1,19 +1,20 @@
-// Copyright (c) 2009-2011, Tor M. Aamodt, Wilson W.L. Fung, Ali Bakhoda,
-// Ivan Sham, George L. Yuan,
-// The University of British Columbia
+// Copyright (c) 2009-2021, Tor M. Aamodt, Wilson W.L. Fung, Ali Bakhoda,
+// Ivan Sham, George L. Yuan, Vijay Kandiah, Nikos Hardavellas
+// The University of British Columbia, Northwestern University
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution. Neither the name of
-// The University of British Columbia nor the names of its contributors may be
-// used to endorse or promote products derived from this software without
-// specific prior written permission.
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer;
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution;
+// 3. Neither the names of The University of British Columbia, Northwestern
+// University nor the names of their contributors may be used to
+// endorse or promote products derived from this software without specific
+// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -855,7 +856,7 @@ void dram_t::visualizer_print(gzFile visualizer_file) {
void dram_t::set_dram_power_stats(unsigned &cmd, unsigned &activity,
unsigned &nop, unsigned &act, unsigned &pre,
- unsigned &rd, unsigned &wr,
+ unsigned &rd, unsigned &wr, unsigned &wr_WB,
unsigned &req) const {
// Point power performance counters to low-level DRAM counters
cmd = n_cmd;
@@ -865,6 +866,7 @@ void dram_t::set_dram_power_stats(unsigned &cmd, unsigned &activity,
pre = n_pre;
rd = n_rd;
wr = n_wr;
+ wr_WB = n_wr_WB;
req = n_req;
}
diff --git a/src/gpgpu-sim/dram.h b/src/gpgpu-sim/dram.h
index 6c212e9..88e46ed 100644
--- a/src/gpgpu-sim/dram.h
+++ b/src/gpgpu-sim/dram.h
@@ -1,19 +1,20 @@
-// Copyright (c) 2009-2011, Tor M. Aamodt, Ivan Sham, Ali Bakhoda,
-// George L. Yuan, Wilson W.L. Fung
-// The University of British Columbia
+// Copyright (c) 2009-2021, Tor M. Aamodt, Ivan Sham, Ali Bakhoda,
+// George L. Yuan, Wilson W.L. Fung, Vijay Kandiah, Nikos Hardavellas
+// The University of British Columbia, Northwestern University
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution. Neither the name of
-// The University of British Columbia nor the names of its contributors may be
-// used to endorse or promote products derived from this software without
-// specific prior written permission.
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer;
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution;
+// 3. Neither the names of The University of British Columbia, Northwestern
+// University nor the names of their contributors may be used to
+// endorse or promote products derived from this software without specific
+// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -135,7 +136,7 @@ class dram_t {
// Power Model
void set_dram_power_stats(unsigned &cmd, unsigned &activity, unsigned &nop,
unsigned &act, unsigned &pre, unsigned &rd,
- unsigned &wr, unsigned &req) const;
+ unsigned &wr, unsigned &wr_WB, unsigned &req) const;
const memory_config *m_config;
diff --git a/src/gpgpu-sim/gpu-cache.cc b/src/gpgpu-sim/gpu-cache.cc
index 7416246..a2aeec5 100644
--- a/src/gpgpu-sim/gpu-cache.cc
+++ b/src/gpgpu-sim/gpu-cache.cc
@@ -1,18 +1,19 @@
-// Copyright (c) 2009-2011, Tor M. Aamodt, Tayler Hetherington
-// The University of British Columbia
+// Copyright (c) 2009-2021, Tor M. Aamodt, Tayler Hetherington, Vijay Kandiah, Nikos Hardavellas
+// The University of British Columbia, Northwestern University
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution. Neither the name of
-// The University of British Columbia nor the names of its contributors may be
-// used to endorse or promote products derived from this software without
-// specific prior written permission.
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer;
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution;
+// 3. Neither the names of The University of British Columbia, Northwestern
+// University nor the names of their contributors may be used to
+// endorse or promote products derived from this software without specific
+// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -642,6 +643,7 @@ void cache_stats::clear() {
///
for (unsigned i = 0; i < NUM_MEM_ACCESS_TYPE; ++i) {
std::fill(m_stats[i].begin(), m_stats[i].end(), 0);
+ std::fill(m_stats_pw[i].begin(), m_stats_pw[i].end(), 0);
std::fill(m_fail_stats[i].begin(), m_fail_stats[i].end(), 0);
}
m_cache_port_available_cycles = 0;
diff --git a/src/gpgpu-sim/gpu-cache.h b/src/gpgpu-sim/gpu-cache.h
index 67d084c..498dfeb 100644
--- a/src/gpgpu-sim/gpu-cache.h
+++ b/src/gpgpu-sim/gpu-cache.h
@@ -1,18 +1,19 @@
-// Copyright (c) 2009-2011, Tor M. Aamodt, Tayler Hetherington
-// The University of British Columbia
+// Copyright (c) 2009-2021, Tor M. Aamodt, Tayler Hetherington, Vijay Kandiah, Nikos Hardavellas
+// The University of British Columbia, Northwestern University
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution. Neither the name of
-// The University of British Columbia nor the names of its contributors may be
-// used to endorse or promote products derived from this software without
-// specific prior written permission.
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer;
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution;
+// 3. Neither the names of The University of British Columbia, Northwestern
+// University nor the names of their contributors may be used to
+// endorse or promote products derived from this software without specific
+// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc
index 56ede05..e44551e 100644
--- a/src/gpgpu-sim/gpu-sim.cc
+++ b/src/gpgpu-sim/gpu-sim.cc
@@ -1,19 +1,20 @@
-// Copyright (c) 2009-2011, Tor M. Aamodt, Wilson W.L. Fung, George L. Yuan,
-// Ali Bakhoda, Andrew Turner, Ivan Sham
-// The University of British Columbia
+// Copyright (c) 2009-2021, Tor M. Aamodt, Wilson W.L. Fung, George L. Yuan,
+// Ali Bakhoda, Andrew Turner, Ivan Sham, Vijay Kandiah, Nikos Hardavellas
+// The University of British Columbia, Northwestern University
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution. Neither the name of
-// The University of British Columbia nor the names of its contributors may be
-// used to endorse or promote products derived from this software without
-// specific prior written permission.
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer;
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution;
+// 3. Neither the names of The University of British Columbia, Northwestern
+// University nor the names of their contributors may be used to
+// endorse or promote products derived from this software without specific
+// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -95,10 +96,11 @@ tr1_hash_map<new_addr_type, unsigned> address_random_interleaving;
#include "mem_latency_stat.h"
+
void power_config::reg_options(class OptionParser *opp) {
- option_parser_register(opp, "-gpuwattch_xml_file", OPT_CSTR,
- &g_power_config_name, "GPUWattch XML file",
- "gpuwattch.xml");
+ option_parser_register(opp, "-accelwattch_xml_file", OPT_CSTR,
+ &g_power_config_name, "AccelWattch XML file",
+ "accelwattch_sass_sim.xml");
option_parser_register(opp, "-power_simulation_enabled", OPT_BOOL,
&g_power_simulation_enabled,
@@ -108,6 +110,92 @@ void power_config::reg_options(class OptionParser *opp) {
&g_power_per_cycle_dump,
"Dump detailed power output each cycle", "0");
+
+
+
+ option_parser_register(opp, "-hw_perf_file_name", OPT_CSTR,
+ &g_hw_perf_file_name, "Hardware Performance Statistics file",
+ "hw_perf.csv");
+
+ option_parser_register(opp, "-hw_perf_bench_name", OPT_CSTR,
+ &g_hw_perf_bench_name, "Kernel Name in Hardware Performance Statistics file",
+ "");
+
+ option_parser_register(opp, "-power_simulation_mode", OPT_INT32,
+ &g_power_simulation_mode,
+ "Switch performance counter input for power simulation (0=Sim, 1=HW, 2=HW-Sim Hybrid)", "0");
+
+ option_parser_register(opp, "-dvfs_enabled", OPT_BOOL,
+ &g_dvfs_enabled,
+ "Turn on DVFS for power model", "0");
+ option_parser_register(opp, "-aggregate_power_stats", OPT_BOOL,
+ &g_aggregate_power_stats,
+ "Accumulate power across all kernels", "0");
+
+ //Accelwattch Hyrbid Configuration
+
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_L1_RH", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_L1_RH],
+ "Get L1 Read Hits for Accelwattch-Hybrid from Accel-Sim", "0");
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_L1_RM", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_L1_RM],
+ "Get L1 Read Misses for Accelwattch-Hybrid from Accel-Sim", "0");
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_L1_WH", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_L1_WH],
+ "Get L1 Write Hits for Accelwattch-Hybrid from Accel-Sim", "0");
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_L1_WM", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_L1_WM],
+ "Get L1 Write Misses for Accelwattch-Hybrid from Accel-Sim", "0");
+
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_L2_RH", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_L2_RH],
+ "Get L2 Read Hits for Accelwattch-Hybrid from Accel-Sim", "0");
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_L2_RM", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_L2_RM],
+ "Get L2 Read Misses for Accelwattch-Hybrid from Accel-Sim", "0");
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_L2_WH", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_L2_WH],
+ "Get L2 Write Hits for Accelwattch-Hybrid from Accel-Sim", "0");
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_L2_WM", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_L2_WM],
+ "Get L2 Write Misses for Accelwattch-Hybrid from Accel-Sim", "0");
+
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_CC_ACC", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_CC_ACC],
+ "Get Constant Cache Acesses for Accelwattch-Hybrid from Accel-Sim", "0");
+
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_SHARED_ACC", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_SHRD_ACC],
+ "Get Shared Memory Acesses for Accelwattch-Hybrid from Accel-Sim", "0");
+
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_DRAM_RD", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_DRAM_RD],
+ "Get DRAM Reads for Accelwattch-Hybrid from Accel-Sim", "0");
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_DRAM_WR", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_DRAM_WR],
+ "Get DRAM Writes for Accelwattch-Hybrid from Accel-Sim", "0");
+
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_NOC", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_NOC],
+ "Get Interconnect Acesses for Accelwattch-Hybrid from Accel-Sim", "0");
+
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_PIPE_DUTY", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_PIPE_DUTY],
+ "Get Pipeline Duty Cycle Acesses for Accelwattch-Hybrid from Accel-Sim", "0");
+
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_NUM_SM_IDLE", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_NUM_SM_IDLE],
+ "Get Number of Idle SMs for Accelwattch-Hybrid from Accel-Sim", "0");
+
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_CYCLES", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_CYCLES],
+ "Get Executed Cycles for Accelwattch-Hybrid from Accel-Sim", "0");
+
+ option_parser_register(opp, "-accelwattch_hybrid_perfsim_VOLTAGE", OPT_BOOL,
+ &accelwattch_hybrid_configuration[HW_VOLTAGE],
+ "Get Chip Voltage for Accelwattch-Hybrid from Accel-Sim", "0");
+
+
// Output Data Formats
option_parser_register(
opp, "-power_trace_enabled", OPT_BOOL, &g_power_trace_enabled,
@@ -835,7 +923,7 @@ gpgpu_sim::gpgpu_sim(const gpgpu_sim_config &config, gpgpu_context *ctx)
#ifdef GPGPUSIM_POWER_MODEL
m_gpgpusim_wrapper = new gpgpu_sim_wrapper(config.g_power_simulation_enabled,
- config.g_power_config_name);
+ config.g_power_config_name, config.g_power_simulation_mode, config.g_dvfs_enabled);
#endif
m_shader_stats = new shader_core_stats(m_shader_config);
@@ -1010,6 +1098,14 @@ void gpgpu_sim::init() {
partiton_reqs_in_parallel_util = 0;
gpu_sim_cycle_parition_util = 0;
+// McPAT initialization function. Called on first launch of GPU
+#ifdef GPGPUSIM_POWER_MODEL
+ if (m_config.g_power_simulation_enabled) {
+ init_mcpat(m_config, m_gpgpusim_wrapper, m_config.gpu_stat_sample_freq,
+ gpu_tot_sim_insn, gpu_sim_insn);
+ }
+#endif
+
reinit_clock_domains();
gpgpu_ctx->func_sim->set_param_gpgpu_num_shaders(m_config.num_shader());
for (unsigned i = 0; i < m_shader_config->n_simt_clusters; i++)
@@ -1035,14 +1131,6 @@ void gpgpu_sim::init() {
}
if (g_network_mode) icnt_init();
-
- // McPAT initialization function. Called on first launch of GPU
-#ifdef GPGPUSIM_POWER_MODEL
- if (m_config.g_power_simulation_enabled) {
- init_mcpat(m_config, m_gpgpusim_wrapper, m_config.gpu_stat_sample_freq,
- gpu_tot_sim_insn, gpu_sim_insn);
- }
-#endif
}
void gpgpu_sim::update_stats() {
@@ -1067,6 +1155,11 @@ void gpgpu_sim::update_stats() {
gpu_occupancy = occupancy_stats();
}
+PowerscalingCoefficients *gpgpu_sim::get_scaling_coeffs()
+{
+ return m_gpgpusim_wrapper->get_scaling_coeffs();
+}
+
void gpgpu_sim::print_stats() {
gpgpu_ctx->stats->ptx_file_line_stats_write_file();
gpu_print_stat();
@@ -1146,6 +1239,18 @@ std::string gpgpu_sim::executed_kernel_info_string() {
return statout.str();
}
+
+std::string gpgpu_sim::executed_kernel_name() {
+ std::stringstream statout;
+ if( m_executed_kernel_names.size() == 1)
+ statout << m_executed_kernel_names[0];
+ else{
+ for (unsigned int k = 0; k < m_executed_kernel_names.size(); k++) {
+ statout << m_executed_kernel_names[k] << " ";
+ }
+ }
+ return statout.str();
+}
void gpgpu_sim::set_cache_config(std::string kernel_name,
FuncCache cacheConfig) {
m_special_cache_config[kernel_name] = cacheConfig;
@@ -1326,10 +1431,20 @@ void gpgpu_sim::gpu_print_stat() {
m_shader_stats->print(stdout);
#ifdef GPGPUSIM_POWER_MODEL
if (m_config.g_power_simulation_enabled) {
+ if(m_config.g_power_simulation_mode > 0){
+ //if(!m_config.g_aggregate_power_stats)
+ mcpat_reset_perf_count(m_gpgpusim_wrapper);
+ calculate_hw_mcpat(m_config, getShaderCoreConfig(), m_gpgpusim_wrapper,
+ m_power_stats, m_config.gpu_stat_sample_freq,
+ gpu_tot_sim_cycle, gpu_sim_cycle, gpu_tot_sim_insn,
+ gpu_sim_insn, m_config.g_power_simulation_mode, m_config.g_dvfs_enabled,
+ m_config.g_hw_perf_file_name, m_config.g_hw_perf_bench_name, executed_kernel_name(), m_config.accelwattch_hybrid_configuration, m_config.g_aggregate_power_stats);
+ }
m_gpgpusim_wrapper->print_power_kernel_stats(
gpu_sim_cycle, gpu_tot_sim_cycle, gpu_tot_sim_insn + gpu_sim_insn,
kernel_info_str, true);
- mcpat_reset_perf_count(m_gpgpusim_wrapper);
+ //if(!m_config.g_aggregate_power_stats)
+ mcpat_reset_perf_count(m_gpgpusim_wrapper);
}
#endif
@@ -1796,6 +1911,7 @@ void gpgpu_sim::cycle() {
m_power_stats->pwr_mem_stat->n_pre[CURRENT_STAT_IDX][i],
m_power_stats->pwr_mem_stat->n_rd[CURRENT_STAT_IDX][i],
m_power_stats->pwr_mem_stat->n_wr[CURRENT_STAT_IDX][i],
+ m_power_stats->pwr_mem_stat->n_wr_WB[CURRENT_STAT_IDX][i],
m_power_stats->pwr_mem_stat->n_req[CURRENT_STAT_IDX][i]);
}
}
@@ -1839,7 +1955,7 @@ void gpgpu_sim::cycle() {
m_cluster[i]->core_cycle();
*active_sms += m_cluster[i]->get_n_active_sms();
}
- // Update core icnt/cache stats for GPUWattch
+ // Update core icnt/cache stats for AccelWattch
m_cluster[i]->get_icnt_stats(
m_power_stats->pwr_mem_stat->n_simt_to_mem[CURRENT_STAT_IDX][i],
m_power_stats->pwr_mem_stat->n_mem_to_simt[CURRENT_STAT_IDX][i]);
@@ -1869,10 +1985,12 @@ void gpgpu_sim::cycle() {
// McPAT main cycle (interface with McPAT)
#ifdef GPGPUSIM_POWER_MODEL
if (m_config.g_power_simulation_enabled) {
+ if(m_config.g_power_simulation_mode == 0){
mcpat_cycle(m_config, getShaderCoreConfig(), m_gpgpusim_wrapper,
m_power_stats, m_config.gpu_stat_sample_freq,
gpu_tot_sim_cycle, gpu_sim_cycle, gpu_tot_sim_insn,
- gpu_sim_insn);
+ gpu_sim_insn, m_config.g_dvfs_enabled);
+ }
}
#endif
diff --git a/src/gpgpu-sim/gpu-sim.h b/src/gpgpu-sim/gpu-sim.h
index 2e6820d..68b3dfa 100644
--- a/src/gpgpu-sim/gpu-sim.h
+++ b/src/gpgpu-sim/gpu-sim.h
@@ -1,18 +1,19 @@
-// Copyright (c) 2009-2011, Tor M. Aamodt, Wilson W.L. Fung
-// The University of British Columbia
+// Copyright (c) 2009-2021, Tor M. Aamodt, Wilson W.L. Fung, Vijay Kandiah, Nikos Hardavellas
+// The University of British Columbia, Northwestern University
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution. Neither the name of
-// The University of British Columbia nor the names of its contributors may be
-// used to endorse or promote products derived from this software without
-// specific prior written permission.
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer;
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution;
+// 3. Neither the names of The University of British Columbia, Northwestern
+// University nor the names of their contributors may be used to
+// endorse or promote products derived from this software without specific
+// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -26,6 +27,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
+
#ifndef GPU_SIM_H
#define GPU_SIM_H
@@ -68,6 +70,29 @@ extern tr1_hash_map<new_addr_type, unsigned> address_random_interleaving;
enum dram_ctrl_t { DRAM_FIFO = 0, DRAM_FRFCFS = 1 };
+enum hw_perf_t {
+ HW_BENCH_NAME=0,
+ HW_KERNEL_NAME,
+ HW_L1_RH,
+ HW_L1_RM,
+ HW_L1_WH,
+ HW_L1_WM,
+ HW_CC_ACC,
+ HW_SHRD_ACC,
+ HW_DRAM_RD,
+ HW_DRAM_WR,
+ HW_L2_RH,
+ HW_L2_RM,
+ HW_L2_WH,
+ HW_L2_WM,
+ HW_NOC,
+ HW_PIPE_DUTY,
+ HW_NUM_SM_IDLE,
+ HW_CYCLES,
+ HW_VOLTAGE,
+ HW_TOTAL_STATS
+};
+
struct power_config {
power_config() { m_valid = true; }
void init() {
@@ -82,7 +107,8 @@ struct power_config {
s++;
}
char buf1[1024];
- snprintf(buf1, 1024, "gpgpusim_power_report__%s.log", date);
+ //snprintf(buf1, 1024, "accelwattch_power_report__%s.log", date);
+ snprintf(buf1, 1024, "accelwattch_power_report.log");
g_power_filename = strdup(buf1);
char buf2[1024];
snprintf(buf2, 1024, "gpgpusim_power_trace_report__%s.log.gz", date);
@@ -94,6 +120,9 @@ struct power_config {
snprintf(buf4, 1024, "gpgpusim_steady_state_tracking_report__%s.log.gz",
date);
g_steady_state_tracking_filename = strdup(buf4);
+ // for(int i =0; i< hw_perf_t::HW_TOTAL_STATS; i++){
+ // accelwattch_hybrid_configuration[i] = 0;
+ // }
if (g_steady_power_levels_enabled) {
sscanf(gpu_steady_state_definition, "%lf:%lf",
@@ -125,6 +154,14 @@ struct power_config {
double gpu_steady_power_deviation;
double gpu_steady_min_period;
+
+ char *g_hw_perf_file_name;
+ char *g_hw_perf_bench_name;
+ int g_power_simulation_mode;
+ bool g_dvfs_enabled;
+ bool g_aggregate_power_stats;
+ bool accelwattch_hybrid_configuration[hw_perf_t::HW_TOTAL_STATS];
+
// Nonlinear power model
bool g_use_nonlinear_model;
char *gpu_nonlinear_model_config;
@@ -357,7 +394,7 @@ class gpgpu_sim_config : public power_config,
m_valid = true;
}
-
+ unsigned get_core_freq() const { return core_freq; }
unsigned num_shader() const { return m_shader_config.num_shader(); }
unsigned num_cluster() const { return m_shader_config.n_simt_clusters; }
unsigned get_max_concurrent_kernel() const { return max_concurrent_kernel; }
@@ -527,6 +564,7 @@ class gpgpu_sim : public gpgpu_t {
bool kernel_more_cta_left(kernel_info_t *kernel) const;
bool hit_max_cta_count() const;
kernel_info_t *select_kernel();
+ PowerscalingCoefficients *get_scaling_coeffs();
void decrement_kernel_latency();
const gpgpu_sim_config &get_config() const { return m_config; }
@@ -634,6 +672,7 @@ class gpgpu_sim : public gpgpu_t {
std::string executed_kernel_info_string(); //< format the kernel information
// into a string for stat printout
+ std::string executed_kernel_name();
void clear_executed_kernel_info(); //< clear the kernel information after
// stat printout
virtual void createSIMTCluster() = 0;
diff --git a/src/gpgpu-sim/l2cache.cc b/src/gpgpu-sim/l2cache.cc
index f1c761f..511c15e 100644
--- a/src/gpgpu-sim/l2cache.cc
+++ b/src/gpgpu-sim/l2cache.cc
@@ -1,18 +1,19 @@
-// Copyright (c) 2009-2011, Tor M. Aamodt
-// The University of British Columbia
+// Copyright (c) 2009-2021, Tor M. Aamodt, Vijay Kandiah, Nikos Hardavellas
+// The University of British Columbia, Northwestern University
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution. Neither the name of
-// The University of British Columbia nor the names of its contributors may be
-// used to endorse or promote products derived from this software without
-// specific prior written permission.
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer;
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution;
+// 3. Neither the names of The University of British Columbia, Northwestern
+// University nor the names of their contributors may be used to
+// endorse or promote products derived from this software without specific
+// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -388,9 +389,9 @@ void memory_partition_unit::set_done(mem_fetch *mf) {
void memory_partition_unit::set_dram_power_stats(
unsigned &n_cmd, unsigned &n_activity, unsigned &n_nop, unsigned &n_act,
- unsigned &n_pre, unsigned &n_rd, unsigned &n_wr, unsigned &n_req) const {
+ unsigned &n_pre, unsigned &n_rd, unsigned &n_wr, unsigned &n_wr_WB, unsigned &n_req) const {
m_dram->set_dram_power_stats(n_cmd, n_activity, n_nop, n_act, n_pre, n_rd,
- n_wr, n_req);
+ n_wr, n_wr_WB, n_req);
}
void memory_partition_unit::print(FILE *fp) const {
@@ -664,6 +665,7 @@ void gpgpu_sim::print_dram_stats(FILE *fout) const {
unsigned pre = 0;
unsigned rd = 0;
unsigned wr = 0;
+ unsigned wr_WB = 0;
unsigned req = 0;
unsigned tot_cmd = 0;
unsigned tot_nop = 0;
@@ -675,13 +677,13 @@ void gpgpu_sim::print_dram_stats(FILE *fout) const {
for (unsigned i = 0; i < m_memory_config->m_n_mem; i++) {
m_memory_partition_unit[i]->set_dram_power_stats(cmd, activity, nop, act,
- pre, rd, wr, req);
+ pre, rd, wr, wr_WB, req);
tot_cmd += cmd;
tot_nop += nop;
tot_act += act;
tot_pre += pre;
tot_rd += rd;
- tot_wr += wr;
+ tot_wr += wr + wr_WB;
tot_req += req;
}
fprintf(fout, "gpgpu_n_dram_reads = %d\n", tot_rd);
diff --git a/src/gpgpu-sim/l2cache.h b/src/gpgpu-sim/l2cache.h
index beed765..902a4b7 100644
--- a/src/gpgpu-sim/l2cache.h
+++ b/src/gpgpu-sim/l2cache.h
@@ -1,18 +1,19 @@
-// Copyright (c) 2009-2011, Tor M. Aamodt
-// The University of British Columbia
+// Copyright (c) 2009-2021, Tor M. Aamodt, Vijay Kandiah, Nikos Hardavellas
+// The University of British Columbia, Northwestern University
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution. Neither the name of
-// The University of British Columbia nor the names of its contributors may be
-// used to endorse or promote products derived from this software without
-// specific prior written permission.
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer;
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution;
+// 3. Neither the names of The University of British Columbia, Northwestern
+// University nor the names of their contributors may be used to
+// endorse or promote products derived from this software without specific
+// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -95,7 +96,7 @@ class memory_partition_unit {
// Power model
void set_dram_power_stats(unsigned &n_cmd, unsigned &n_activity,
unsigned &n_nop, unsigned &n_act, unsigned &n_pre,
- unsigned &n_rd, unsigned &n_wr,
+ unsigned &n_rd, unsigned &n_wr, unsigned &n_wr_WB,
unsigned &n_req) const;
int global_sub_partition_id_to_local_id(int global_sub_partition_id) const;
diff --git a/src/gpgpu-sim/power_interface.cc b/src/gpgpu-sim/power_interface.cc
index c637d84..63b9852 100644
--- a/src/gpgpu-sim/power_interface.cc
+++ b/src/gpgpu-sim/power_interface.cc
@@ -1,18 +1,19 @@
-// Copyright (c) 2009-2011, Tor M. Aamodt, Ahmed El-Shafiey, Tayler Hetherington
-// The University of British Columbia
+// Copyright (c) 2009-2021, Tor M. Aamodt, Ahmed El-Shafiey, Tayler Hetherington, Vijay Kandiah, Nikos Hardavellas
+// The University of British Columbia, Northwestern University
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution. Neither the name of
-// The University of British Columbia nor the names of its contributors may be
-// used to endorse or promote products derived from this software without
-// specific prior written permission.
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer;
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution;
+// 3. Neither the names of The University of British Columbia, Northwestern
+// University nor the names of their contributors may be used to
+// endorse or promote products derived from this software without specific
+// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -26,8 +27,10 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
+
#include "power_interface.h"
+
void init_mcpat(const gpgpu_sim_config &config,
class gpgpu_sim_wrapper *wrapper, unsigned stat_sample_freq,
unsigned tot_inst, unsigned inst) {
@@ -38,7 +41,11 @@ void init_mcpat(const gpgpu_sim_config &config,
config.g_power_simulation_enabled, config.g_power_trace_enabled,
config.g_steady_power_levels_enabled, config.g_power_per_cycle_dump,
config.gpu_steady_power_deviation, config.gpu_steady_min_period,
- config.g_power_trace_zlevel, tot_inst + inst, stat_sample_freq);
+ config.g_power_trace_zlevel, tot_inst + inst, stat_sample_freq,
+ config.g_power_simulation_mode,
+ config.g_dvfs_enabled,
+ config.get_core_freq()/1000000,
+ config.num_shader());
}
void mcpat_cycle(const gpgpu_sim_config &config,
@@ -46,7 +53,7 @@ void mcpat_cycle(const gpgpu_sim_config &config,
class gpgpu_sim_wrapper *wrapper,
class power_stat_t *power_stats, unsigned stat_sample_freq,
unsigned tot_cycle, unsigned cycle, unsigned tot_inst,
- unsigned inst) {
+ unsigned inst, bool dvfs_enabled) {
static bool mcpat_init = true;
if (mcpat_init) { // If first cycle, don't have any power numbers yet
@@ -55,41 +62,45 @@ void mcpat_cycle(const gpgpu_sim_config &config,
}
if ((tot_cycle + cycle) % stat_sample_freq == 0) {
+ if(dvfs_enabled){
+ wrapper->set_model_voltage(1); //performance model needs to support this.
+ }
+
wrapper->set_inst_power(
shdr_config->gpgpu_clock_gated_lanes, stat_sample_freq,
- stat_sample_freq, power_stats->get_total_inst(),
- power_stats->get_total_int_inst(), power_stats->get_total_fp_inst(),
- power_stats->get_l1d_read_accesses(),
- power_stats->get_l1d_write_accesses(),
- power_stats->get_committed_inst());
+ stat_sample_freq, power_stats->get_total_inst(0),
+ power_stats->get_total_int_inst(0), power_stats->get_total_fp_inst(0),
+ power_stats->get_l1d_read_accesses(0),
+ power_stats->get_l1d_write_accesses(0),
+ power_stats->get_committed_inst(0));
// Single RF for both int and fp ops
- wrapper->set_regfile_power(power_stats->get_regfile_reads(),
- power_stats->get_regfile_writes(),
- power_stats->get_non_regfile_operands());
+ wrapper->set_regfile_power(power_stats->get_regfile_reads(0),
+ power_stats->get_regfile_writes(0),
+ power_stats->get_non_regfile_operands(0));
// Instruction cache stats
- wrapper->set_icache_power(power_stats->get_inst_c_hits(),
- power_stats->get_inst_c_misses());
+ wrapper->set_icache_power(power_stats->get_inst_c_hits(0),
+ power_stats->get_inst_c_misses(0));
// Constant Cache, shared memory, texture cache
- wrapper->set_ccache_power(power_stats->get_constant_c_hits(),
- power_stats->get_constant_c_misses());
+ wrapper->set_ccache_power(power_stats->get_const_accessess(0), 0); //assuming all HITS in constant cache for now
wrapper->set_tcache_power(power_stats->get_texture_c_hits(),
power_stats->get_texture_c_misses());
- wrapper->set_shrd_mem_power(power_stats->get_shmem_read_access());
+ wrapper->set_shrd_mem_power(power_stats->get_shmem_access(0));
wrapper->set_l1cache_power(
- power_stats->get_l1d_read_hits(), power_stats->get_l1d_read_misses(),
- power_stats->get_l1d_write_hits(), power_stats->get_l1d_write_misses());
+ power_stats->get_l1d_read_hits(0), power_stats->get_l1d_read_misses(0),
+ power_stats->get_l1d_write_hits(0), power_stats->get_l1d_write_misses(0));
wrapper->set_l2cache_power(
- power_stats->get_l2_read_hits(), power_stats->get_l2_read_misses(),
- power_stats->get_l2_write_hits(), power_stats->get_l2_write_misses());
+ power_stats->get_l2_read_hits(0), power_stats->get_l2_read_misses(0),
+ power_stats->get_l2_write_hits(0), power_stats->get_l2_write_misses(0));
float active_sms = (*power_stats->m_active_sms) / stat_sample_freq;
float num_cores = shdr_config->num_shader();
float num_idle_core = num_cores - active_sms;
+ wrapper->set_num_cores(num_cores);
wrapper->set_idle_core_power(num_idle_core);
// pipeline power - pipeline_duty_cycle *= percent_active_sms;
@@ -101,38 +112,64 @@ void mcpat_cycle(const gpgpu_sim_config &config,
wrapper->set_duty_cycle_power(pipeline_duty_cycle);
// Memory Controller
- wrapper->set_mem_ctrl_power(power_stats->get_dram_rd(),
- power_stats->get_dram_wr(),
- power_stats->get_dram_pre());
+ wrapper->set_mem_ctrl_power(power_stats->get_dram_rd(0),
+ power_stats->get_dram_wr(0),
+ power_stats->get_dram_pre(0));
// Execution pipeline accesses
// FPU (SP) accesses, Integer ALU (not present in Tesla), Sfu accesses
- wrapper->set_exec_unit_power(power_stats->get_tot_fpu_accessess(),
- power_stats->get_ialu_accessess(),
- power_stats->get_tot_sfu_accessess());
+
+ wrapper->set_int_accesses(power_stats->get_ialu_accessess(0),
+ power_stats->get_intmul24_accessess(0),
+ power_stats->get_intmul32_accessess(0),
+ power_stats->get_intmul_accessess(0),
+ power_stats->get_intdiv_accessess(0));
+
+ wrapper->set_dp_accesses(power_stats->get_dp_accessess(0),
+ power_stats->get_dpmul_accessess(0),
+ power_stats->get_dpdiv_accessess(0));
+
+ wrapper->set_fp_accesses(power_stats->get_fp_accessess(0),
+ power_stats->get_fpmul_accessess(0),
+ power_stats->get_fpdiv_accessess(0));
+
+ wrapper->set_trans_accesses(power_stats->get_sqrt_accessess(0),
+ power_stats->get_log_accessess(0),
+ power_stats->get_sin_accessess(0),
+ power_stats->get_exp_accessess(0));
+
+ wrapper->set_tensor_accesses(power_stats->get_tensor_accessess(0));
+
+ wrapper->set_tex_accesses(power_stats->get_tex_accessess(0));
+
+ wrapper->set_exec_unit_power(power_stats->get_tot_fpu_accessess(0),
+ power_stats->get_ialu_accessess(0),
+ power_stats->get_tot_sfu_accessess(0));
+
+ wrapper->set_avg_active_threads(power_stats->get_active_threads(0));
// Average active lanes for sp and sfu pipelines
float avg_sp_active_lanes =
(power_stats->get_sp_active_lanes()) / stat_sample_freq;
float avg_sfu_active_lanes =
(power_stats->get_sfu_active_lanes()) / stat_sample_freq;
+ if(avg_sp_active_lanes >32.0 )
+ avg_sp_active_lanes = 32.0;
+ if(avg_sfu_active_lanes >32.0 )
+ avg_sfu_active_lanes = 32.0;
assert(avg_sp_active_lanes <= 32);
assert(avg_sfu_active_lanes <= 32);
- wrapper->set_active_lanes_power(
- (power_stats->get_sp_active_lanes()) / stat_sample_freq,
- (power_stats->get_sfu_active_lanes()) / stat_sample_freq);
+ wrapper->set_active_lanes_power(avg_sp_active_lanes, avg_sfu_active_lanes);
double n_icnt_simt_to_mem =
(double)
- power_stats->get_icnt_simt_to_mem(); // # flits from SIMT clusters
+ power_stats->get_icnt_simt_to_mem(0); // # flits from SIMT clusters
// to memory partitions
double n_icnt_mem_to_simt =
(double)
- power_stats->get_icnt_mem_to_simt(); // # flits from memory
+ power_stats->get_icnt_mem_to_simt(0); // # flits from memory
// partitions to SIMT clusters
- wrapper->set_NoC_power(
- n_icnt_mem_to_simt,
- n_icnt_simt_to_mem); // Number of flits traversing the interconnect
+ wrapper->set_NoC_power(n_icnt_mem_to_simt + n_icnt_simt_to_mem); // Number of flits traversing the interconnect
wrapper->compute();
@@ -152,3 +189,336 @@ void mcpat_cycle(const gpgpu_sim_config &config,
void mcpat_reset_perf_count(class gpgpu_sim_wrapper *wrapper) {
wrapper->reset_counters();
}
+
+bool parse_hw_file(char* hwpowerfile, bool find_target_kernel, vector<string> &hw_data, char* benchname, std::string executed_kernelname){
+ fstream hw_file;
+ hw_file.open(hwpowerfile, ios::in);
+ string line, word, temp;
+ while(!hw_file.eof()){
+ hw_data.clear();
+ getline(hw_file, line);
+ stringstream s(line);
+ while (getline(s,word,',')){
+ hw_data.push_back(word);
+ }
+ if(hw_data[HW_BENCH_NAME] == std::string(benchname)){
+ if(find_target_kernel){
+ if(hw_data[HW_KERNEL_NAME] == ""){
+ hw_file.close();
+ return true;
+ }
+ else{
+ if(hw_data[HW_KERNEL_NAME] == executed_kernelname){
+ hw_file.close();
+ return true;
+ }
+ }
+ }
+ else{
+ hw_file.close();
+ return true;
+ }
+ }
+ }
+ hw_file.close();
+ return false;
+}
+
+
+void calculate_hw_mcpat(const gpgpu_sim_config &config,
+ const shader_core_config *shdr_config,
+ class gpgpu_sim_wrapper *wrapper,
+ class power_stat_t *power_stats, unsigned stat_sample_freq,
+ unsigned tot_cycle, unsigned cycle, unsigned tot_inst,
+ unsigned inst, int power_simulation_mode, bool dvfs_enabled, char* hwpowerfile,
+ char* benchname, std::string executed_kernelname,
+ const bool *accelwattch_hybrid_configuration, bool aggregate_power_stats){
+
+ /* Reading HW data from CSV file */
+
+ vector<string> hw_data;
+ bool kernel_found = false;
+ kernel_found = parse_hw_file(hwpowerfile, true, hw_data, benchname, executed_kernelname); //Searching for matching executed_kernelname.
+ if(!kernel_found)
+ kernel_found = parse_hw_file(hwpowerfile, false, hw_data, benchname, executed_kernelname); //Searching for any kernel with same benchname.
+ assert("Could not find perf stats for the target benchmark in hwpowerfile.\n" && (kernel_found));
+ unsigned perf_cycles = static_cast<unsigned int>(std::stod(hw_data[HW_CYCLES]) + 0.5);
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_CYCLES]))
+ perf_cycles = cycle;
+ wrapper->init_mcpat_hw_mode(perf_cycles); //total PERF MODEL cycles for current kernel
+
+ if(dvfs_enabled){
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_VOLTAGE]))
+ wrapper->set_model_voltage(1); //performance model needs to support this
+ else
+ wrapper->set_model_voltage(std::stod(hw_data[HW_VOLTAGE])); //performance model needs to support this
+ }
+
+ double l1_read_hits = std::stod(hw_data[HW_L1_RH]);
+ double l1_read_misses = std::stod(hw_data[HW_L1_RM]);
+ double l1_write_hits = std::stod(hw_data[HW_L1_WH]);
+ double l1_write_misses = std::stod(hw_data[HW_L1_WM]);
+
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_L1_RH]))
+ l1_read_hits = power_stats->get_l1d_read_hits(1) - power_stats->l1r_hits_kernel;
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_L1_RM]))
+ l1_read_misses = power_stats->get_l1d_read_misses(1) - power_stats->l1r_misses_kernel;
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_L1_WH]))
+ l1_write_hits = power_stats->get_l1d_write_hits(1) - power_stats->l1w_hits_kernel;
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_L1_WM]))
+ l1_write_misses = power_stats->get_l1d_write_misses(1) - power_stats->l1w_misses_kernel;
+
+ if(aggregate_power_stats){
+ power_stats->tot_inst_execution += power_stats->get_total_inst(1);
+ power_stats->tot_int_inst_execution += power_stats->get_total_int_inst(1);
+ power_stats->tot_fp_inst_execution += power_stats->get_total_fp_inst(1);
+ power_stats->commited_inst_execution += power_stats->get_committed_inst(1);
+ wrapper->set_inst_power(
+ shdr_config->gpgpu_clock_gated_lanes, cycle, //TODO: core.[0] cycles counts don't matter, remove this
+ cycle, power_stats->tot_inst_execution,
+ power_stats->tot_int_inst_execution, power_stats->tot_fp_inst_execution,
+ l1_read_hits + l1_read_misses,
+ l1_write_hits + l1_write_misses,
+ power_stats->commited_inst_execution);
+ }
+ else{
+ wrapper->set_inst_power(
+ shdr_config->gpgpu_clock_gated_lanes, cycle, //TODO: core.[0] cycles counts don't matter, remove this
+ cycle, power_stats->get_total_inst(1),
+ power_stats->get_total_int_inst(1), power_stats->get_total_fp_inst(1),
+ l1_read_hits + l1_read_misses,
+ l1_write_hits + l1_write_misses,
+ power_stats->get_committed_inst(1));
+ }
+
+ // Single RF for both int and fp ops -- activity factor set to 0 for Accelwattch HW and Accelwattch Hybrid because no HW Perf Stats for register files
+ wrapper->set_regfile_power(power_stats->get_regfile_reads(1),
+ power_stats->get_regfile_writes(1),
+ power_stats->get_non_regfile_operands(1));
+
+ // Instruction cache stats -- activity factor set to 0 for Accelwattch HW and Accelwattch Hybrid because no HW Perf Stats for instruction cache
+ wrapper->set_icache_power(power_stats->get_inst_c_hits(1) - power_stats->l1i_hits_kernel,
+ power_stats->get_inst_c_misses(1) - power_stats->l1i_misses_kernel);
+
+ // Constant Cache, shared memory, texture cache
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_CC_ACC]))
+ wrapper->set_ccache_power(power_stats->get_const_accessess(1) - power_stats->cc_accesses_kernel, 0); //assuming all HITS in constant cache for now
+ else
+ wrapper->set_ccache_power(std::stod(hw_data[HW_CC_ACC]), 0); //assuming all HITS in constant cache for now
+
+
+ // wrapper->set_tcache_power(power_stats->get_texture_c_hits(),
+ // power_stats->get_texture_c_misses());
+
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_SHRD_ACC]))
+ wrapper->set_shrd_mem_power(power_stats->get_shmem_access(1) - power_stats->shared_accesses_kernel);
+ else
+ wrapper->set_shrd_mem_power(std::stod(hw_data[HW_SHRD_ACC]));
+
+ wrapper->set_l1cache_power( l1_read_hits, l1_read_misses, l1_write_hits, l1_write_misses);
+
+ double l2_read_hits = std::stod(hw_data[HW_L2_RH]);
+ double l2_read_misses = std::stod(hw_data[HW_L2_RM]);
+ double l2_write_hits = std::stod(hw_data[HW_L2_WH]);
+ double l2_write_misses = std::stod(hw_data[HW_L2_WM]);
+
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_L2_RH]))
+ l2_read_hits = power_stats->get_l2_read_hits(1) - power_stats->l2r_hits_kernel;
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_L2_RM]))
+ l2_read_misses = power_stats->get_l2_read_misses(1) - power_stats->l2r_misses_kernel;
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_L2_WH]))
+ l2_write_hits = power_stats->get_l2_write_hits(1) - power_stats->l2w_hits_kernel;
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_L2_WM]))
+ l2_write_misses = power_stats->get_l2_write_misses(1) - power_stats->l2w_misses_kernel;
+
+ wrapper->set_l2cache_power(l2_read_hits, l2_read_misses, l2_write_hits, l2_write_misses);
+
+ float active_sms = (*power_stats->m_active_sms) / stat_sample_freq;
+ float num_cores = shdr_config->num_shader();
+ float num_idle_core = num_cores - active_sms;
+ wrapper->set_num_cores(num_cores);
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_NUM_SM_IDLE]))
+ wrapper->set_idle_core_power(num_idle_core);
+ else
+ wrapper->set_idle_core_power(std::stod(hw_data[HW_NUM_SM_IDLE]));
+
+ float pipeline_duty_cycle =
+ ((*power_stats->m_average_pipeline_duty_cycle / (stat_sample_freq)) <
+ 0.8)
+ ? ((*power_stats->m_average_pipeline_duty_cycle) / stat_sample_freq)
+ : 0.8;
+
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_PIPE_DUTY]))
+ wrapper->set_duty_cycle_power(pipeline_duty_cycle);
+ else
+ wrapper->set_duty_cycle_power(std::stod(hw_data[HW_PIPE_DUTY]));
+
+ // Memory Controller
+
+ double dram_reads = std::stod(hw_data[HW_DRAM_RD]);
+ double dram_writes = std::stod(hw_data[HW_DRAM_WR]);
+ double dram_pre = 0;
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_DRAM_RD]))
+ dram_reads = power_stats->get_dram_rd(1) - power_stats->dram_rd_kernel;
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_DRAM_WR]))
+ dram_writes = power_stats->get_dram_wr(1) - power_stats->dram_wr_kernel;
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_DRAM_RD]))
+ dram_pre = power_stats->get_dram_pre(1) - power_stats->dram_pre_kernel;
+
+
+ wrapper->set_mem_ctrl_power(dram_reads, dram_writes, dram_pre);
+
+ if(aggregate_power_stats){
+ power_stats->ialu_acc_execution += power_stats->get_ialu_accessess(1);
+ power_stats->imul24_acc_execution += power_stats->get_intmul24_accessess(1);
+ power_stats->imul32_acc_execution += power_stats->get_intmul32_accessess(1);
+ power_stats->imul_acc_execution += power_stats->get_intmul_accessess(1);
+ power_stats->idiv_acc_execution += power_stats->get_intdiv_accessess(1);
+ power_stats->dp_acc_execution += power_stats->get_dp_accessess(1);
+ power_stats->dpmul_acc_execution += power_stats->get_dpmul_accessess(1);
+ power_stats->dpdiv_acc_execution += power_stats->get_dpdiv_accessess(1);
+ power_stats->fp_acc_execution += power_stats->get_fp_accessess(1);
+ power_stats->fpmul_acc_execution += power_stats->get_fpmul_accessess(1);
+ power_stats->fpdiv_acc_execution += power_stats->get_fpdiv_accessess(1);
+ power_stats->sqrt_acc_execution += power_stats->get_sqrt_accessess(1);
+ power_stats->log_acc_execution += power_stats->get_log_accessess(1);
+ power_stats->sin_acc_execution += power_stats->get_sin_accessess(1);
+ power_stats->exp_acc_execution += power_stats->get_exp_accessess(1);
+ power_stats->tensor_acc_execution += power_stats->get_tensor_accessess(1);
+ power_stats->tex_acc_execution += power_stats->get_tex_accessess(1);
+ power_stats->tot_fpu_acc_execution += power_stats->get_tot_fpu_accessess(1);
+ power_stats->tot_sfu_acc_execution += power_stats->get_tot_sfu_accessess(1);
+ power_stats->tot_threads_acc_execution += power_stats->get_tot_threads_kernel(1);
+ power_stats->tot_warps_acc_execution += power_stats->get_tot_warps_kernel(1);
+
+ power_stats->sp_active_lanes_execution += (power_stats->get_sp_active_lanes() * shdr_config->num_shader() * shdr_config->gpgpu_num_sp_units);
+ power_stats->sfu_active_lanes_execution += (power_stats->get_sfu_active_lanes() * shdr_config->num_shader() * shdr_config->gpgpu_num_sp_units);
+
+ wrapper->set_int_accesses(power_stats->ialu_acc_execution,
+ power_stats->imul24_acc_execution,
+ power_stats->imul32_acc_execution,
+ power_stats->imul_acc_execution,
+ power_stats->idiv_acc_execution);
+
+ wrapper->set_dp_accesses(power_stats->dp_acc_execution,
+ power_stats->dpmul_acc_execution,
+ power_stats->dpdiv_acc_execution);
+
+ wrapper->set_fp_accesses(power_stats->fp_acc_execution,
+ power_stats->fpmul_acc_execution,
+ power_stats->fpdiv_acc_execution);
+
+ wrapper->set_trans_accesses(power_stats->sqrt_acc_execution,
+ power_stats->log_acc_execution,
+ power_stats->sin_acc_execution,
+ power_stats->exp_acc_execution);
+
+ wrapper->set_tensor_accesses(power_stats->tensor_acc_execution);
+
+ wrapper->set_tex_accesses(power_stats->tex_acc_execution);
+
+ wrapper->set_exec_unit_power(power_stats->ialu_acc_execution,
+ power_stats->tot_fpu_acc_execution,
+ power_stats->tot_sfu_acc_execution);
+
+ wrapper->set_avg_active_threads((double)((double)power_stats->tot_threads_acc_execution / (double)power_stats->tot_warps_acc_execution));
+
+ // Average active lanes for sp and sfu pipelines
+ float avg_sp_active_lanes =
+ (power_stats->sp_active_lanes_execution) / shdr_config->num_shader() / shdr_config->gpgpu_num_sp_units / stat_sample_freq;
+ float avg_sfu_active_lanes =
+ (power_stats->sfu_active_lanes_execution) / shdr_config->num_shader() / shdr_config->gpgpu_num_sp_units / stat_sample_freq;
+ if(avg_sp_active_lanes >32.0 )
+ avg_sp_active_lanes = 32.0;
+ if(avg_sfu_active_lanes >32.0 )
+ avg_sfu_active_lanes = 32.0;
+ assert(avg_sp_active_lanes <= 32);
+ assert(avg_sfu_active_lanes <= 32);
+ wrapper->set_active_lanes_power(avg_sp_active_lanes, avg_sfu_active_lanes);
+ }
+ else{
+ wrapper->set_int_accesses(power_stats->get_ialu_accessess(1),
+ power_stats->get_intmul24_accessess(1),
+ power_stats->get_intmul32_accessess(1),
+ power_stats->get_intmul_accessess(1),
+ power_stats->get_intdiv_accessess(1));
+
+ wrapper->set_dp_accesses(power_stats->get_dp_accessess(1),
+ power_stats->get_dpmul_accessess(1),
+ power_stats->get_dpdiv_accessess(1));
+
+ wrapper->set_fp_accesses(power_stats->get_fp_accessess(1),
+ power_stats->get_fpmul_accessess(1),
+ power_stats->get_fpdiv_accessess(1));
+
+ wrapper->set_trans_accesses(power_stats->get_sqrt_accessess(1),
+ power_stats->get_log_accessess(1),
+ power_stats->get_sin_accessess(1),
+ power_stats->get_exp_accessess(1));
+
+ wrapper->set_tensor_accesses(power_stats->get_tensor_accessess(1));
+
+ wrapper->set_tex_accesses(power_stats->get_tex_accessess(1));
+
+ wrapper->set_exec_unit_power(power_stats->get_tot_fpu_accessess(1),
+ power_stats->get_ialu_accessess(1),
+ power_stats->get_tot_sfu_accessess(1));
+
+ wrapper->set_avg_active_threads(power_stats->get_active_threads(1));
+
+ // Average active lanes for sp and sfu pipelines
+ float avg_sp_active_lanes =
+ (power_stats->get_sp_active_lanes()) / stat_sample_freq;
+ float avg_sfu_active_lanes =
+ (power_stats->get_sfu_active_lanes()) / stat_sample_freq;
+ if(avg_sp_active_lanes >32.0 )
+ avg_sp_active_lanes = 32.0;
+ if(avg_sfu_active_lanes >32.0 )
+ avg_sfu_active_lanes = 32.0;
+ assert(avg_sp_active_lanes <= 32);
+ assert(avg_sfu_active_lanes <= 32);
+ wrapper->set_active_lanes_power(avg_sp_active_lanes, avg_sfu_active_lanes);
+ }
+
+
+ double n_icnt_simt_to_mem =
+ (double)
+ (power_stats->get_icnt_simt_to_mem(1) - power_stats->noc_tr_kernel); // # flits from SIMT clusters
+ // to memory partitions
+ double n_icnt_mem_to_simt =
+ (double)
+ (power_stats->get_icnt_mem_to_simt(1)- power_stats->noc_rc_kernel); // # flits from memory
+ // partitions to SIMT clusters
+ if((power_simulation_mode == 2) && (accelwattch_hybrid_configuration[HW_NOC]))
+ wrapper->set_NoC_power(n_icnt_mem_to_simt + n_icnt_simt_to_mem); // Number of flits traversing the interconnect from Accel-Sim
+ else
+ wrapper->set_NoC_power(std::stod(hw_data[HW_NOC])); // Number of flits traversing the interconnect from HW
+
+ wrapper->compute();
+
+ wrapper->update_components_power();
+
+ wrapper->power_metrics_calculations();
+
+ wrapper->dump();
+ power_stats->l1r_hits_kernel = power_stats->get_l1d_read_hits(1);
+ power_stats->l1r_misses_kernel = power_stats->get_l1d_read_misses(1);
+ power_stats->l1w_hits_kernel = power_stats->get_l1d_write_hits(1);
+ power_stats->l1w_misses_kernel = power_stats->get_l1d_write_misses(1);
+ power_stats->shared_accesses_kernel = power_stats->get_const_accessess(1);
+ power_stats->cc_accesses_kernel = power_stats->get_shmem_access(1);
+ power_stats->dram_rd_kernel = power_stats->get_dram_rd(1);
+ power_stats->dram_wr_kernel = power_stats->get_dram_wr(1);
+ power_stats->dram_pre_kernel = power_stats->get_dram_pre(1);
+ power_stats->l1i_hits_kernel = power_stats->get_inst_c_hits(1);
+ power_stats->l1i_misses_kernel = power_stats->get_inst_c_misses(1);
+ power_stats->l2r_hits_kernel = power_stats->get_l2_read_hits(1);
+ power_stats->l2r_misses_kernel = power_stats->get_l2_read_misses(1);
+ power_stats->l2w_hits_kernel = power_stats->get_l2_write_hits(1);
+ power_stats->l2w_misses_kernel = power_stats->get_l2_write_misses(1);
+ power_stats->noc_tr_kernel = power_stats->get_icnt_simt_to_mem(1);
+ power_stats->noc_rc_kernel = power_stats->get_icnt_mem_to_simt(1);
+
+
+ power_stats->clear();
+} \ No newline at end of file
diff --git a/src/gpgpu-sim/power_interface.h b/src/gpgpu-sim/power_interface.h
index 2bfd4d5..1a48894 100644
--- a/src/gpgpu-sim/power_interface.h
+++ b/src/gpgpu-sim/power_interface.h
@@ -1,18 +1,19 @@
-// Copyright (c) 2009-2011, Tor M. Aamodt, Ahmed El-Shafiey, Tayler Hetherington
-// The University of British Columbia
+// Copyright (c) 2009-2021, Tor M. Aamodt, Ahmed El-Shafiey, Tayler Hetherington, Vijay Kandiah, Nikos Hardavellas
+// The University of British Columbia, Northwestern University
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution. Neither the name of
-// The University of British Columbia nor the names of its contributors may be
-// used to endorse or promote products derived from this software without
-// specific prior written permission.
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer;
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution;
+// 3. Neither the names of The University of British Columbia, Northwestern
+// University nor the names of their contributors may be used to
+// endorse or promote products derived from this software without specific
+// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -43,7 +44,19 @@ void mcpat_cycle(const gpgpu_sim_config &config,
class gpgpu_sim_wrapper *wrapper,
class power_stat_t *power_stats, unsigned stat_sample_freq,
unsigned tot_cycle, unsigned cycle, unsigned tot_inst,
- unsigned inst);
+ unsigned inst, bool dvfs_enabled);
+
+void calculate_hw_mcpat(const gpgpu_sim_config &config,
+ const shader_core_config *shdr_config,
+ class gpgpu_sim_wrapper *wrapper,
+ class power_stat_t *power_stats, unsigned stat_sample_freq,
+ unsigned tot_cycle, unsigned cycle, unsigned tot_inst,
+ unsigned inst, int power_simulation_mode, bool dvfs_enabled,
+ char* hwpowerfile, char* benchname, std::string executed_kernelname,
+ const bool *accelwattch_hybrid_configuration, bool aggregate_power_stats);
+
+bool parse_hw_file(char* hwpowerfile, bool find_target_kernel, vector<string> &hw_data, char* benchname, std::string executed_kernelname);
+
void mcpat_reset_perf_count(class gpgpu_sim_wrapper *wrapper);
#endif /* POWER_INTERFACE_H_ */
diff --git a/src/gpgpu-sim/power_stat.cc b/src/gpgpu-sim/power_stat.cc
index 7b60ddf..fd7a775 100644
--- a/src/gpgpu-sim/power_stat.cc
+++ b/src/gpgpu-sim/power_stat.cc
@@ -1,18 +1,19 @@
-// Copyright (c) 2009-2011, Tor M. Aamodt, Ahmed El-Shafiey, Tayler Hetherington
-// The University of British Columbia
+// Copyright (c) 2009-2021, Tor M. Aamodt, Ahmed El-Shafiey, Tayler Hetherington, Vijay Kandiah, Nikos Hardavellas
+// The University of British Columbia, Northwestern University
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution. Neither the name of
-// The University of British Columbia nor the names of its contributors may be
-// used to endorse or promote products derived from this software without
-// specific prior written permission.
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer;
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution;
+// 3. Neither the names of The University of British Columbia, Northwestern
+// University nor the names of their contributors may be used to
+// endorse or promote products derived from this software without specific
+// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -54,10 +55,64 @@ power_mem_stat_t::power_mem_stat_t(const memory_config *mem_config,
init();
}
+void power_stat_t::clear(){
+ for(unsigned i=0; i< NUM_STAT_IDX; ++i){
+ pwr_mem_stat->core_cache_stats[i].clear();
+ pwr_mem_stat->l2_cache_stats[i].clear();
+ for(unsigned j=0; j<m_config->num_shader(); ++j){
+ pwr_core_stat->m_pipeline_duty_cycle[i][j]=0;
+ pwr_core_stat->m_num_decoded_insn[i][j]=0;
+ pwr_core_stat->m_num_FPdecoded_insn[i][j]=0;
+ pwr_core_stat->m_num_INTdecoded_insn[i][j]=0;
+ pwr_core_stat->m_num_storequeued_insn[i][j]=0;
+ pwr_core_stat->m_num_loadqueued_insn[i][j]=0;
+ pwr_core_stat->m_num_tex_inst[i][j]=0;
+ pwr_core_stat->m_num_ialu_acesses[i][j]=0;
+ pwr_core_stat->m_num_fp_acesses[i][j]=0;
+ pwr_core_stat->m_num_imul_acesses[i][j]=0;
+ pwr_core_stat->m_num_imul24_acesses[i][j]=0;
+ pwr_core_stat->m_num_imul32_acesses[i][j]=0;
+ pwr_core_stat->m_num_fpmul_acesses[i][j]=0;
+ pwr_core_stat->m_num_idiv_acesses[i][j]=0;
+ pwr_core_stat->m_num_fpdiv_acesses[i][j]=0;
+ pwr_core_stat->m_num_dp_acesses[i][j]=0;
+ pwr_core_stat->m_num_dpmul_acesses[i][j]=0;
+ pwr_core_stat->m_num_dpdiv_acesses[i][j]=0;
+ pwr_core_stat->m_num_tensor_core_acesses[i][j]=0;
+ pwr_core_stat->m_num_const_acesses[i][j]=0;
+ pwr_core_stat->m_num_tex_acesses[i][j]=0;
+ pwr_core_stat->m_num_sp_acesses[i][j]=0;
+ pwr_core_stat->m_num_sfu_acesses[i][j]=0;
+ pwr_core_stat->m_num_sqrt_acesses[i][j]=0;
+ pwr_core_stat->m_num_log_acesses[i][j]=0;
+ pwr_core_stat->m_num_sin_acesses[i][j]=0;
+ pwr_core_stat->m_num_exp_acesses[i][j]=0;
+ pwr_core_stat->m_num_mem_acesses[i][j]=0;
+ pwr_core_stat->m_num_sp_committed[i][j]=0;
+ pwr_core_stat->m_num_sfu_committed[i][j]=0;
+ pwr_core_stat->m_num_mem_committed[i][j]=0;
+ pwr_core_stat->m_read_regfile_acesses[i][j]=0;
+ pwr_core_stat->m_write_regfile_acesses[i][j]=0;
+ pwr_core_stat->m_non_rf_operands[i][j]=0;
+ pwr_core_stat->m_active_sp_lanes[i][j]=0;
+ pwr_core_stat->m_active_sfu_lanes[i][j]=0;
+ pwr_core_stat->m_active_exu_threads[i][j]=0;
+ pwr_core_stat->m_active_exu_warps[i][j]=0;
+ }
+ for (unsigned j = 0; j < m_mem_config->m_n_mem; ++j) {
+ pwr_mem_stat->n_rd[i][j]=0;
+ pwr_mem_stat->n_wr[i][j]=0;
+ pwr_mem_stat->n_pre[i][j]=0;
+ }
+ }
+}
+
+
+
void power_mem_stat_t::init() {
- shmem_read_access[CURRENT_STAT_IDX] =
+ shmem_access[CURRENT_STAT_IDX] =
m_core_stats->gpgpu_n_shmem_bank_access; // Shared memory access
- shmem_read_access[PREV_STAT_IDX] =
+ shmem_access[PREV_STAT_IDX] =
(unsigned *)calloc(m_core_config->num_shader(), sizeof(unsigned));
for (unsigned i = 0; i < NUM_STAT_IDX; ++i) {
@@ -71,6 +126,7 @@ void power_mem_stat_t::init() {
n_pre[i] = (unsigned *)calloc(m_config->m_n_mem, sizeof(unsigned));
n_rd[i] = (unsigned *)calloc(m_config->m_n_mem, sizeof(unsigned));
n_wr[i] = (unsigned *)calloc(m_config->m_n_mem, sizeof(unsigned));
+ n_wr_WB[i] = (unsigned *)calloc(m_config->m_n_mem, sizeof(unsigned));
n_req[i] = (unsigned *)calloc(m_config->m_n_mem, sizeof(unsigned));
// Interconnect stats
@@ -86,8 +142,8 @@ void power_mem_stat_t::save_stats() {
l2_cache_stats[PREV_STAT_IDX] = l2_cache_stats[CURRENT_STAT_IDX];
for (unsigned i = 0; i < m_core_config->num_shader(); ++i) {
- shmem_read_access[PREV_STAT_IDX][i] =
- shmem_read_access[CURRENT_STAT_IDX][i]; // Shared memory access
+ shmem_access[PREV_STAT_IDX][i] =
+ shmem_access[CURRENT_STAT_IDX][i]; // Shared memory access
}
for (unsigned i = 0; i < m_config->m_n_mem; ++i) {
@@ -98,6 +154,7 @@ void power_mem_stat_t::save_stats() {
n_pre[PREV_STAT_IDX][i] = n_pre[CURRENT_STAT_IDX][i];
n_rd[PREV_STAT_IDX][i] = n_rd[CURRENT_STAT_IDX][i];
n_wr[PREV_STAT_IDX][i] = n_wr[CURRENT_STAT_IDX][i];
+ n_wr_WB[PREV_STAT_IDX][i] = n_wr_WB[CURRENT_STAT_IDX][i];
n_req[PREV_STAT_IDX][i] = n_req[CURRENT_STAT_IDX][i];
}
@@ -117,7 +174,7 @@ void power_mem_stat_t::print(FILE *fout) const {
unsigned total_mem_writes = 0;
for (unsigned i = 0; i < m_config->m_n_mem; ++i) {
total_mem_reads += n_rd[CURRENT_STAT_IDX][i];
- total_mem_writes += n_wr[CURRENT_STAT_IDX][i];
+ total_mem_writes += n_wr[CURRENT_STAT_IDX][i] + n_wr_WB[CURRENT_STAT_IDX][i];
}
fprintf(fout, "Total memory controller accesses: %u\n",
total_mem_reads + total_mem_writes);
@@ -147,198 +204,165 @@ void power_core_stat_t::print(FILE *fout) {
// per core statistics
fprintf(fout, "Power Metrics: \n");
for (unsigned i = 0; i < m_config->num_shader(); i++) {
- fprintf(fout, "core %u:\n", i);
- fprintf(fout, "\tpipeline duty cycle =%f\n",
- m_pipeline_duty_cycle[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal Deocded Instructions=%u\n",
- m_num_decoded_insn[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal FP Deocded Instructions=%u\n",
- m_num_FPdecoded_insn[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal INT Deocded Instructions=%u\n",
- m_num_INTdecoded_insn[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal LOAD Queued Instructions=%u\n",
- m_num_loadqueued_insn[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal STORE Queued Instructions=%u\n",
- m_num_storequeued_insn[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal IALU Acesses=%u\n",
- m_num_ialu_acesses[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal FP Acesses=%u\n",
- m_num_fp_acesses[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal IMUL Acesses=%u\n",
- m_num_imul_acesses[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal IMUL24 Acesses=%u\n",
- m_num_imul24_acesses[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal IMUL32 Acesses=%u\n",
- m_num_imul32_acesses[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal IDIV Acesses=%u\n",
- m_num_idiv_acesses[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal FPMUL Acesses=%u\n",
- m_num_fpmul_acesses[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal SFU Acesses=%u\n",
- m_num_trans_acesses[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal FPDIV Acesses=%u\n",
- m_num_fpdiv_acesses[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal SFU Acesses=%u\n",
- m_num_sfu_acesses[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal SP Acesses=%u\n",
- m_num_sp_acesses[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal MEM Acesses=%u\n",
- m_num_mem_acesses[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal SFU Commissions=%u\n",
- m_num_sfu_committed[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal SP Commissions=%u\n",
- m_num_sp_committed[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal MEM Commissions=%u\n",
- m_num_mem_committed[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal REG Reads=%u\n",
- m_read_regfile_acesses[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal REG Writes=%u\n",
- m_write_regfile_acesses[CURRENT_STAT_IDX][i]);
- fprintf(fout, "\tTotal NON REG=%u\n",
- m_non_rf_operands[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"core %u:\n",i);
+ fprintf(fout,"\tpipeline duty cycle =%f\n",m_pipeline_duty_cycle[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal Deocded Instructions=%u\n",m_num_decoded_insn[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal FP Deocded Instructions=%u\n",m_num_FPdecoded_insn[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal INT Deocded Instructions=%u\n",m_num_INTdecoded_insn[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal LOAD Queued Instructions=%u\n",m_num_loadqueued_insn[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal STORE Queued Instructions=%u\n",m_num_storequeued_insn[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal IALU Acesses=%f\n",m_num_ialu_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal FP Acesses=%f\n",m_num_fp_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal DP Acesses=%f\n",m_num_dp_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal IMUL Acesses=%f\n",m_num_imul_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal IMUL24 Acesses=%f\n",m_num_imul24_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal IMUL32 Acesses=%f\n",m_num_imul32_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal IDIV Acesses=%f\n",m_num_idiv_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal FPMUL Acesses=%f\n",m_num_fpmul_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal DPMUL Acesses=%f\n",m_num_dpmul_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal SQRT Acesses=%f\n",m_num_sqrt_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal LOG Acesses=%f\n",m_num_log_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal SIN Acesses=%f\n",m_num_sin_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal EXP Acesses=%f\n",m_num_exp_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal FPDIV Acesses=%f\n",m_num_fpdiv_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal DPDIV Acesses=%f\n",m_num_dpdiv_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal TENSOR Acesses=%f\n",m_num_tensor_core_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal CONST Acesses=%f\n",m_num_const_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal TEX Acesses=%f\n",m_num_tex_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal SFU Acesses=%f\n",m_num_sfu_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal SP Acesses=%f\n",m_num_sp_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal MEM Acesses=%f\n",m_num_mem_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal SFU Commissions=%u\n",m_num_sfu_committed[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal SP Commissions=%u\n",m_num_sp_committed[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal MEM Commissions=%u\n",m_num_mem_committed[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal REG Reads=%u\n",m_read_regfile_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal REG Writes=%u\n",m_write_regfile_acesses[CURRENT_STAT_IDX][i]);
+ fprintf(fout,"\tTotal NON REG=%u\n",m_non_rf_operands[CURRENT_STAT_IDX][i]);
}
}
void power_core_stat_t::init() {
- m_pipeline_duty_cycle[CURRENT_STAT_IDX] = m_core_stats->m_pipeline_duty_cycle;
- m_num_decoded_insn[CURRENT_STAT_IDX] = m_core_stats->m_num_decoded_insn;
- m_num_FPdecoded_insn[CURRENT_STAT_IDX] = m_core_stats->m_num_FPdecoded_insn;
- m_num_INTdecoded_insn[CURRENT_STAT_IDX] = m_core_stats->m_num_INTdecoded_insn;
- m_num_storequeued_insn[CURRENT_STAT_IDX] =
- m_core_stats->m_num_storequeued_insn;
- m_num_loadqueued_insn[CURRENT_STAT_IDX] = m_core_stats->m_num_loadqueued_insn;
- m_num_ialu_acesses[CURRENT_STAT_IDX] = m_core_stats->m_num_ialu_acesses;
- m_num_fp_acesses[CURRENT_STAT_IDX] = m_core_stats->m_num_fp_acesses;
- m_num_imul_acesses[CURRENT_STAT_IDX] = m_core_stats->m_num_imul_acesses;
- m_num_imul24_acesses[CURRENT_STAT_IDX] = m_core_stats->m_num_imul24_acesses;
- m_num_imul32_acesses[CURRENT_STAT_IDX] = m_core_stats->m_num_imul32_acesses;
- m_num_fpmul_acesses[CURRENT_STAT_IDX] = m_core_stats->m_num_fpmul_acesses;
- m_num_idiv_acesses[CURRENT_STAT_IDX] = m_core_stats->m_num_idiv_acesses;
- m_num_fpdiv_acesses[CURRENT_STAT_IDX] = m_core_stats->m_num_fpdiv_acesses;
- m_num_sp_acesses[CURRENT_STAT_IDX] = m_core_stats->m_num_sp_acesses;
- m_num_sfu_acesses[CURRENT_STAT_IDX] = m_core_stats->m_num_sfu_acesses;
- m_num_trans_acesses[CURRENT_STAT_IDX] = m_core_stats->m_num_trans_acesses;
- m_num_mem_acesses[CURRENT_STAT_IDX] = m_core_stats->m_num_mem_acesses;
- m_num_sp_committed[CURRENT_STAT_IDX] = m_core_stats->m_num_sp_committed;
- m_num_sfu_committed[CURRENT_STAT_IDX] = m_core_stats->m_num_sfu_committed;
- m_num_mem_committed[CURRENT_STAT_IDX] = m_core_stats->m_num_mem_committed;
- m_read_regfile_acesses[CURRENT_STAT_IDX] =
- m_core_stats->m_read_regfile_acesses;
- m_write_regfile_acesses[CURRENT_STAT_IDX] =
- m_core_stats->m_write_regfile_acesses;
- m_non_rf_operands[CURRENT_STAT_IDX] = m_core_stats->m_non_rf_operands;
- m_active_sp_lanes[CURRENT_STAT_IDX] = m_core_stats->m_active_sp_lanes;
- m_active_sfu_lanes[CURRENT_STAT_IDX] = m_core_stats->m_active_sfu_lanes;
- m_num_tex_inst[CURRENT_STAT_IDX] = m_core_stats->m_num_tex_inst;
+ m_pipeline_duty_cycle[CURRENT_STAT_IDX]=m_core_stats->m_pipeline_duty_cycle;
+ m_num_decoded_insn[CURRENT_STAT_IDX]=m_core_stats->m_num_decoded_insn;
+ m_num_FPdecoded_insn[CURRENT_STAT_IDX]=m_core_stats->m_num_FPdecoded_insn;
+ m_num_INTdecoded_insn[CURRENT_STAT_IDX]=m_core_stats->m_num_INTdecoded_insn;
+ m_num_storequeued_insn[CURRENT_STAT_IDX]=m_core_stats->m_num_storequeued_insn;
+ m_num_loadqueued_insn[CURRENT_STAT_IDX]=m_core_stats->m_num_loadqueued_insn;
+ m_num_ialu_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_ialu_acesses;
+ m_num_fp_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_fp_acesses;
+ m_num_imul_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_imul_acesses;
+ m_num_imul24_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_imul24_acesses;
+ m_num_imul32_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_imul32_acesses;
+ m_num_fpmul_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_fpmul_acesses;
+ m_num_idiv_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_idiv_acesses;
+ m_num_fpdiv_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_fpdiv_acesses;
+ m_num_dp_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_dp_acesses;
+ m_num_dpmul_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_dpmul_acesses;
+ m_num_dpdiv_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_dpdiv_acesses;
+ m_num_sp_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_sp_acesses;
+ m_num_sfu_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_sfu_acesses;
+ m_num_sqrt_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_sqrt_acesses;
+ m_num_log_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_log_acesses;
+ m_num_sin_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_sin_acesses;
+ m_num_exp_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_exp_acesses;
+ m_num_tensor_core_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_tensor_core_acesses;
+ m_num_const_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_const_acesses;
+ m_num_tex_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_tex_acesses;
+ m_num_mem_acesses[CURRENT_STAT_IDX]=m_core_stats->m_num_mem_acesses;
+ m_num_sp_committed[CURRENT_STAT_IDX]=m_core_stats->m_num_sp_committed;
+ m_num_sfu_committed[CURRENT_STAT_IDX]=m_core_stats->m_num_sfu_committed;
+ m_num_mem_committed[CURRENT_STAT_IDX]=m_core_stats->m_num_mem_committed;
+ m_read_regfile_acesses[CURRENT_STAT_IDX]=m_core_stats->m_read_regfile_acesses;
+ m_write_regfile_acesses[CURRENT_STAT_IDX]=m_core_stats->m_write_regfile_acesses;
+ m_non_rf_operands[CURRENT_STAT_IDX]=m_core_stats->m_non_rf_operands;
+ m_active_sp_lanes[CURRENT_STAT_IDX]=m_core_stats->m_active_sp_lanes;
+ m_active_sfu_lanes[CURRENT_STAT_IDX]=m_core_stats->m_active_sfu_lanes;
+ m_active_exu_threads[CURRENT_STAT_IDX]=m_core_stats->m_active_exu_threads;
+ m_active_exu_warps[CURRENT_STAT_IDX]=m_core_stats->m_active_exu_warps;
+ m_num_tex_inst[CURRENT_STAT_IDX]=m_core_stats->m_num_tex_inst;
+
+ m_pipeline_duty_cycle[PREV_STAT_IDX]=(float*)calloc(m_config->num_shader(),sizeof(float));
+ m_num_decoded_insn[PREV_STAT_IDX]=(unsigned *)calloc(m_config->num_shader(),sizeof(unsigned));
+ m_num_FPdecoded_insn[PREV_STAT_IDX]=(unsigned *)calloc(m_config->num_shader(),sizeof(unsigned));
+ m_num_INTdecoded_insn[PREV_STAT_IDX]=(unsigned *)calloc(m_config->num_shader(),sizeof(unsigned));
+ m_num_storequeued_insn[PREV_STAT_IDX]=(unsigned *)calloc(m_config->num_shader(),sizeof(unsigned));
+ m_num_loadqueued_insn[PREV_STAT_IDX]=(unsigned *)calloc(m_config->num_shader(),sizeof(unsigned));
+ m_num_tex_inst[PREV_STAT_IDX]=(unsigned *)calloc(m_config->num_shader(),sizeof(unsigned));
+
+ m_num_ialu_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_fp_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_imul_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_imul24_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_imul32_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_fpmul_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_idiv_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_fpdiv_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_dp_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_dpmul_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_dpdiv_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_tensor_core_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_const_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_tex_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_sp_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_sfu_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_sqrt_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_log_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_sin_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_exp_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_mem_acesses[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_num_sp_committed[PREV_STAT_IDX]=(unsigned *)calloc(m_config->num_shader(),sizeof(unsigned));
+ m_num_sfu_committed[PREV_STAT_IDX]=(unsigned *)calloc(m_config->num_shader(),sizeof(unsigned));
+ m_num_mem_committed[PREV_STAT_IDX]=(unsigned *)calloc(m_config->num_shader(),sizeof(unsigned));
+ m_read_regfile_acesses[PREV_STAT_IDX]=(unsigned *)calloc(m_config->num_shader(),sizeof(unsigned));
+ m_write_regfile_acesses[PREV_STAT_IDX]=(unsigned *)calloc(m_config->num_shader(),sizeof(unsigned));
+ m_non_rf_operands[PREV_STAT_IDX]=(unsigned *)calloc(m_config->num_shader(),sizeof(unsigned));
+ m_active_sp_lanes[PREV_STAT_IDX]=(unsigned *)calloc(m_config->num_shader(),sizeof(unsigned));
+ m_active_sfu_lanes[PREV_STAT_IDX]=(unsigned *)calloc(m_config->num_shader(),sizeof(unsigned));
+ m_active_exu_threads[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+ m_active_exu_warps[PREV_STAT_IDX]=(double *)calloc(m_config->num_shader(),sizeof(double));
+
- m_pipeline_duty_cycle[PREV_STAT_IDX] =
- (float *)calloc(m_config->num_shader(), sizeof(float));
- m_num_decoded_insn[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_FPdecoded_insn[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_INTdecoded_insn[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_storequeued_insn[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_loadqueued_insn[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_ialu_acesses[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_fp_acesses[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_tex_inst[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_imul_acesses[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_imul24_acesses[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_imul32_acesses[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_fpmul_acesses[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_idiv_acesses[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_fpdiv_acesses[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_sp_acesses[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_sfu_acesses[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_trans_acesses[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_mem_acesses[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_sp_committed[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_sfu_committed[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_num_mem_committed[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_read_regfile_acesses[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_write_regfile_acesses[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_non_rf_operands[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_active_sp_lanes[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
- m_active_sfu_lanes[PREV_STAT_IDX] =
- (unsigned *)calloc(m_config->num_shader(), sizeof(unsigned));
}
void power_core_stat_t::save_stats() {
for (unsigned i = 0; i < m_config->num_shader(); ++i) {
- m_pipeline_duty_cycle[PREV_STAT_IDX][i] =
- m_pipeline_duty_cycle[CURRENT_STAT_IDX][i];
- m_num_decoded_insn[PREV_STAT_IDX][i] =
- m_num_decoded_insn[CURRENT_STAT_IDX][i];
- m_num_FPdecoded_insn[PREV_STAT_IDX][i] =
- m_num_FPdecoded_insn[CURRENT_STAT_IDX][i];
- m_num_INTdecoded_insn[PREV_STAT_IDX][i] =
- m_num_INTdecoded_insn[CURRENT_STAT_IDX][i];
- m_num_storequeued_insn[PREV_STAT_IDX][i] =
- m_num_storequeued_insn[CURRENT_STAT_IDX][i];
- m_num_loadqueued_insn[PREV_STAT_IDX][i] =
- m_num_loadqueued_insn[CURRENT_STAT_IDX][i];
- m_num_ialu_acesses[PREV_STAT_IDX][i] =
- m_num_ialu_acesses[CURRENT_STAT_IDX][i];
- m_num_fp_acesses[PREV_STAT_IDX][i] = m_num_fp_acesses[CURRENT_STAT_IDX][i];
- m_num_tex_inst[PREV_STAT_IDX][i] = m_num_tex_inst[CURRENT_STAT_IDX][i];
- m_num_imul_acesses[PREV_STAT_IDX][i] =
- m_num_imul_acesses[CURRENT_STAT_IDX][i];
- m_num_imul24_acesses[PREV_STAT_IDX][i] =
- m_num_imul24_acesses[CURRENT_STAT_IDX][i];
- m_num_imul32_acesses[PREV_STAT_IDX][i] =
- m_num_imul32_acesses[CURRENT_STAT_IDX][i];
- m_num_fpmul_acesses[PREV_STAT_IDX][i] =
- m_num_fpmul_acesses[CURRENT_STAT_IDX][i];
- m_num_idiv_acesses[PREV_STAT_IDX][i] =
- m_num_idiv_acesses[CURRENT_STAT_IDX][i];
- m_num_fpdiv_acesses[PREV_STAT_IDX][i] =
- m_num_fpdiv_acesses[CURRENT_STAT_IDX][i];
- m_num_sp_acesses[PREV_STAT_IDX][i] = m_num_sp_acesses[CURRENT_STAT_IDX][i];
- m_num_sfu_acesses[PREV_STAT_IDX][i] =
- m_num_sfu_acesses[CURRENT_STAT_IDX][i];
- m_num_trans_acesses[PREV_STAT_IDX][i] =
- m_num_trans_acesses[CURRENT_STAT_IDX][i];
- m_num_mem_acesses[PREV_STAT_IDX][i] =
- m_num_mem_acesses[CURRENT_STAT_IDX][i];
- m_num_sp_committed[PREV_STAT_IDX][i] =
- m_num_sp_committed[CURRENT_STAT_IDX][i];
- m_num_sfu_committed[PREV_STAT_IDX][i] =
- m_num_sfu_committed[CURRENT_STAT_IDX][i];
- m_num_mem_committed[PREV_STAT_IDX][i] =
- m_num_mem_committed[CURRENT_STAT_IDX][i];
- m_read_regfile_acesses[PREV_STAT_IDX][i] =
- m_read_regfile_acesses[CURRENT_STAT_IDX][i];
- m_write_regfile_acesses[PREV_STAT_IDX][i] =
- m_write_regfile_acesses[CURRENT_STAT_IDX][i];
- m_non_rf_operands[PREV_STAT_IDX][i] =
- m_non_rf_operands[CURRENT_STAT_IDX][i];
- m_active_sp_lanes[PREV_STAT_IDX][i] =
- m_active_sp_lanes[CURRENT_STAT_IDX][i];
- m_active_sfu_lanes[PREV_STAT_IDX][i] =
- m_active_sfu_lanes[CURRENT_STAT_IDX][i];
+ m_pipeline_duty_cycle[PREV_STAT_IDX][i]=m_pipeline_duty_cycle[CURRENT_STAT_IDX][i];
+ m_num_decoded_insn[PREV_STAT_IDX][i]= m_num_decoded_insn[CURRENT_STAT_IDX][i];
+ m_num_FPdecoded_insn[PREV_STAT_IDX][i]=m_num_FPdecoded_insn[CURRENT_STAT_IDX][i];
+ m_num_INTdecoded_insn[PREV_STAT_IDX][i]=m_num_INTdecoded_insn[CURRENT_STAT_IDX][i];
+ m_num_storequeued_insn[PREV_STAT_IDX][i]=m_num_storequeued_insn[CURRENT_STAT_IDX][i];
+ m_num_loadqueued_insn[PREV_STAT_IDX][i]=m_num_loadqueued_insn[CURRENT_STAT_IDX][i];
+ m_num_ialu_acesses[PREV_STAT_IDX][i]=m_num_ialu_acesses[CURRENT_STAT_IDX][i];
+ m_num_fp_acesses[PREV_STAT_IDX][i]=m_num_fp_acesses[CURRENT_STAT_IDX][i];
+ m_num_tex_inst[PREV_STAT_IDX][i]=m_num_tex_inst[CURRENT_STAT_IDX][i];
+ m_num_imul_acesses[PREV_STAT_IDX][i]=m_num_imul_acesses[CURRENT_STAT_IDX][i];
+ m_num_imul24_acesses[PREV_STAT_IDX][i]=m_num_imul24_acesses[CURRENT_STAT_IDX][i];
+ m_num_imul32_acesses[PREV_STAT_IDX][i]=m_num_imul32_acesses[CURRENT_STAT_IDX][i];
+ m_num_fpmul_acesses[PREV_STAT_IDX][i]=m_num_fpmul_acesses[CURRENT_STAT_IDX][i];
+ m_num_idiv_acesses[PREV_STAT_IDX][i]=m_num_idiv_acesses[CURRENT_STAT_IDX][i];
+ m_num_fpdiv_acesses[PREV_STAT_IDX][i]=m_num_fpdiv_acesses[CURRENT_STAT_IDX][i];
+ m_num_sp_acesses[PREV_STAT_IDX][i]=m_num_sp_acesses[CURRENT_STAT_IDX][i];
+ m_num_sfu_acesses[PREV_STAT_IDX][i]=m_num_sfu_acesses[CURRENT_STAT_IDX][i];
+ m_num_sqrt_acesses[PREV_STAT_IDX][i]=m_num_sqrt_acesses[CURRENT_STAT_IDX][i];
+ m_num_log_acesses[PREV_STAT_IDX][i]=m_num_log_acesses[CURRENT_STAT_IDX][i];
+ m_num_sin_acesses[PREV_STAT_IDX][i]=m_num_sin_acesses[CURRENT_STAT_IDX][i];
+ m_num_exp_acesses[PREV_STAT_IDX][i]=m_num_exp_acesses[CURRENT_STAT_IDX][i];
+ m_num_dp_acesses[PREV_STAT_IDX][i]=m_num_dp_acesses[CURRENT_STAT_IDX][i];
+ m_num_dpmul_acesses[PREV_STAT_IDX][i]=m_num_dpmul_acesses[CURRENT_STAT_IDX][i];
+ m_num_dpdiv_acesses[PREV_STAT_IDX][i]=m_num_dpdiv_acesses[CURRENT_STAT_IDX][i];
+ m_num_tensor_core_acesses[PREV_STAT_IDX][i]=m_num_tensor_core_acesses[CURRENT_STAT_IDX][i];
+ m_num_const_acesses[PREV_STAT_IDX][i]=m_num_const_acesses[CURRENT_STAT_IDX][i];
+ m_num_tex_acesses[PREV_STAT_IDX][i]=m_num_tex_acesses[CURRENT_STAT_IDX][i];
+ m_num_mem_acesses[PREV_STAT_IDX][i]=m_num_mem_acesses[CURRENT_STAT_IDX][i];
+ m_num_sp_committed[PREV_STAT_IDX][i]=m_num_sp_committed[CURRENT_STAT_IDX][i];
+ m_num_sfu_committed[PREV_STAT_IDX][i]=m_num_sfu_committed[CURRENT_STAT_IDX][i];
+ m_num_mem_committed[PREV_STAT_IDX][i]=m_num_mem_committed[CURRENT_STAT_IDX][i];
+ m_read_regfile_acesses[PREV_STAT_IDX][i]=m_read_regfile_acesses[CURRENT_STAT_IDX][i];
+ m_write_regfile_acesses[PREV_STAT_IDX][i]=m_write_regfile_acesses[CURRENT_STAT_IDX][i];
+ m_non_rf_operands[PREV_STAT_IDX][i]=m_non_rf_operands[CURRENT_STAT_IDX][i];
+ m_active_sp_lanes[PREV_STAT_IDX][i]=m_active_sp_lanes[CURRENT_STAT_IDX][i];
+ m_active_sfu_lanes[PREV_STAT_IDX][i]=m_active_sfu_lanes[CURRENT_STAT_IDX][i];
+ m_active_exu_threads[PREV_STAT_IDX][i]=m_active_exu_threads[CURRENT_STAT_IDX][i];
+ m_active_exu_warps[PREV_STAT_IDX][i]=m_active_exu_warps[CURRENT_STAT_IDX][i];
}
}
@@ -356,6 +380,51 @@ power_stat_t::power_stat_t(const shader_core_config *shader_config,
m_active_sms = active_sms;
m_config = shader_config;
m_mem_config = mem_config;
+ l1r_hits_kernel = 0;
+ l1r_misses_kernel = 0;
+ l1w_hits_kernel = 0;
+ l1w_misses_kernel = 0;
+ shared_accesses_kernel = 0;
+ cc_accesses_kernel = 0;
+ dram_rd_kernel = 0;
+ dram_wr_kernel = 0;
+ dram_pre_kernel = 0;
+ l1i_hits_kernel =0;
+ l1i_misses_kernel =0;
+ l2r_hits_kernel =0;
+ l2r_misses_kernel =0;
+ l2w_hits_kernel =0;
+ l2w_misses_kernel =0;
+ noc_tr_kernel = 0;
+ noc_rc_kernel = 0;
+
+ tot_inst_execution = 0;
+ tot_int_inst_execution = 0;
+ tot_fp_inst_execution = 0;
+ commited_inst_execution = 0;
+ ialu_acc_execution = 0;
+ imul24_acc_execution = 0;
+ imul32_acc_execution = 0;
+ imul_acc_execution = 0;
+ idiv_acc_execution = 0;
+ dp_acc_execution = 0;
+ dpmul_acc_execution = 0;
+ dpdiv_acc_execution = 0;
+ fp_acc_execution = 0;
+ fpmul_acc_execution = 0;
+ fpdiv_acc_execution = 0;
+ sqrt_acc_execution = 0;
+ log_acc_execution = 0;
+ sin_acc_execution = 0;
+ exp_acc_execution = 0;
+ tensor_acc_execution = 0;
+ tex_acc_execution = 0;
+ tot_fpu_acc_execution = 0;
+ tot_sfu_acc_execution = 0;
+ tot_threads_acc_execution = 0;
+ tot_warps_acc_execution = 0;
+ sp_active_lanes_execution = 0;
+ sfu_active_lanes_execution = 0;
}
void power_stat_t::visualizer_print(gzFile visualizer_file) {
diff --git a/src/gpgpu-sim/power_stat.h b/src/gpgpu-sim/power_stat.h
index c469db3..e2c3ed5 100644
--- a/src/gpgpu-sim/power_stat.h
+++ b/src/gpgpu-sim/power_stat.h
@@ -1,18 +1,19 @@
-// Copyright (c) 2009-2011, Tor M. Aamodt, Ahmed El-Shafiey, Tayler Hetherington
-// The University of British Columbia
+// Copyright (c) 2009-2021, Tor M. Aamodt, Ahmed El-Shafiey, Tayler Hetherington, Vijay Kandiah, Nikos Hardavellas
+// The University of British Columbia, Northwestern University
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution. Neither the name of
-// The University of British Columbia nor the names of its contributors may be
-// used to endorse or promote products derived from this software without
-// specific prior written permission.
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer;
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution;
+// 3. Neither the names of The University of British Columbia, Northwestern
+// University nor the names of their contributors may be used to
+// endorse or promote products derived from this software without specific
+// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -51,29 +52,40 @@ struct shader_core_power_stats_pod {
unsigned
*m_num_INTdecoded_insn[NUM_STAT_IDX]; // number of instructions committed
// by this shader core
- unsigned *m_num_storequeued_insn[NUM_STAT_IDX];
- unsigned *m_num_loadqueued_insn[NUM_STAT_IDX];
- unsigned *m_num_ialu_acesses[NUM_STAT_IDX];
- unsigned *m_num_fp_acesses[NUM_STAT_IDX];
- unsigned *m_num_tex_inst[NUM_STAT_IDX];
- unsigned *m_num_imul_acesses[NUM_STAT_IDX];
- unsigned *m_num_imul32_acesses[NUM_STAT_IDX];
- unsigned *m_num_imul24_acesses[NUM_STAT_IDX];
- unsigned *m_num_fpmul_acesses[NUM_STAT_IDX];
- unsigned *m_num_idiv_acesses[NUM_STAT_IDX];
- unsigned *m_num_fpdiv_acesses[NUM_STAT_IDX];
- unsigned *m_num_sp_acesses[NUM_STAT_IDX];
- unsigned *m_num_sfu_acesses[NUM_STAT_IDX];
- unsigned *m_num_trans_acesses[NUM_STAT_IDX];
- unsigned *m_num_mem_acesses[NUM_STAT_IDX];
- unsigned *m_num_sp_committed[NUM_STAT_IDX];
- unsigned *m_num_sfu_committed[NUM_STAT_IDX];
- unsigned *m_num_mem_committed[NUM_STAT_IDX];
- unsigned *m_active_sp_lanes[NUM_STAT_IDX];
- unsigned *m_active_sfu_lanes[NUM_STAT_IDX];
- unsigned *m_read_regfile_acesses[NUM_STAT_IDX];
- unsigned *m_write_regfile_acesses[NUM_STAT_IDX];
- unsigned *m_non_rf_operands[NUM_STAT_IDX];
+ unsigned *m_num_storequeued_insn[NUM_STAT_IDX];
+ unsigned *m_num_loadqueued_insn[NUM_STAT_IDX];
+ unsigned *m_num_tex_inst[NUM_STAT_IDX];
+ double *m_num_ialu_acesses[NUM_STAT_IDX];
+ double *m_num_fp_acesses[NUM_STAT_IDX];
+ double *m_num_imul_acesses[NUM_STAT_IDX];
+ double *m_num_imul32_acesses[NUM_STAT_IDX];
+ double *m_num_imul24_acesses[NUM_STAT_IDX];
+ double *m_num_fpmul_acesses[NUM_STAT_IDX];
+ double *m_num_idiv_acesses[NUM_STAT_IDX];
+ double *m_num_fpdiv_acesses[NUM_STAT_IDX];
+ double *m_num_dp_acesses[NUM_STAT_IDX];
+ double *m_num_dpmul_acesses[NUM_STAT_IDX];
+ double *m_num_dpdiv_acesses[NUM_STAT_IDX];
+ double *m_num_sp_acesses[NUM_STAT_IDX];
+ double *m_num_sfu_acesses[NUM_STAT_IDX];
+ double *m_num_sqrt_acesses[NUM_STAT_IDX];
+ double *m_num_log_acesses[NUM_STAT_IDX];
+ double *m_num_sin_acesses[NUM_STAT_IDX];
+ double *m_num_exp_acesses[NUM_STAT_IDX];
+ double *m_num_tensor_core_acesses[NUM_STAT_IDX];
+ double *m_num_const_acesses[NUM_STAT_IDX];
+ double *m_num_tex_acesses[NUM_STAT_IDX];
+ double *m_num_mem_acesses[NUM_STAT_IDX];
+ unsigned *m_num_sp_committed[NUM_STAT_IDX];
+ unsigned *m_num_sfu_committed[NUM_STAT_IDX];
+ unsigned *m_num_mem_committed[NUM_STAT_IDX];
+ unsigned *m_active_sp_lanes[NUM_STAT_IDX];
+ unsigned *m_active_sfu_lanes[NUM_STAT_IDX];
+ double *m_active_exu_threads[NUM_STAT_IDX];
+ double *m_active_exu_warps[NUM_STAT_IDX];
+ unsigned *m_read_regfile_acesses[NUM_STAT_IDX];
+ unsigned *m_write_regfile_acesses[NUM_STAT_IDX];
+ unsigned *m_non_rf_operands[NUM_STAT_IDX];
};
class power_core_stat_t : public shader_core_power_stats_pod {
@@ -84,6 +96,7 @@ class power_core_stat_t : public shader_core_power_stats_pod {
void print(FILE *fout);
void init();
void save_stats();
+
private:
shader_core_stats *m_core_stats;
@@ -96,8 +109,7 @@ struct mem_power_stats_pod {
class cache_stats core_cache_stats[NUM_STAT_IDX]; // Total core stats
class cache_stats l2_cache_stats[NUM_STAT_IDX]; // Total L2 partition stats
- unsigned *shmem_read_access[NUM_STAT_IDX]; // Shared memory access
-
+ unsigned *shmem_access[NUM_STAT_IDX]; // Shared memory access
// Low level DRAM stats
unsigned *n_cmd[NUM_STAT_IDX];
unsigned *n_activity[NUM_STAT_IDX];
@@ -106,6 +118,7 @@ struct mem_power_stats_pod {
unsigned *n_pre[NUM_STAT_IDX];
unsigned *n_rd[NUM_STAT_IDX];
unsigned *n_wr[NUM_STAT_IDX];
+ unsigned *n_wr_WB[NUM_STAT_IDX];
unsigned *n_req[NUM_STAT_IDX];
// Interconnect stats
@@ -144,34 +157,88 @@ class power_stat_t {
*m_average_pipeline_duty_cycle = 0;
*m_active_sms = 0;
}
-
- unsigned get_total_inst() {
- unsigned total_inst = 0;
+ void clear();
+ unsigned l1i_misses_kernel;
+ unsigned l1i_hits_kernel;
+ unsigned long long l1r_hits_kernel;
+ unsigned long long l1r_misses_kernel;
+ unsigned long long l1w_hits_kernel;
+ unsigned long long l1w_misses_kernel;
+ unsigned long long shared_accesses_kernel;
+ unsigned long long cc_accesses_kernel;
+ unsigned long long dram_rd_kernel;
+ unsigned long long dram_wr_kernel;
+ unsigned long long dram_pre_kernel;
+ unsigned long long l2r_hits_kernel;
+ unsigned long long l2r_misses_kernel;
+ unsigned long long l2w_hits_kernel;
+ unsigned long long l2w_misses_kernel;
+ unsigned long long noc_tr_kernel;
+ unsigned long long noc_rc_kernel;
+ unsigned long long tot_inst_execution;
+ unsigned long long tot_int_inst_execution;
+ unsigned long long tot_fp_inst_execution;
+ unsigned long long commited_inst_execution;
+ unsigned long long ialu_acc_execution;
+ unsigned long long imul24_acc_execution;
+ unsigned long long imul32_acc_execution;
+ unsigned long long imul_acc_execution;
+ unsigned long long idiv_acc_execution;
+ unsigned long long dp_acc_execution;
+ unsigned long long dpmul_acc_execution;
+ unsigned long long dpdiv_acc_execution;
+ unsigned long long fp_acc_execution;
+ unsigned long long fpmul_acc_execution;
+ unsigned long long fpdiv_acc_execution;
+ unsigned long long sqrt_acc_execution;
+ unsigned long long log_acc_execution;
+ unsigned long long sin_acc_execution;
+ unsigned long long exp_acc_execution;
+ unsigned long long tensor_acc_execution;
+ unsigned long long tex_acc_execution;
+ unsigned long long tot_fpu_acc_execution;
+ unsigned long long tot_sfu_acc_execution;
+ unsigned long long tot_threads_acc_execution;
+ unsigned long long tot_warps_acc_execution;
+ unsigned long long sp_active_lanes_execution;
+ unsigned long long sfu_active_lanes_execution;
+ double get_total_inst(bool aggregate_stat) {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst += (pwr_core_stat->m_num_decoded_insn[CURRENT_STAT_IDX][i]) -
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_decoded_insn[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_decoded_insn[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_decoded_insn[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_total_int_inst() {
- unsigned total_inst = 0;
+ double get_total_int_inst(bool aggregate_stat) {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst +=
+ if(aggregate_stat)
+ total_inst +=
+ (pwr_core_stat->m_num_INTdecoded_insn[CURRENT_STAT_IDX][i]);
+ else
+ total_inst +=
(pwr_core_stat->m_num_INTdecoded_insn[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_INTdecoded_insn[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_total_fp_inst() {
- unsigned total_inst = 0;
+ double get_total_fp_inst(bool aggregate_stat) {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst += (pwr_core_stat->m_num_FPdecoded_insn[CURRENT_STAT_IDX][i]) -
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_FPdecoded_insn[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_FPdecoded_insn[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_FPdecoded_insn[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_total_load_inst() {
- unsigned total_inst = 0;
+ double get_total_load_inst() {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
total_inst +=
(pwr_core_stat->m_num_loadqueued_insn[CURRENT_STAT_IDX][i]) -
@@ -179,8 +246,8 @@ class power_stat_t {
}
return total_inst;
}
- unsigned get_total_store_inst() {
- unsigned total_inst = 0;
+ double get_total_store_inst() {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
total_inst +=
(pwr_core_stat->m_num_storequeued_insn[CURRENT_STAT_IDX][i]) -
@@ -188,34 +255,39 @@ class power_stat_t {
}
return total_inst;
}
- unsigned get_sp_committed_inst() {
- unsigned total_inst = 0;
+ double get_sp_committed_inst() {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
total_inst += (pwr_core_stat->m_num_sp_committed[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_sp_committed[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_sfu_committed_inst() {
- unsigned total_inst = 0;
+ double get_sfu_committed_inst() {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
total_inst += (pwr_core_stat->m_num_sfu_committed[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_sfu_committed[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_mem_committed_inst() {
- unsigned total_inst = 0;
+ double get_mem_committed_inst() {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
total_inst += (pwr_core_stat->m_num_mem_committed[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_mem_committed[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_committed_inst() {
- unsigned total_inst = 0;
+ double get_committed_inst(bool aggregate_stat) {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst += (pwr_core_stat->m_num_mem_committed[CURRENT_STAT_IDX][i]) -
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_mem_committed[CURRENT_STAT_IDX][i]) +
+ (pwr_core_stat->m_num_sfu_committed[CURRENT_STAT_IDX][i]) +
+ (pwr_core_stat->m_num_sp_committed[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_mem_committed[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_mem_committed[PREV_STAT_IDX][i]) +
(pwr_core_stat->m_num_sfu_committed[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_sfu_committed[PREV_STAT_IDX][i]) +
@@ -224,19 +296,27 @@ class power_stat_t {
}
return total_inst;
}
- unsigned get_regfile_reads() {
- unsigned total_inst = 0;
+ double get_regfile_reads(bool aggregate_stat) {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst +=
+ if(aggregate_stat)
+ total_inst +=
+ (pwr_core_stat->m_read_regfile_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst +=
(pwr_core_stat->m_read_regfile_acesses[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_read_regfile_acesses[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_regfile_writes() {
- unsigned total_inst = 0;
+ double get_regfile_writes(bool aggregate_stat) {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst +=
+ if(aggregate_stat)
+ total_inst +=
+ (pwr_core_stat->m_write_regfile_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst +=
(pwr_core_stat->m_write_regfile_acesses[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_write_regfile_acesses[PREV_STAT_IDX][i]);
}
@@ -253,17 +333,20 @@ class power_stat_t {
return total_inst;
}
- unsigned get_non_regfile_operands() {
- unsigned total_inst = 0;
+ double get_non_regfile_operands(bool aggregate_stat) {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst += (pwr_core_stat->m_non_rf_operands[CURRENT_STAT_IDX][i]) -
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_non_rf_operands[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_non_rf_operands[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_non_rf_operands[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_sp_accessess() {
- unsigned total_inst = 0;
+ double get_sp_accessess() {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
total_inst += (pwr_core_stat->m_num_sp_acesses[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_sp_acesses[PREV_STAT_IDX][i]);
@@ -271,25 +354,58 @@ class power_stat_t {
return total_inst;
}
- unsigned get_sfu_accessess() {
- unsigned total_inst = 0;
+ double get_sfu_accessess() {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
total_inst += (pwr_core_stat->m_num_sfu_acesses[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_sfu_acesses[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_trans_accessess() {
- unsigned total_inst = 0;
- for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst += (pwr_core_stat->m_num_trans_acesses[CURRENT_STAT_IDX][i]) -
- (pwr_core_stat->m_num_trans_acesses[PREV_STAT_IDX][i]);
- }
- return total_inst;
+
+ double get_sqrt_accessess(bool aggregate_stat){
+ double total_inst=0;
+ for(unsigned i=0; i<m_config->num_shader();i++){
+ if(aggregate_stat)
+ total_inst+=(pwr_core_stat->m_num_sqrt_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst+=(pwr_core_stat->m_num_sqrt_acesses[CURRENT_STAT_IDX][i]) - (pwr_core_stat->m_num_sqrt_acesses[PREV_STAT_IDX][i]);
+ }
+ return total_inst;
+ }
+ double get_log_accessess(bool aggregate_stat){
+ double total_inst=0;
+ for(unsigned i=0; i<m_config->num_shader();i++){
+ if(aggregate_stat)
+ total_inst+=(pwr_core_stat->m_num_log_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst+=(pwr_core_stat->m_num_log_acesses[CURRENT_STAT_IDX][i]) - (pwr_core_stat->m_num_log_acesses[PREV_STAT_IDX][i]);
+ }
+ return total_inst;
+ }
+ double get_sin_accessess(bool aggregate_stat){
+ double total_inst=0;
+ for(unsigned i=0; i<m_config->num_shader();i++){
+ if(aggregate_stat)
+ total_inst+=(pwr_core_stat->m_num_sin_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst+=(pwr_core_stat->m_num_sin_acesses[CURRENT_STAT_IDX][i]) - (pwr_core_stat->m_num_sin_acesses[PREV_STAT_IDX][i]);
+ }
+ return total_inst;
+ }
+ double get_exp_accessess(bool aggregate_stat){
+ double total_inst=0;
+ for(unsigned i=0; i<m_config->num_shader();i++){
+ if(aggregate_stat)
+ total_inst+=(pwr_core_stat->m_num_exp_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst+=(pwr_core_stat->m_num_exp_acesses[CURRENT_STAT_IDX][i]) - (pwr_core_stat->m_num_exp_acesses[PREV_STAT_IDX][i]);
+ }
+ return total_inst;
}
- unsigned get_mem_accessess() {
- unsigned total_inst = 0;
+ double get_mem_accessess() {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
total_inst += (pwr_core_stat->m_num_mem_acesses[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_mem_acesses[PREV_STAT_IDX][i]);
@@ -297,66 +413,164 @@ class power_stat_t {
return total_inst;
}
- unsigned get_intdiv_accessess() {
- unsigned total_inst = 0;
+ double get_intdiv_accessess(bool aggregate_stat) {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst += (pwr_core_stat->m_num_idiv_acesses[CURRENT_STAT_IDX][i]) -
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_idiv_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_idiv_acesses[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_idiv_acesses[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_fpdiv_accessess() {
- unsigned total_inst = 0;
+ double get_fpdiv_accessess(bool aggregate_stat) {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst += (pwr_core_stat->m_num_fpdiv_acesses[CURRENT_STAT_IDX][i]) -
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_fpdiv_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_fpdiv_acesses[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_fpdiv_acesses[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_intmul32_accessess() {
- unsigned total_inst = 0;
+ double get_intmul32_accessess(bool aggregate_stat) {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst += (pwr_core_stat->m_num_imul32_acesses[CURRENT_STAT_IDX][i]) -
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_imul32_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_imul32_acesses[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_imul32_acesses[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_intmul24_accessess() {
- unsigned total_inst = 0;
+ double get_intmul24_accessess(bool aggregate_stat) {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst += (pwr_core_stat->m_num_imul24_acesses[CURRENT_STAT_IDX][i]) -
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_imul24_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_imul24_acesses[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_imul24_acesses[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_intmul_accessess() {
- unsigned total_inst = 0;
- for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst += (pwr_core_stat->m_num_imul_acesses[CURRENT_STAT_IDX][i]) -
- (pwr_core_stat->m_num_imul_acesses[PREV_STAT_IDX][i]) +
- (pwr_core_stat->m_num_imul24_acesses[CURRENT_STAT_IDX][i]) -
- (pwr_core_stat->m_num_imul24_acesses[PREV_STAT_IDX][i]) +
- (pwr_core_stat->m_num_imul32_acesses[CURRENT_STAT_IDX][i]) -
- (pwr_core_stat->m_num_imul32_acesses[PREV_STAT_IDX][i]);
+ double get_intmul_accessess(bool aggregate_stat){
+ double total_inst=0;
+ for(unsigned i=0; i<m_config->num_shader();i++){
+ if(aggregate_stat)
+ total_inst+= (pwr_core_stat->m_num_imul_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst+= (pwr_core_stat->m_num_imul_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_imul_acesses[PREV_STAT_IDX][i]);
+ }
+ return total_inst;
+ }
+
+ double get_fpmul_accessess(bool aggregate_stat){
+ double total_inst=0;
+ for(unsigned i=0; i<m_config->num_shader();i++){
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_fpmul_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_fpmul_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_fpmul_acesses[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_fpmul_accessess() {
- unsigned total_inst = 0;
- for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst += (pwr_core_stat->m_num_fp_acesses[CURRENT_STAT_IDX][i]) -
- (pwr_core_stat->m_num_fp_acesses[PREV_STAT_IDX][i]);
+ double get_fp_accessess(bool aggregate_stat){
+ double total_inst=0;
+ for(unsigned i=0; i<m_config->num_shader();i++){
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_fp_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_fp_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_fp_acesses[PREV_STAT_IDX][i]);
}
return total_inst;
}
- float get_sp_active_lanes() {
- unsigned total_inst = 0;
+ double get_dp_accessess(bool aggregate_stat){
+ double total_inst=0;
+ for(unsigned i=0; i<m_config->num_shader();i++){
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_dp_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_dp_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_dp_acesses[PREV_STAT_IDX][i]);
+ }
+ return total_inst;
+ }
+
+ double get_dpmul_accessess(bool aggregate_stat){
+ double total_inst=0;
+ for(unsigned i=0; i<m_config->num_shader();i++){
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_dpmul_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_dpmul_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_dpmul_acesses[PREV_STAT_IDX][i]);
+ }
+ return total_inst;
+ }
+
+ double get_dpdiv_accessess(bool aggregate_stat){
+ double total_inst=0;
+ for(unsigned i=0; i<m_config->num_shader();i++){
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_dpdiv_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_dpdiv_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_dpdiv_acesses[PREV_STAT_IDX][i]);
+ }
+ return total_inst;
+ }
+
+ double get_tensor_accessess(bool aggregate_stat){
+ double total_inst=0;
+ for(unsigned i=0; i<m_config->num_shader();i++){
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_tensor_core_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_tensor_core_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_tensor_core_acesses[PREV_STAT_IDX][i]);
+ }
+ return total_inst;
+ }
+
+ double get_const_accessess(bool aggregate_stat){
+ double total_inst=0;
+ for(unsigned i=0; i<m_config->num_shader();i++){
+ if(aggregate_stat)
+ total_inst += pwr_core_stat->m_num_const_acesses[CURRENT_STAT_IDX][i];
+ else
+ total_inst += (pwr_core_stat->m_num_const_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_const_acesses[PREV_STAT_IDX][i]);
+ }
+ return (total_inst);
+ }
+
+ double get_tex_accessess(bool aggregate_stat){
+ double total_inst=0;
+ for(unsigned i=0; i<m_config->num_shader();i++){
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_tex_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_tex_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_tex_acesses[PREV_STAT_IDX][i]);
+ }
+ return total_inst;
+ }
+
+ double get_sp_active_lanes() {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
total_inst += (pwr_core_stat->m_active_sp_lanes[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_active_sp_lanes[PREV_STAT_IDX][i]);
@@ -365,7 +579,7 @@ class power_stat_t {
}
float get_sfu_active_lanes() {
- unsigned total_inst = 0;
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
total_inst += (pwr_core_stat->m_active_sfu_lanes[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_active_sfu_lanes[PREV_STAT_IDX][i]);
@@ -375,49 +589,141 @@ class power_stat_t {
m_config->gpgpu_num_sfu_units;
}
- unsigned get_tot_fpu_accessess() {
- unsigned total_inst = 0;
+
+ float get_active_threads(bool aggregate_stat) {
+ unsigned total_threads = 0;
+ unsigned total_warps = 0;
+ for (unsigned i = 0; i < m_config->num_shader(); i++) {
+ if(aggregate_stat){
+ total_threads += (pwr_core_stat->m_active_exu_threads[CURRENT_STAT_IDX][i]) ;
+ total_warps += (pwr_core_stat->m_active_exu_warps[CURRENT_STAT_IDX][i]);
+ }
+ else{
+ total_threads += (pwr_core_stat->m_active_exu_threads[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_active_exu_threads[PREV_STAT_IDX][i]);
+ total_warps += (pwr_core_stat->m_active_exu_warps[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_active_exu_warps[PREV_STAT_IDX][i]);
+ }
+ }
+ if(total_warps != 0)
+ return (float)((float)total_threads / (float)total_warps);
+ else
+ return 0;
+ }
+
+ unsigned long long get_tot_threads_kernel(bool aggregate_stat) {
+ unsigned total_threads = 0;
+ for (unsigned i = 0; i < m_config->num_shader(); i++) {
+ if(aggregate_stat){
+ total_threads += (pwr_core_stat->m_active_exu_threads[CURRENT_STAT_IDX][i]) ;
+ }
+ else{
+ total_threads += (pwr_core_stat->m_active_exu_threads[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_active_exu_threads[PREV_STAT_IDX][i]);
+ }
+ }
+
+ return total_threads;
+ }
+ unsigned long long get_tot_warps_kernel(bool aggregate_stat) {
+ unsigned long long total_warps = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst += (pwr_core_stat->m_num_fp_acesses[CURRENT_STAT_IDX][i]) -
+ if(aggregate_stat){
+ total_warps += (pwr_core_stat->m_active_exu_warps[CURRENT_STAT_IDX][i]);
+ }
+ else{
+ total_warps += (pwr_core_stat->m_active_exu_warps[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_active_exu_warps[PREV_STAT_IDX][i]);
+ }
+ }
+ return total_warps;
+ }
+
+
+ double get_tot_fpu_accessess(bool aggregate_stat){
+ double total_inst=0;
+ for(unsigned i=0; i<m_config->num_shader();i++){
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_fp_acesses[CURRENT_STAT_IDX][i])+
+ (pwr_core_stat->m_num_dp_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_fp_acesses[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_fp_acesses[PREV_STAT_IDX][i]) +
- (pwr_core_stat->m_num_fpdiv_acesses[CURRENT_STAT_IDX][i]) -
- (pwr_core_stat->m_num_fpdiv_acesses[PREV_STAT_IDX][i]) +
- (pwr_core_stat->m_num_fpmul_acesses[CURRENT_STAT_IDX][i]) -
- (pwr_core_stat->m_num_fpmul_acesses[PREV_STAT_IDX][i]) +
- (pwr_core_stat->m_num_imul24_acesses[CURRENT_STAT_IDX][i]) -
- (pwr_core_stat->m_num_imul24_acesses[PREV_STAT_IDX][i]) +
- (pwr_core_stat->m_num_imul_acesses[CURRENT_STAT_IDX][i]) -
- (pwr_core_stat->m_num_imul_acesses[PREV_STAT_IDX][i]);
+ (pwr_core_stat->m_num_dp_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_dp_acesses[PREV_STAT_IDX][i]);
}
- total_inst +=
- get_total_load_inst() + get_total_store_inst() + get_tex_inst();
+ //total_inst += get_total_load_inst()+get_total_store_inst()+get_tex_inst();
return total_inst;
}
- unsigned get_tot_sfu_accessess() {
- unsigned total_inst = 0;
- for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst += (pwr_core_stat->m_num_idiv_acesses[CURRENT_STAT_IDX][i]) -
+
+
+ double get_tot_sfu_accessess(bool aggregate_stat){
+ double total_inst=0;
+ for(unsigned i=0; i<m_config->num_shader();i++){
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_idiv_acesses[CURRENT_STAT_IDX][i])+
+ (pwr_core_stat->m_num_imul32_acesses[CURRENT_STAT_IDX][i])+
+ (pwr_core_stat->m_num_sqrt_acesses[CURRENT_STAT_IDX][i])+
+ (pwr_core_stat->m_num_log_acesses[CURRENT_STAT_IDX][i])+
+ (pwr_core_stat->m_num_sin_acesses[CURRENT_STAT_IDX][i])+
+ (pwr_core_stat->m_num_exp_acesses[CURRENT_STAT_IDX][i])+
+ (pwr_core_stat->m_num_fpdiv_acesses[CURRENT_STAT_IDX][i])+
+ (pwr_core_stat->m_num_fpmul_acesses[CURRENT_STAT_IDX][i])+
+ (pwr_core_stat->m_num_dpmul_acesses[CURRENT_STAT_IDX][i])+
+ (pwr_core_stat->m_num_dpdiv_acesses[CURRENT_STAT_IDX][i])+
+ (pwr_core_stat->m_num_imul24_acesses[CURRENT_STAT_IDX][i]) +
+ (pwr_core_stat->m_num_imul_acesses[CURRENT_STAT_IDX][i])+
+ (pwr_core_stat->m_num_tensor_core_acesses[CURRENT_STAT_IDX][i])+
+ (pwr_core_stat->m_num_tex_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_idiv_acesses[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_idiv_acesses[PREV_STAT_IDX][i]) +
- (pwr_core_stat->m_num_imul32_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_imul32_acesses[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_imul32_acesses[PREV_STAT_IDX][i]) +
- (pwr_core_stat->m_num_trans_acesses[CURRENT_STAT_IDX][i]) -
- (pwr_core_stat->m_num_trans_acesses[PREV_STAT_IDX][i]);
+ (pwr_core_stat->m_num_sqrt_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_sqrt_acesses[PREV_STAT_IDX][i]) +
+ (pwr_core_stat->m_num_log_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_log_acesses[PREV_STAT_IDX][i]) +
+ (pwr_core_stat->m_num_sin_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_sin_acesses[PREV_STAT_IDX][i]) +
+ (pwr_core_stat->m_num_exp_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_exp_acesses[PREV_STAT_IDX][i]) +
+ (pwr_core_stat->m_num_fpdiv_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_fpdiv_acesses[PREV_STAT_IDX][i]) +
+ (pwr_core_stat->m_num_fpmul_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_fpmul_acesses[PREV_STAT_IDX][i]) +
+ (pwr_core_stat->m_num_dpmul_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_dpmul_acesses[PREV_STAT_IDX][i]) +
+ (pwr_core_stat->m_num_dpdiv_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_dpdiv_acesses[PREV_STAT_IDX][i]) +
+ (pwr_core_stat->m_num_imul24_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_imul24_acesses[PREV_STAT_IDX][i]) +
+ (pwr_core_stat->m_num_imul_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_imul_acesses[PREV_STAT_IDX][i]) +
+ (pwr_core_stat->m_num_tensor_core_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_tensor_core_acesses[PREV_STAT_IDX][i]) +
+ (pwr_core_stat->m_num_tex_acesses[CURRENT_STAT_IDX][i]) -
+ (pwr_core_stat->m_num_tex_acesses[PREV_STAT_IDX][i]);
+
}
return total_inst;
}
- unsigned get_ialu_accessess() {
- unsigned total_inst = 0;
+ double get_ialu_accessess(bool aggregate_stat) {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst += (pwr_core_stat->m_num_ialu_acesses[CURRENT_STAT_IDX][i]) -
+ if(aggregate_stat)
+ total_inst += (pwr_core_stat->m_num_ialu_acesses[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_core_stat->m_num_ialu_acesses[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_ialu_acesses[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_tex_inst() {
- unsigned total_inst = 0;
+ double get_tex_inst() {
+ double total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
total_inst += (pwr_core_stat->m_num_tex_inst[CURRENT_STAT_IDX][i]) -
(pwr_core_stat->m_num_tex_inst[PREV_STAT_IDX][i]);
@@ -425,7 +731,7 @@ class power_stat_t {
return total_inst;
}
- unsigned get_constant_c_accesses() {
+ double get_constant_c_accesses() {
enum mem_access_type access_type[] = {CONST_ACC_R};
enum cache_request_status request_status[] = {HIT, MISS, HIT_RESERVED};
unsigned num_access_type =
@@ -440,7 +746,7 @@ class power_stat_t {
access_type, num_access_type, request_status,
num_request_status));
}
- unsigned get_constant_c_misses() {
+ double get_constant_c_misses() {
enum mem_access_type access_type[] = {CONST_ACC_R};
enum cache_request_status request_status[] = {MISS};
unsigned num_access_type =
@@ -455,10 +761,10 @@ class power_stat_t {
access_type, num_access_type, request_status,
num_request_status));
}
- unsigned get_constant_c_hits() {
+ double get_constant_c_hits() {
return (get_constant_c_accesses() - get_constant_c_misses());
}
- unsigned get_texture_c_accesses() {
+ double get_texture_c_accesses() {
enum mem_access_type access_type[] = {TEXTURE_ACC_R};
enum cache_request_status request_status[] = {HIT, MISS, HIT_RESERVED};
unsigned num_access_type =
@@ -473,7 +779,7 @@ class power_stat_t {
access_type, num_access_type, request_status,
num_request_status));
}
- unsigned get_texture_c_misses() {
+ double get_texture_c_misses() {
enum mem_access_type access_type[] = {TEXTURE_ACC_R};
enum cache_request_status request_status[] = {MISS};
unsigned num_access_type =
@@ -488,205 +794,268 @@ class power_stat_t {
access_type, num_access_type, request_status,
num_request_status));
}
- unsigned get_texture_c_hits() {
+ double get_texture_c_hits() {
return (get_texture_c_accesses() - get_texture_c_misses());
}
- unsigned get_inst_c_accesses() {
+ double get_inst_c_accesses(bool aggregate_stat) {
enum mem_access_type access_type[] = {INST_ACC_R};
enum cache_request_status request_status[] = {HIT, MISS, HIT_RESERVED};
unsigned num_access_type =
sizeof(access_type) / sizeof(enum mem_access_type);
unsigned num_request_status =
sizeof(request_status) / sizeof(enum cache_request_status);
-
- return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
+ if(aggregate_stat)
+ return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
+ access_type, num_access_type, request_status,
+ num_request_status));
+ else
+ return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status)) -
(pwr_mem_stat->core_cache_stats[PREV_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status));
}
- unsigned get_inst_c_misses() {
+ double get_inst_c_misses(bool aggregate_stat) {
enum mem_access_type access_type[] = {INST_ACC_R};
enum cache_request_status request_status[] = {MISS};
unsigned num_access_type =
sizeof(access_type) / sizeof(enum mem_access_type);
unsigned num_request_status =
sizeof(request_status) / sizeof(enum cache_request_status);
-
- return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
+ if(aggregate_stat)
+ return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
+ access_type, num_access_type, request_status,
+ num_request_status));
+ else
+ return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status)) -
(pwr_mem_stat->core_cache_stats[PREV_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status));
}
- unsigned get_inst_c_hits() {
- return (get_inst_c_accesses() - get_inst_c_misses());
+ double get_inst_c_hits(bool aggregate_stat) {
+ return (get_inst_c_accesses(aggregate_stat) - get_inst_c_misses(aggregate_stat));
}
- unsigned get_l1d_read_accesses() {
+ double get_l1d_read_accesses(bool aggregate_stat) {
enum mem_access_type access_type[] = {GLOBAL_ACC_R, LOCAL_ACC_R};
- enum cache_request_status request_status[] = {HIT, MISS, HIT_RESERVED};
+ enum cache_request_status request_status[] = {HIT, MISS, SECTOR_MISS};
unsigned num_access_type =
sizeof(access_type) / sizeof(enum mem_access_type);
unsigned num_request_status =
sizeof(request_status) / sizeof(enum cache_request_status);
- return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
+ if(aggregate_stat){
+ return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
+ access_type, num_access_type, request_status,
+ num_request_status));
+ }
+ else{
+ return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status)) -
(pwr_mem_stat->core_cache_stats[PREV_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status));
+ }
}
- unsigned get_l1d_read_misses() {
+ double get_l1d_read_misses(bool aggregate_stat) {
+ return (get_l1d_read_accesses(aggregate_stat) - get_l1d_read_hits(aggregate_stat));
+ }
+ double get_l1d_read_hits(bool aggregate_stat) {
enum mem_access_type access_type[] = {GLOBAL_ACC_R, LOCAL_ACC_R};
- enum cache_request_status request_status[] = {MISS};
+ enum cache_request_status request_status[] = {HIT, MSHR_HIT};
unsigned num_access_type =
sizeof(access_type) / sizeof(enum mem_access_type);
unsigned num_request_status =
sizeof(request_status) / sizeof(enum cache_request_status);
- return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
+ if(aggregate_stat){
+ return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
+ access_type, num_access_type, request_status,
+ num_request_status));
+ }
+ else{
+ return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status)) -
(pwr_mem_stat->core_cache_stats[PREV_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status));
+ }
}
- unsigned get_l1d_read_hits() {
- return (get_l1d_read_accesses() - get_l1d_read_misses());
- }
- unsigned get_l1d_write_accesses() {
+ double get_l1d_write_accesses(bool aggregate_stat) {
enum mem_access_type access_type[] = {GLOBAL_ACC_W, LOCAL_ACC_W};
- enum cache_request_status request_status[] = {HIT, MISS, HIT_RESERVED};
+ enum cache_request_status request_status[] = {HIT, MISS, SECTOR_MISS};
unsigned num_access_type =
sizeof(access_type) / sizeof(enum mem_access_type);
unsigned num_request_status =
sizeof(request_status) / sizeof(enum cache_request_status);
- return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
+ if(aggregate_stat){
+ return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
+ access_type, num_access_type, request_status,
+ num_request_status));
+ }
+ else{
+ return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status)) -
(pwr_mem_stat->core_cache_stats[PREV_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status));
+ }
}
- unsigned get_l1d_write_misses() {
+ double get_l1d_write_misses(bool aggregate_stat) {
+ return (get_l1d_write_accesses(aggregate_stat) - get_l1d_write_hits(aggregate_stat));
+ }
+ double get_l1d_write_hits(bool aggregate_stat) {
enum mem_access_type access_type[] = {GLOBAL_ACC_W, LOCAL_ACC_W};
- enum cache_request_status request_status[] = {MISS};
+ enum cache_request_status request_status[] = {HIT, MSHR_HIT};
unsigned num_access_type =
sizeof(access_type) / sizeof(enum mem_access_type);
unsigned num_request_status =
sizeof(request_status) / sizeof(enum cache_request_status);
- return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
+ if(aggregate_stat){
+ return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
+ access_type, num_access_type, request_status,
+ num_request_status));
+ }
+ else{
+ return (pwr_mem_stat->core_cache_stats[CURRENT_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status)) -
(pwr_mem_stat->core_cache_stats[PREV_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status));
+ }
}
- unsigned get_l1d_write_hits() {
- return (get_l1d_write_accesses() - get_l1d_write_misses());
- }
- unsigned get_cache_misses() {
- return get_l1d_read_misses() + get_constant_c_misses() +
- get_l1d_write_misses() + get_texture_c_misses();
+ double get_cache_misses() {
+ return get_l1d_read_misses(0) + get_constant_c_misses() +
+ get_l1d_write_misses(0) + get_texture_c_misses();
}
- unsigned get_cache_read_misses() {
- return get_l1d_read_misses() + get_constant_c_misses() +
+ double get_cache_read_misses() {
+ return get_l1d_read_misses(0) + get_constant_c_misses() +
get_texture_c_misses();
}
- unsigned get_cache_write_misses() { return get_l1d_write_misses(); }
+ double get_cache_write_misses() { return get_l1d_write_misses(0); }
- unsigned get_shmem_read_access() {
+ double get_shmem_access(bool aggregate_stat) {
unsigned total_inst = 0;
for (unsigned i = 0; i < m_config->num_shader(); i++) {
- total_inst += (pwr_mem_stat->shmem_read_access[CURRENT_STAT_IDX][i]) -
- (pwr_mem_stat->shmem_read_access[PREV_STAT_IDX][i]);
+ if(aggregate_stat)
+ total_inst += (pwr_mem_stat->shmem_access[CURRENT_STAT_IDX][i]);
+ else
+ total_inst += (pwr_mem_stat->shmem_access[CURRENT_STAT_IDX][i]) -
+ (pwr_mem_stat->shmem_access[PREV_STAT_IDX][i]);
}
return total_inst;
}
- unsigned get_l2_read_accesses() {
+ unsigned long long get_l2_read_accesses(bool aggregate_stat) {
enum mem_access_type access_type[] = {
GLOBAL_ACC_R, LOCAL_ACC_R, CONST_ACC_R, TEXTURE_ACC_R, INST_ACC_R};
- enum cache_request_status request_status[] = {HIT, MISS, HIT_RESERVED};
+ enum cache_request_status request_status[] = {HIT, HIT_RESERVED, MISS, SECTOR_MISS};
unsigned num_access_type =
sizeof(access_type) / sizeof(enum mem_access_type);
unsigned num_request_status =
sizeof(request_status) / sizeof(enum cache_request_status);
-
- return (pwr_mem_stat->l2_cache_stats[CURRENT_STAT_IDX].get_stats(
+ if(aggregate_stat){
+ return (pwr_mem_stat->l2_cache_stats[CURRENT_STAT_IDX].get_stats(
+ access_type, num_access_type, request_status,
+ num_request_status));
+ }
+ else{
+ return (pwr_mem_stat->l2_cache_stats[CURRENT_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status)) -
(pwr_mem_stat->l2_cache_stats[PREV_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status));
+ }
}
- unsigned get_l2_read_misses() {
- enum mem_access_type access_type[] = {
+ unsigned long long get_l2_read_misses(bool aggregate_stat) {
+ return (get_l2_read_accesses(aggregate_stat) - get_l2_read_hits(aggregate_stat));
+ }
+
+ unsigned long long get_l2_read_hits(bool aggregate_stat) {
+ enum mem_access_type access_type[] = {
GLOBAL_ACC_R, LOCAL_ACC_R, CONST_ACC_R, TEXTURE_ACC_R, INST_ACC_R};
- enum cache_request_status request_status[] = {MISS};
+ enum cache_request_status request_status[] = {HIT, HIT_RESERVED};
unsigned num_access_type =
sizeof(access_type) / sizeof(enum mem_access_type);
unsigned num_request_status =
sizeof(request_status) / sizeof(enum cache_request_status);
-
- return (pwr_mem_stat->l2_cache_stats[CURRENT_STAT_IDX].get_stats(
+ if(aggregate_stat){
+ return (pwr_mem_stat->l2_cache_stats[CURRENT_STAT_IDX].get_stats(
+ access_type, num_access_type, request_status,
+ num_request_status));
+ }
+ else{
+ return (pwr_mem_stat->l2_cache_stats[CURRENT_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status)) -
(pwr_mem_stat->l2_cache_stats[PREV_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status));
+ }
}
- unsigned get_l2_read_hits() {
- return (get_l2_read_accesses() - get_l2_read_misses());
- }
-
- unsigned get_l2_write_accesses() {
+ unsigned long long get_l2_write_accesses(bool aggregate_stat) {
enum mem_access_type access_type[] = {GLOBAL_ACC_W, LOCAL_ACC_W,
L1_WRBK_ACC};
- enum cache_request_status request_status[] = {HIT, MISS, HIT_RESERVED};
+ enum cache_request_status request_status[] = {HIT, HIT_RESERVED, MISS, SECTOR_MISS};
unsigned num_access_type =
sizeof(access_type) / sizeof(enum mem_access_type);
unsigned num_request_status =
sizeof(request_status) / sizeof(enum cache_request_status);
-
- return (pwr_mem_stat->l2_cache_stats[CURRENT_STAT_IDX].get_stats(
+ if(aggregate_stat){
+ return (pwr_mem_stat->l2_cache_stats[CURRENT_STAT_IDX].get_stats(
+ access_type, num_access_type, request_status,
+ num_request_status));
+ }
+ else{
+ return (pwr_mem_stat->l2_cache_stats[CURRENT_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status)) -
(pwr_mem_stat->l2_cache_stats[PREV_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status));
+ }
}
- unsigned get_l2_write_misses() {
- enum mem_access_type access_type[] = {GLOBAL_ACC_W, LOCAL_ACC_W,
+ unsigned long long get_l2_write_misses(bool aggregate_stat) {
+ return (get_l2_write_accesses(aggregate_stat) - get_l2_write_hits(aggregate_stat));
+ }
+ unsigned long long get_l2_write_hits(bool aggregate_stat) {
+ enum mem_access_type access_type[] = {GLOBAL_ACC_W, LOCAL_ACC_W,
L1_WRBK_ACC};
- enum cache_request_status request_status[] = {MISS};
+ enum cache_request_status request_status[] = {HIT, HIT_RESERVED};
unsigned num_access_type =
sizeof(access_type) / sizeof(enum mem_access_type);
unsigned num_request_status =
sizeof(request_status) / sizeof(enum cache_request_status);
-
- return (pwr_mem_stat->l2_cache_stats[CURRENT_STAT_IDX].get_stats(
+ if(aggregate_stat){
+ return (pwr_mem_stat->l2_cache_stats[CURRENT_STAT_IDX].get_stats(
+ access_type, num_access_type, request_status,
+ num_request_status));
+ }
+ else{
+ return (pwr_mem_stat->l2_cache_stats[CURRENT_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status)) -
(pwr_mem_stat->l2_cache_stats[PREV_STAT_IDX].get_stats(
access_type, num_access_type, request_status,
num_request_status));
+ }
}
- unsigned get_l2_write_hits() {
- return (get_l2_write_accesses() - get_l2_write_misses());
- }
- unsigned get_dram_cmd() {
+ double get_dram_cmd() {
unsigned total = 0;
for (unsigned i = 0; i < m_mem_config->m_n_mem; ++i) {
total += (pwr_mem_stat->n_cmd[CURRENT_STAT_IDX][i] -
@@ -694,7 +1063,7 @@ class power_stat_t {
}
return total;
}
- unsigned get_dram_activity() {
+ double get_dram_activity() {
unsigned total = 0;
for (unsigned i = 0; i < m_mem_config->m_n_mem; ++i) {
total += (pwr_mem_stat->n_activity[CURRENT_STAT_IDX][i] -
@@ -702,7 +1071,7 @@ class power_stat_t {
}
return total;
}
- unsigned get_dram_nop() {
+ double get_dram_nop() {
unsigned total = 0;
for (unsigned i = 0; i < m_mem_config->m_n_mem; ++i) {
total += (pwr_mem_stat->n_nop[CURRENT_STAT_IDX][i] -
@@ -710,7 +1079,7 @@ class power_stat_t {
}
return total;
}
- unsigned get_dram_act() {
+ double get_dram_act() {
unsigned total = 0;
for (unsigned i = 0; i < m_mem_config->m_n_mem; ++i) {
total += (pwr_mem_stat->n_act[CURRENT_STAT_IDX][i] -
@@ -718,31 +1087,49 @@ class power_stat_t {
}
return total;
}
- unsigned get_dram_pre() {
+ double get_dram_pre(bool aggregate_stat) {
unsigned total = 0;
for (unsigned i = 0; i < m_mem_config->m_n_mem; ++i) {
- total += (pwr_mem_stat->n_pre[CURRENT_STAT_IDX][i] -
+ if(aggregate_stat){
+ total += pwr_mem_stat->n_pre[CURRENT_STAT_IDX][i];
+ }
+ else{
+ total += (pwr_mem_stat->n_pre[CURRENT_STAT_IDX][i] -
pwr_mem_stat->n_pre[PREV_STAT_IDX][i]);
+ }
}
return total;
}
- unsigned get_dram_rd() {
+ double get_dram_rd(bool aggregate_stat) {
unsigned total = 0;
for (unsigned i = 0; i < m_mem_config->m_n_mem; ++i) {
- total += (pwr_mem_stat->n_rd[CURRENT_STAT_IDX][i] -
+ if(aggregate_stat){
+ total += pwr_mem_stat->n_rd[CURRENT_STAT_IDX][i];
+ }
+ else{
+ total += (pwr_mem_stat->n_rd[CURRENT_STAT_IDX][i] -
pwr_mem_stat->n_rd[PREV_STAT_IDX][i]);
+ }
}
return total;
}
- unsigned get_dram_wr() {
+ double get_dram_wr(bool aggregate_stat) {
unsigned total = 0;
for (unsigned i = 0; i < m_mem_config->m_n_mem; ++i) {
- total += (pwr_mem_stat->n_wr[CURRENT_STAT_IDX][i] -
- pwr_mem_stat->n_wr[PREV_STAT_IDX][i]);
+ if(aggregate_stat){
+ total += pwr_mem_stat->n_wr[CURRENT_STAT_IDX][i] +
+ pwr_mem_stat->n_wr_WB[CURRENT_STAT_IDX][i];
+ }
+ else{
+ total += (pwr_mem_stat->n_wr[CURRENT_STAT_IDX][i] -
+ pwr_mem_stat->n_wr[PREV_STAT_IDX][i]) +
+ (pwr_mem_stat->n_wr_WB[CURRENT_STAT_IDX][i] -
+ pwr_mem_stat->n_wr_WB[PREV_STAT_IDX][i]);
+ }
}
return total;
}
- unsigned get_dram_req() {
+ double get_dram_req() {
unsigned total = 0;
for (unsigned i = 0; i < m_mem_config->m_n_mem; ++i) {
total += (pwr_mem_stat->n_req[CURRENT_STAT_IDX][i] -
@@ -751,20 +1138,31 @@ class power_stat_t {
return total;
}
- long get_icnt_simt_to_mem() {
+ unsigned long long get_icnt_simt_to_mem(bool aggregate_stat) {
long total = 0;
- for (unsigned i = 0; i < m_config->n_simt_clusters; ++i) {
- total += (pwr_mem_stat->n_simt_to_mem[CURRENT_STAT_IDX][i] -
+ for (unsigned i = 0; i < m_config->n_simt_clusters; ++i){
+ if(aggregate_stat){
+ total += pwr_mem_stat->n_simt_to_mem[CURRENT_STAT_IDX][i];
+ }
+ else{
+ total += (pwr_mem_stat->n_simt_to_mem[CURRENT_STAT_IDX][i] -
pwr_mem_stat->n_simt_to_mem[PREV_STAT_IDX][i]);
+ }
}
return total;
}
- long get_icnt_mem_to_simt() {
+ unsigned long long get_icnt_mem_to_simt(bool aggregate_stat) {
long total = 0;
for (unsigned i = 0; i < m_config->n_simt_clusters; ++i) {
- total += (pwr_mem_stat->n_mem_to_simt[CURRENT_STAT_IDX][i] -
+ if(aggregate_stat){
+ total += pwr_mem_stat->n_mem_to_simt[CURRENT_STAT_IDX][i];
+ }
+
+ else{
+ total += (pwr_mem_stat->n_mem_to_simt[CURRENT_STAT_IDX][i] -
pwr_mem_stat->n_mem_to_simt[PREV_STAT_IDX][i]);
+ }
}
return total;
}
diff --git a/src/gpgpu-sim/shader.cc b/src/gpgpu-sim/shader.cc
index bcfda18..c0161dd 100644
--- a/src/gpgpu-sim/shader.cc
+++ b/src/gpgpu-sim/shader.cc
@@ -1,19 +1,20 @@
-// Copyright (c) 2009-2011, Tor M. Aamodt, Wilson W.L. Fung, Ali Bakhoda,
-// George L. Yuan, Andrew Turner, Inderpreet Singh
-// The University of British Columbia
+// Copyright (c) 2009-2021, Tor M. Aamodt, Wilson W.L. Fung, Ali Bakhoda,
+// George L. Yuan, Andrew Turner, Inderpreet Singh, Vijay Kandiah, Nikos Hardavellas
+// The University of British Columbia, Northwestern University
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution. Neither the name of
-// The University of British Columbia nor the names of its contributors may be
-// used to endorse or promote products derived from this software without
-// specific prior written permission.
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer;
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution;
+// 3. Neither the names of The University of British Columbia, Northwestern
+// University nor the names of their contributors may be used to
+// endorse or promote products derived from this software without specific
+// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -485,6 +486,10 @@ shader_core_ctx::shader_core_ctx(class gpgpu_sim *gpu,
m_sid = shader_id;
m_tpc = tpc_id;
+ if(get_gpu()->get_config().g_power_simulation_enabled){
+ scaling_coeffs = get_gpu()->get_scaling_coeffs();
+ }
+
m_last_inst_gpu_sim_cycle = 0;
m_last_inst_gpu_tot_sim_cycle = 0;
@@ -888,7 +893,7 @@ void shader_core_ctx::decode() {
m_warp[m_inst_fetch_buffer.m_warp_id]->inc_inst_in_pipeline();
if (pI1) {
m_stats->m_num_decoded_insn[m_sid]++;
- if (pI1->oprnd_type == INT_OP) {
+ if ((pI1->oprnd_type == INT_OP) || (pI1->oprnd_type == UN_OP)) { //these counters get added up in mcPat to compute scheduler power
m_stats->m_num_INTdecoded_insn[m_sid]++;
} else if (pI1->oprnd_type == FP_OP) {
m_stats->m_num_FPdecoded_insn[m_sid]++;
@@ -899,7 +904,7 @@ void shader_core_ctx::decode() {
m_warp[m_inst_fetch_buffer.m_warp_id]->ibuffer_fill(1, pI2);
m_warp[m_inst_fetch_buffer.m_warp_id]->inc_inst_in_pipeline();
m_stats->m_num_decoded_insn[m_sid]++;
- if (pI2->oprnd_type == INT_OP) {
+ if ((pI1->oprnd_type == INT_OP) || (pI1->oprnd_type == UN_OP)) { //these counters get added up in mcPat to compute scheduler power
m_stats->m_num_INTdecoded_insn[m_sid]++;
} else if (pI2->oprnd_type == FP_OP) {
m_stats->m_num_FPdecoded_insn[m_sid]++;
@@ -982,8 +987,10 @@ void shader_core_ctx::fetch() {
m_gpu->gpu_tot_sim_cycle + m_gpu->gpu_sim_cycle);
std::list<cache_event> events;
enum cache_request_status status;
- if (m_config->perfect_inst_const_cache)
+ if (m_config->perfect_inst_const_cache){
status = HIT;
+ shader_cache_access_log(m_sid, INSTRUCTION, 0);
+ }
else
status = m_L1I->access(
(new_addr_type)ppc, mf,
@@ -2275,7 +2282,7 @@ void sp_unit::active_lanes_in_pipeline() {
void dp_unit::active_lanes_in_pipeline() {
unsigned active_count = pipelined_simd_unit::get_active_lanes_in_pipeline();
assert(active_count <= m_core->get_config()->warp_size);
- m_core->incspactivelanes_stat(active_count);
+ //m_core->incspactivelanes_stat(active_count);
m_core->incfuactivelanes_stat(active_count);
m_core->incfumemactivelanes_stat(active_count);
}
@@ -3079,52 +3086,69 @@ void warp_inst_t::print(FILE *fout) const {
m_config->gpgpu_ctx->func_sim->ptx_print_insn(pc, fout);
fprintf(fout, "\n");
}
-void shader_core_ctx::incexecstat(warp_inst_t *&inst) {
- if (inst->mem_op == TEX) inctex_stat(inst->active_count(), 1);
-
- // Latency numbers for next operations are used to scale the power values
- // for special operations, according observations from microbenchmarking
- // TODO: put these numbers in the xml configuration
-
- switch (inst->sp_op) {
+void shader_core_ctx::incexecstat(warp_inst_t *&inst)
+{
+ // Latency numbers for next operations are used to scale the power values
+ // for special operations, according observations from microbenchmarking
+ // TODO: put these numbers in the xml configuration
+ if(get_gpu()->get_config().g_power_simulation_enabled){
+ switch(inst->sp_op){
case INT__OP:
- incialu_stat(inst->active_count(), 32);
+ incialu_stat(inst->active_count(), scaling_coeffs->int_coeff);
break;
case INT_MUL_OP:
- incimul_stat(inst->active_count(), 7.2);
+ incimul_stat(inst->active_count(), scaling_coeffs->int_mul_coeff);
break;
case INT_MUL24_OP:
- incimul24_stat(inst->active_count(), 4.2);
+ incimul24_stat(inst->active_count(), scaling_coeffs->int_mul24_coeff);
break;
case INT_MUL32_OP:
- incimul32_stat(inst->active_count(), 4);
+ incimul32_stat(inst->active_count(), scaling_coeffs->int_mul32_coeff);
break;
case INT_DIV_OP:
- incidiv_stat(inst->active_count(), 40);
+ incidiv_stat(inst->active_count(), scaling_coeffs->int_div_coeff);
break;
case FP__OP:
- incfpalu_stat(inst->active_count(), 1);
+ incfpalu_stat(inst->active_count(),scaling_coeffs->fp_coeff);
break;
case FP_MUL_OP:
- incfpmul_stat(inst->active_count(), 1.8);
+ incfpmul_stat(inst->active_count(), scaling_coeffs->fp_mul_coeff);
break;
case FP_DIV_OP:
- incfpdiv_stat(inst->active_count(), 48);
+ incfpdiv_stat(inst->active_count(), scaling_coeffs->fp_div_coeff);
+ break;
+ case DP___OP:
+ incdpalu_stat(inst->active_count(), scaling_coeffs->dp_coeff);
+ break;
+ case DP_MUL_OP:
+ incdpmul_stat(inst->active_count(), scaling_coeffs->dp_mul_coeff);
+ break;
+ case DP_DIV_OP:
+ incdpdiv_stat(inst->active_count(), scaling_coeffs->dp_div_coeff);
break;
case FP_SQRT_OP:
- inctrans_stat(inst->active_count(), 25);
+ incsqrt_stat(inst->active_count(), scaling_coeffs->sqrt_coeff);
break;
case FP_LG_OP:
- inctrans_stat(inst->active_count(), 35);
+ inclog_stat(inst->active_count(), scaling_coeffs->log_coeff);
break;
case FP_SIN_OP:
- inctrans_stat(inst->active_count(), 12);
+ incsin_stat(inst->active_count(), scaling_coeffs->sin_coeff);
break;
case FP_EXP_OP:
- inctrans_stat(inst->active_count(), 35);
+ incexp_stat(inst->active_count(), scaling_coeffs->exp_coeff);
+ break;
+ case TENSOR__OP:
+ inctensor_stat(inst->active_count(), scaling_coeffs->tensor_coeff);
+ break;
+ case TEX__OP:
+ inctex_stat(inst->active_count(), scaling_coeffs->tex_coeff);
break;
default:
break;
+ }
+ if(inst->const_cache_operand) //warp has const address space load as one operand
+ inc_const_accesses(1);
}
}
void shader_core_ctx::print_stage(unsigned int stage, FILE *fout) const {
diff --git a/src/gpgpu-sim/shader.h b/src/gpgpu-sim/shader.h
index f2fac12..65d5625 100644
--- a/src/gpgpu-sim/shader.h
+++ b/src/gpgpu-sim/shader.h
@@ -1,19 +1,20 @@
-// Copyright (c) 2009-2011, Tor M. Aamodt, Wilson W.L. Fung, Andrew Turner,
-// Ali Bakhoda
-// The University of British Columbia
+// Copyright (c) 2009-2021, Tor M. Aamodt, Wilson W.L. Fung, Andrew Turner,
+// Ali Bakhoda, Vijay Kandiah, Nikos Hardavellas
+// The University of British Columbia, Northwestern University
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution. Neither the name of
-// The University of British Columbia nor the names of its contributors may be
-// used to endorse or promote products derived from this software without
-// specific prior written permission.
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer;
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution;
+// 3. Neither the names of The University of British Columbia, Northwestern
+// University nor the names of their contributors may be used to
+// endorse or promote products derived from this software without specific
+// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -1709,18 +1710,26 @@ struct shader_core_stats_pod {
unsigned *m_num_INTdecoded_insn;
unsigned *m_num_storequeued_insn;
unsigned *m_num_loadqueued_insn;
- unsigned *m_num_ialu_acesses;
- unsigned *m_num_fp_acesses;
- unsigned *m_num_imul_acesses;
unsigned *m_num_tex_inst;
- unsigned *m_num_fpmul_acesses;
- unsigned *m_num_idiv_acesses;
- unsigned *m_num_fpdiv_acesses;
- unsigned *m_num_sp_acesses;
- unsigned *m_num_sfu_acesses;
- unsigned *m_num_tensor_core_acesses;
- unsigned *m_num_trans_acesses;
- unsigned *m_num_mem_acesses;
+ double *m_num_ialu_acesses;
+ double *m_num_fp_acesses;
+ double *m_num_imul_acesses;
+ double *m_num_fpmul_acesses;
+ double *m_num_idiv_acesses;
+ double *m_num_fpdiv_acesses;
+ double *m_num_sp_acesses;
+ double *m_num_sfu_acesses;
+ double *m_num_tensor_core_acesses;
+ double *m_num_tex_acesses;
+ double *m_num_const_acesses;
+ double *m_num_dp_acesses;
+ double *m_num_dpmul_acesses;
+ double *m_num_dpdiv_acesses;
+ double *m_num_sqrt_acesses;
+ double *m_num_log_acesses;
+ double *m_num_sin_acesses;
+ double *m_num_exp_acesses;
+ double *m_num_mem_acesses;
unsigned *m_num_sp_committed;
unsigned *m_num_tlb_hits;
unsigned *m_num_tlb_accesses;
@@ -1730,13 +1739,15 @@ struct shader_core_stats_pod {
unsigned *m_read_regfile_acesses;
unsigned *m_write_regfile_acesses;
unsigned *m_non_rf_operands;
- unsigned *m_num_imul24_acesses;
- unsigned *m_num_imul32_acesses;
+ double *m_num_imul24_acesses;
+ double *m_num_imul32_acesses;
unsigned *m_active_sp_lanes;
unsigned *m_active_sfu_lanes;
unsigned *m_active_tensor_core_lanes;
unsigned *m_active_fu_lanes;
unsigned *m_active_fu_mem_lanes;
+ double *m_active_exu_threads; //For power model
+ double *m_active_exu_warps; //For power model
unsigned *m_n_diverge; // number of divergence occurring in this shader
unsigned gpgpu_n_load_insn;
unsigned gpgpu_n_store_insn;
@@ -1807,38 +1818,56 @@ class shader_core_stats : public shader_core_stats_pod {
(unsigned *)calloc(config->num_shader(), sizeof(unsigned));
m_num_loadqueued_insn =
(unsigned *)calloc(config->num_shader(), sizeof(unsigned));
+ m_num_tex_inst =
+ (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
m_num_INTdecoded_insn =
(unsigned *)calloc(config->num_shader(), sizeof(unsigned));
m_num_ialu_acesses =
- (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
+ (double *)calloc(config->num_shader(), sizeof(double));
m_num_fp_acesses =
- (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
- m_num_tex_inst = (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
+ (double *)calloc(config->num_shader(), sizeof(double));
m_num_imul_acesses =
- (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
+ (double *)calloc(config->num_shader(), sizeof(double));
m_num_imul24_acesses =
- (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
+ (double *)calloc(config->num_shader(), sizeof(double));
m_num_imul32_acesses =
- (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
+ (double *)calloc(config->num_shader(), sizeof(double));
m_num_fpmul_acesses =
- (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
+ (double *)calloc(config->num_shader(), sizeof(double));
m_num_idiv_acesses =
- (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
+ (double *)calloc(config->num_shader(), sizeof(double));
m_num_fpdiv_acesses =
- (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
+ (double *)calloc(config->num_shader(), sizeof(double));
+ m_num_dp_acesses =
+ (double*) calloc(config->num_shader(),sizeof(double));
+ m_num_dpmul_acesses =
+ (double*) calloc(config->num_shader(),sizeof(double));
+ m_num_dpdiv_acesses =
+ (double*) calloc(config->num_shader(),sizeof(double));
m_num_sp_acesses =
- (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
+ (double *)calloc(config->num_shader(), sizeof(double));
m_num_sfu_acesses =
- (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
- m_num_tensor_core_acesses =
- (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
- m_num_trans_acesses =
- (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
+ (double *)calloc(config->num_shader(), sizeof(double));
+ m_num_tensor_core_acesses =
+ (double *)calloc(config->num_shader(), sizeof(double));
+ m_num_const_acesses =
+ (double *)calloc(config->num_shader(), sizeof(double));
+ m_num_tex_acesses =
+ (double *)calloc(config->num_shader(), sizeof(double));
+ m_num_sqrt_acesses =
+ (double*) calloc(config->num_shader(),sizeof(double));
+ m_num_log_acesses =
+ (double*) calloc(config->num_shader(),sizeof(double));
+ m_num_sin_acesses =
+ (double*) calloc(config->num_shader(),sizeof(double));
+ m_num_exp_acesses =
+ (double*) calloc(config->num_shader(),sizeof(double));
m_num_mem_acesses =
- (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
+ (double *)calloc(config->num_shader(), sizeof(double));
m_num_sp_committed =
(unsigned *)calloc(config->num_shader(), sizeof(unsigned));
- m_num_tlb_hits = (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
+ m_num_tlb_hits =
+ (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
m_num_tlb_accesses =
(unsigned *)calloc(config->num_shader(), sizeof(unsigned));
m_active_sp_lanes =
@@ -1849,6 +1878,10 @@ class shader_core_stats : public shader_core_stats_pod {
(unsigned *)calloc(config->num_shader(), sizeof(unsigned));
m_active_fu_lanes =
(unsigned *)calloc(config->num_shader(), sizeof(unsigned));
+ m_active_exu_threads =
+ (double *)calloc(config->num_shader(), sizeof(double));
+ m_active_exu_warps =
+ (double *)calloc(config->num_shader(), sizeof(double));
m_active_fu_mem_lanes =
(unsigned *)calloc(config->num_shader(), sizeof(unsigned));
m_num_sfu_committed =
@@ -1863,7 +1896,8 @@ class shader_core_stats : public shader_core_stats_pod {
(unsigned *)calloc(config->num_shader(), sizeof(unsigned));
m_non_rf_operands =
(unsigned *)calloc(config->num_shader(), sizeof(unsigned));
- m_n_diverge = (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
+ m_n_diverge =
+ (unsigned *)calloc(config->num_shader(), sizeof(unsigned));
shader_cycle_distro =
(unsigned *)calloc(config->warp_size + 3, sizeof(unsigned));
last_shader_cycle_distro =
@@ -1892,6 +1926,48 @@ class shader_core_stats : public shader_core_stats_pod {
delete m_incoming_traffic_stats;
free(m_num_sim_insn);
free(m_num_sim_winsn);
+ free(m_num_FPdecoded_insn);
+ free(m_num_INTdecoded_insn);
+ free(m_num_storequeued_insn);
+ free(m_num_loadqueued_insn);
+ free(m_num_ialu_acesses);
+ free(m_num_fp_acesses);
+ free(m_num_imul_acesses);
+ free(m_num_tex_inst);
+ free(m_num_fpmul_acesses);
+ free(m_num_idiv_acesses);
+ free(m_num_fpdiv_acesses);
+ free(m_num_sp_acesses);
+ free(m_num_sfu_acesses);
+ free(m_num_tensor_core_acesses);
+ free(m_num_tex_acesses);
+ free(m_num_const_acesses);
+ free(m_num_dp_acesses);
+ free(m_num_dpmul_acesses);
+ free(m_num_dpdiv_acesses);
+ free(m_num_sqrt_acesses);
+ free(m_num_log_acesses);
+ free(m_num_sin_acesses);
+ free(m_num_exp_acesses);
+ free(m_num_mem_acesses);
+ free(m_num_sp_committed);
+ free(m_num_tlb_hits);
+ free(m_num_tlb_accesses);
+ free(m_num_sfu_committed);
+ free(m_num_tensor_core_committed);
+ free(m_num_mem_committed);
+ free(m_read_regfile_acesses);
+ free(m_write_regfile_acesses);
+ free(m_non_rf_operands);
+ free(m_num_imul24_acesses);
+ free(m_num_imul32_acesses);
+ free(m_active_sp_lanes);
+ free(m_active_sfu_lanes);
+ free(m_active_tensor_core_lanes);
+ free(m_active_fu_lanes);
+ free(m_active_exu_threads);
+ free(m_active_exu_warps);
+ free(m_active_fu_mem_lanes);
free(m_n_diverge);
free(shader_cycle_distro);
free(last_shader_cycle_distro);
@@ -1996,7 +2072,7 @@ class shader_core_ctx : public core_t {
printf("GPGPU-Sim uArch: Shader %d bind to kernel %u \'%s\'\n", m_sid,
m_kernel->get_uid(), m_kernel->name().c_str());
}
-
+ PowerscalingCoefficients *scaling_coeffs;
// accessors
bool fetch_unit_response_buffer_full() const;
bool ldst_unit_response_buffer_full() const;
@@ -2054,119 +2130,206 @@ class shader_core_ctx : public core_t {
void incload_stat() { m_stats->m_num_loadqueued_insn[m_sid]++; }
void incstore_stat() { m_stats->m_num_storequeued_insn[m_sid]++; }
- void incialu_stat(unsigned active_count, double latency) {
- if (m_config->gpgpu_clock_gated_lanes == false) {
- m_stats->m_num_ialu_acesses[m_sid] =
- m_stats->m_num_ialu_acesses[m_sid] + active_count * latency +
- inactive_lanes_accesses_nonsfu(active_count, latency);
- } else {
- m_stats->m_num_ialu_acesses[m_sid] =
- m_stats->m_num_ialu_acesses[m_sid] + active_count * latency;
+ void incialu_stat(unsigned active_count,double latency) {
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_ialu_acesses[m_sid]=m_stats->m_num_ialu_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_nonsfu(active_count, latency);
+ }else {
+ m_stats->m_num_ialu_acesses[m_sid]=m_stats->m_num_ialu_acesses[m_sid]+(double)active_count*latency;
}
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
}
- void inctex_stat(unsigned active_count, double latency) {
- m_stats->m_num_tex_inst[m_sid] =
- m_stats->m_num_tex_inst[m_sid] + active_count * latency;
- }
- void incimul_stat(unsigned active_count, double latency) {
- if (m_config->gpgpu_clock_gated_lanes == false) {
- m_stats->m_num_imul_acesses[m_sid] =
- m_stats->m_num_imul_acesses[m_sid] + active_count * latency +
- inactive_lanes_accesses_nonsfu(active_count, latency);
- } else {
- m_stats->m_num_imul_acesses[m_sid] =
- m_stats->m_num_imul_acesses[m_sid] + active_count * latency;
+ void incimul_stat(unsigned active_count,double latency) {
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_imul_acesses[m_sid]=m_stats->m_num_imul_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_nonsfu(active_count, latency);
+ }else {
+ m_stats->m_num_imul_acesses[m_sid]=m_stats->m_num_imul_acesses[m_sid]+(double)active_count*latency;
}
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
}
- void incimul24_stat(unsigned active_count, double latency) {
- if (m_config->gpgpu_clock_gated_lanes == false) {
- m_stats->m_num_imul24_acesses[m_sid] =
- m_stats->m_num_imul24_acesses[m_sid] + active_count * latency +
- inactive_lanes_accesses_nonsfu(active_count, latency);
- } else {
- m_stats->m_num_imul24_acesses[m_sid] =
- m_stats->m_num_imul24_acesses[m_sid] + active_count * latency;
+ void incimul24_stat(unsigned active_count,double latency) {
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_imul24_acesses[m_sid]=m_stats->m_num_imul24_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_nonsfu(active_count, latency);
+ }else {
+ m_stats->m_num_imul24_acesses[m_sid]=m_stats->m_num_imul24_acesses[m_sid]+(double)active_count*latency;
+ }
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
+ }
+ void incimul32_stat(unsigned active_count,double latency) {
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_imul32_acesses[m_sid]=m_stats->m_num_imul32_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_sfu(active_count, latency);
+ }else{
+ m_stats->m_num_imul32_acesses[m_sid]=m_stats->m_num_imul32_acesses[m_sid]+(double)active_count*latency;
}
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
}
- void incimul32_stat(unsigned active_count, double latency) {
- if (m_config->gpgpu_clock_gated_lanes == false) {
- m_stats->m_num_imul32_acesses[m_sid] =
- m_stats->m_num_imul32_acesses[m_sid] + active_count * latency +
- inactive_lanes_accesses_sfu(active_count, latency);
- } else {
- m_stats->m_num_imul32_acesses[m_sid] =
- m_stats->m_num_imul32_acesses[m_sid] + active_count * latency;
+ void incidiv_stat(unsigned active_count,double latency) {
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_idiv_acesses[m_sid]=m_stats->m_num_idiv_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_sfu(active_count, latency);
+ }else {
+ m_stats->m_num_idiv_acesses[m_sid]=m_stats->m_num_idiv_acesses[m_sid]+(double)active_count*latency;
}
- // printf("Int_Mul -- Active_count: %d\n",active_count);
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
}
- void incidiv_stat(unsigned active_count, double latency) {
- if (m_config->gpgpu_clock_gated_lanes == false) {
- m_stats->m_num_idiv_acesses[m_sid] =
- m_stats->m_num_idiv_acesses[m_sid] + active_count * latency +
- inactive_lanes_accesses_sfu(active_count, latency);
- } else {
- m_stats->m_num_idiv_acesses[m_sid] =
- m_stats->m_num_idiv_acesses[m_sid] + active_count * latency;
+ void incfpalu_stat(unsigned active_count,double latency) {
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_fp_acesses[m_sid]=m_stats->m_num_fp_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_nonsfu(active_count, latency);
+ }else {
+ m_stats->m_num_fp_acesses[m_sid]=m_stats->m_num_fp_acesses[m_sid]+(double)active_count*latency;
}
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
}
- void incfpalu_stat(unsigned active_count, double latency) {
- if (m_config->gpgpu_clock_gated_lanes == false) {
- m_stats->m_num_fp_acesses[m_sid] =
- m_stats->m_num_fp_acesses[m_sid] + active_count * latency +
- inactive_lanes_accesses_nonsfu(active_count, latency);
- } else {
- m_stats->m_num_fp_acesses[m_sid] =
- m_stats->m_num_fp_acesses[m_sid] + active_count * latency;
+ void incfpmul_stat(unsigned active_count,double latency) {
+ // printf("FP MUL stat increament\n");
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_fpmul_acesses[m_sid]=m_stats->m_num_fpmul_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_nonsfu(active_count, latency);
+ }else {
+ m_stats->m_num_fpmul_acesses[m_sid]=m_stats->m_num_fpmul_acesses[m_sid]+(double)active_count*latency;
+ }
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
+ }
+ void incfpdiv_stat(unsigned active_count,double latency) {
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_fpdiv_acesses[m_sid]=m_stats->m_num_fpdiv_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_sfu(active_count, latency);
+ }else {
+ m_stats->m_num_fpdiv_acesses[m_sid]=m_stats->m_num_fpdiv_acesses[m_sid]+(double)active_count*latency;
+ }
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
+ }
+ void incdpalu_stat(unsigned active_count,double latency) {
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_dp_acesses[m_sid]=m_stats->m_num_dp_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_nonsfu(active_count, latency);
+ }else {
+ m_stats->m_num_dp_acesses[m_sid]=m_stats->m_num_dp_acesses[m_sid]+(double)active_count*latency;
}
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
+ }
+ void incdpmul_stat(unsigned active_count,double latency) {
+ // printf("FP MUL stat increament\n");
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_dpmul_acesses[m_sid]=m_stats->m_num_dpmul_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_nonsfu(active_count, latency);
+ }else {
+ m_stats->m_num_dpmul_acesses[m_sid]=m_stats->m_num_dpmul_acesses[m_sid]+(double)active_count*latency;
+ }
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
+ }
+ void incdpdiv_stat(unsigned active_count,double latency) {
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_dpdiv_acesses[m_sid]=m_stats->m_num_dpdiv_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_sfu(active_count, latency);
+ }else {
+ m_stats->m_num_dpdiv_acesses[m_sid]=m_stats->m_num_dpdiv_acesses[m_sid]+(double)active_count*latency;
+ }
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
+ }
+
+ void incsqrt_stat(unsigned active_count,double latency) {
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_sqrt_acesses[m_sid]=m_stats->m_num_sqrt_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_sfu(active_count, latency);
+ }else{
+ m_stats->m_num_sqrt_acesses[m_sid]=m_stats->m_num_sqrt_acesses[m_sid]+(double)active_count*latency;
+ }
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
+ }
+
+ void inclog_stat(unsigned active_count,double latency) {
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_log_acesses[m_sid]=m_stats->m_num_log_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_sfu(active_count, latency);
+ }else{
+ m_stats->m_num_log_acesses[m_sid]=m_stats->m_num_log_acesses[m_sid]+(double)active_count*latency;
+ }
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
+ }
+
+ void incexp_stat(unsigned active_count,double latency) {
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_exp_acesses[m_sid]=m_stats->m_num_exp_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_sfu(active_count, latency);
+ }else{
+ m_stats->m_num_exp_acesses[m_sid]=m_stats->m_num_exp_acesses[m_sid]+(double)active_count*latency;
+ }
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
}
- void incfpmul_stat(unsigned active_count, double latency) {
- // printf("FP MUL stat increament\n");
- if (m_config->gpgpu_clock_gated_lanes == false) {
- m_stats->m_num_fpmul_acesses[m_sid] =
- m_stats->m_num_fpmul_acesses[m_sid] + active_count * latency +
- inactive_lanes_accesses_nonsfu(active_count, latency);
- } else {
- m_stats->m_num_fpmul_acesses[m_sid] =
- m_stats->m_num_fpmul_acesses[m_sid] + active_count * latency;
+
+ void incsin_stat(unsigned active_count,double latency) {
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_sin_acesses[m_sid]=m_stats->m_num_sin_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_sfu(active_count, latency);
+ }else{
+ m_stats->m_num_sin_acesses[m_sid]=m_stats->m_num_sin_acesses[m_sid]+(double)active_count*latency;
}
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
}
- void incfpdiv_stat(unsigned active_count, double latency) {
- if (m_config->gpgpu_clock_gated_lanes == false) {
- m_stats->m_num_fpdiv_acesses[m_sid] =
- m_stats->m_num_fpdiv_acesses[m_sid] + active_count * latency +
- inactive_lanes_accesses_sfu(active_count, latency);
- } else {
- m_stats->m_num_fpdiv_acesses[m_sid] =
- m_stats->m_num_fpdiv_acesses[m_sid] + active_count * latency;
+
+
+ void inctensor_stat(unsigned active_count,double latency) {
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_tensor_core_acesses[m_sid]=m_stats->m_num_tensor_core_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_sfu(active_count, latency);
+ }else{
+ m_stats->m_num_tensor_core_acesses[m_sid]=m_stats->m_num_tensor_core_acesses[m_sid]+(double)active_count*latency;
}
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
}
- void inctrans_stat(unsigned active_count, double latency) {
- if (m_config->gpgpu_clock_gated_lanes == false) {
- m_stats->m_num_trans_acesses[m_sid] =
- m_stats->m_num_trans_acesses[m_sid] + active_count * latency +
- inactive_lanes_accesses_sfu(active_count, latency);
- } else {
- m_stats->m_num_trans_acesses[m_sid] =
- m_stats->m_num_trans_acesses[m_sid] + active_count * latency;
+
+ void inctex_stat(unsigned active_count,double latency) {
+ if(m_config->gpgpu_clock_gated_lanes==false){
+ m_stats->m_num_tex_acesses[m_sid]=m_stats->m_num_tex_acesses[m_sid]+(double)active_count*latency
+ + inactive_lanes_accesses_sfu(active_count, latency);
+ }else{
+ m_stats->m_num_tex_acesses[m_sid]=m_stats->m_num_tex_acesses[m_sid]+(double)active_count*latency;
}
+ m_stats->m_active_exu_threads[m_sid]+=active_count;
+ m_stats->m_active_exu_warps[m_sid]++;
+ }
+
+ void inc_const_accesses(unsigned active_count) {
+ m_stats->m_num_const_acesses[m_sid]=m_stats->m_num_const_acesses[m_sid]+active_count;
}
void incsfu_stat(unsigned active_count, double latency) {
m_stats->m_num_sfu_acesses[m_sid] =
- m_stats->m_num_sfu_acesses[m_sid] + active_count * latency;
+ m_stats->m_num_sfu_acesses[m_sid] + (double)active_count*latency;
}
void incsp_stat(unsigned active_count, double latency) {
m_stats->m_num_sp_acesses[m_sid] =
- m_stats->m_num_sp_acesses[m_sid] + active_count * latency;
+ m_stats->m_num_sp_acesses[m_sid] + (double)active_count*latency;
}
void incmem_stat(unsigned active_count, double latency) {
if (m_config->gpgpu_clock_gated_lanes == false) {
m_stats->m_num_mem_acesses[m_sid] =
- m_stats->m_num_mem_acesses[m_sid] + active_count * latency +
+ m_stats->m_num_mem_acesses[m_sid] + (double)active_count*latency +
inactive_lanes_accesses_nonsfu(active_count, latency);
} else {
m_stats->m_num_mem_acesses[m_sid] =
- m_stats->m_num_mem_acesses[m_sid] + active_count * latency;
+ m_stats->m_num_mem_acesses[m_sid] + (double)active_count*latency;
}
}
void incexecstat(warp_inst_t *&inst);
diff --git a/src/gpgpu-sim/stat-tool.cc b/src/gpgpu-sim/stat-tool.cc
index 6fafaa6..0513d17 100644
--- a/src/gpgpu-sim/stat-tool.cc
+++ b/src/gpgpu-sim/stat-tool.cc
@@ -369,8 +369,6 @@ void shader_mem_lat_print(FILE *fout) {
static int s_cache_access_logger_n_types = 0;
static std::vector<linear_histogram_logger> s_cache_access_logger;
-enum cache_access_logger_types { NORMALS, TEXTURE, CONSTANT, INSTRUCTION };
-
int get_shader_normal_cache_id() { return NORMALS; }
int get_shader_texture_cache_id() { return TEXTURE; }
int get_shader_constant_cache_id() { return CONSTANT; }
diff --git a/src/gpgpu-sim/stat-tool.h b/src/gpgpu-sim/stat-tool.h
index 3a291be..fdf8756 100644
--- a/src/gpgpu-sim/stat-tool.h
+++ b/src/gpgpu-sim/stat-tool.h
@@ -268,6 +268,8 @@ class linear_histogram_logger : public snap_shot_trigger,
static int s_ids;
};
+enum cache_access_logger_types { NORMALS, TEXTURE, CONSTANT, INSTRUCTION };
+
void try_snap_shot(unsigned long long current_cycle);
void set_spill_interval(unsigned long long interval);
void spill_log_to_file(FILE *fout, int final, unsigned long long current_cycle);