summaryrefslogtreecommitdiff
path: root/src/gpgpu-sim/gpu-sim.cc
diff options
context:
space:
mode:
authorJRPan <[email protected]>2023-05-10 14:57:09 -0400
committerGitHub <[email protected]>2023-05-10 14:57:09 -0400
commit57aa5ab28bdcb59b32762bd746586824707282eb (patch)
treec8ab3b5ed3660283b9f95ec63cb620331aac94a7 /src/gpgpu-sim/gpu-sim.cc
parentda6a16a990a007edb7a760a2eb5b9b48ccc06e4c (diff)
parent948c0e1a0e379e37e60c83b9ab622217522aea86 (diff)
Merge branch 'dev' into fix_different_latencies_to_same_ex_unit
Diffstat (limited to 'src/gpgpu-sim/gpu-sim.cc')
-rw-r--r--src/gpgpu-sim/gpu-sim.cc195
1 files changed, 162 insertions, 33 deletions
diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc
index 1650688..5af244b 100644
--- a/src/gpgpu-sim/gpu-sim.cc
+++ b/src/gpgpu-sim/gpu-sim.cc
@@ -1,19 +1,21 @@
-// 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,
+// Mahmoud Khairy, Junrui Pan, Timothy G. Rogers
+// The University of British Columbia, Northwestern University, Purdue 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 +97,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 +111,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,
@@ -249,6 +338,8 @@ void shader_core_config::reg_options(class OptionParser *opp) {
" {<nsets>:<bsize>:<assoc>,<rep>:<wr>:<alloc>:<wr_"
"alloc>,<mshr>:<N>:<merge>,<mq> | none}",
"none");
+ option_parser_register(opp, "-gpgpu_l1_cache_write_ratio", OPT_UINT32,
+ &m_L1D_config.m_wr_percent, "L1D write ratio", "0");
option_parser_register(opp, "-gpgpu_l1_banks", OPT_UINT32,
&m_L1D_config.l1_banks, "The number of L1 cache banks",
"1");
@@ -304,7 +395,7 @@ void shader_core_config::reg_options(class OptionParser *opp) {
"gpgpu_ignore_resources_limitation (default 0)", "0");
option_parser_register(
opp, "-gpgpu_shader_cta", OPT_UINT32, &max_cta_per_core,
- "Maximum number of concurrent CTAs in shader (default 8)", "8");
+ "Maximum number of concurrent CTAs in shader (default 32)", "32");
option_parser_register(
opp, "-gpgpu_num_cta_barriers", OPT_UINT32, &max_barriers_per_cta,
"Maximum number of named barriers per CTA (default 16)", "16");
@@ -326,7 +417,14 @@ void shader_core_config::reg_options(class OptionParser *opp) {
option_parser_register(
opp, "-gpgpu_shmem_size", OPT_UINT32, &gpgpu_shmem_size,
"Size of shared memory per shader core (default 16kB)", "16384");
- option_parser_register(opp, "-gpgpu_adaptive_cache_config", OPT_UINT32,
+ option_parser_register(opp, "-gpgpu_shmem_option", OPT_CSTR,
+ &gpgpu_shmem_option,
+ "Option list of shared memory sizes", "0");
+ option_parser_register(
+ opp, "-gpgpu_unified_l1d_size", OPT_UINT32,
+ &m_L1D_config.m_unified_cache_size,
+ "Size of unified data cache(L1D + shared memory) in KB", "0");
+ option_parser_register(opp, "-gpgpu_adaptive_cache_config", OPT_BOOL,
&adaptive_cache_config, "adaptive_cache_config", "0");
option_parser_register(
opp, "-gpgpu_shmem_sizeDefault", OPT_UINT32, &gpgpu_shmem_sizeDefault,
@@ -603,7 +701,8 @@ void gpgpu_sim_config::reg_options(option_parser_t opp) {
"500.0:2000.0:2000.0:2000.0");
option_parser_register(
opp, "-gpgpu_max_concurrent_kernel", OPT_INT32, &max_concurrent_kernel,
- "maximum kernels that can run concurrently on GPU", "8");
+ "maximum kernels that can run concurrently on GPU, set this value "
+ "according to max resident grids for your compute capability", "32");
option_parser_register(
opp, "-gpgpu_cflog_interval", OPT_INT32, &gpgpu_cflog_interval,
"Interval between each snapshot in control flow logger", "0");
@@ -826,7 +925,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);
@@ -1001,6 +1100,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++)
@@ -1026,14 +1133,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() {
@@ -1058,6 +1157,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();
@@ -1137,6 +1241,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;
@@ -1317,10 +1433,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
@@ -1514,9 +1640,9 @@ bool shader_core_ctx::occupy_shader_resource_1block(kernel_info_t &k,
SHADER_DPRINTF(LIVENESS,
"GPGPU-Sim uArch: Occupied %u threads, %u shared mem, %u "
- "registers, %u ctas\n",
+ "registers, %u ctas, on shader %d\n",
m_occupied_n_threads, m_occupied_shmem, m_occupied_regs,
- m_occupied_ctas);
+ m_occupied_ctas, m_sid);
}
return true;
@@ -1682,9 +1808,9 @@ void shader_core_ctx::issue_block2core(kernel_info_t &kernel) {
shader_CTA_count_log(m_sid, 1);
SHADER_DPRINTF(LIVENESS,
"GPGPU-Sim uArch: cta:%2u, start_tid:%4u, end_tid:%4u, "
- "initialized @(%lld,%lld)\n",
+ "initialized @(%lld,%lld), kernel_uid:%u, kernel_name:%s\n",
free_cta_hw_id, start_thread, end_thread, m_gpu->gpu_sim_cycle,
- m_gpu->gpu_tot_sim_cycle);
+ m_gpu->gpu_tot_sim_cycle, kernel.get_uid(), kernel.get_name().c_str());
}
///////////////////////////////////////////////////////////////////////////////////////////
@@ -1787,6 +1913,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]);
}
}
@@ -1830,7 +1957,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]);
@@ -1860,10 +1987,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