summaryrefslogtreecommitdiff
path: root/src/gpgpu-sim/shader.cc
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/shader.cc
parent4a4fc87a2dcd95bfe298f2b3d18a9833a506e499 (diff)
AccelWattch dev Integration
Diffstat (limited to 'src/gpgpu-sim/shader.cc')
-rw-r--r--src/gpgpu-sim/shader.cc94
1 files changed, 59 insertions, 35 deletions
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 {