Skip to content

fix(shader): correct pI1→pI2 variable in dual-issue decode stats#338

Open
eunseo9311 wants to merge 1 commit intogpgpu-sim:devfrom
eunseo9311:fix/decode-dual-issue-stat-pI2
Open

fix(shader): correct pI1→pI2 variable in dual-issue decode stats#338
eunseo9311 wants to merge 1 commit intogpgpu-sim:devfrom
eunseo9311:fix/decode-dual-issue-stat-pI2

Conversation

@eunseo9311
Copy link
Copy Markdown

@eunseo9311 eunseo9311 commented Mar 25, 2026

Summary

Fix an incorrect variable reference in shader_core_ctx::decode() that causes wrong instruction type statistics to be recorded for the second instruction in dual-issue scenarios.

Problem

In shader.cc lines 911–912, the operand type check for the second decoded instruction (pI2) incorrectly references pI1:

// Before (buggy)
if ((pI1->oprnd_type == INT_OP) ||
    (pI1->oprnd_type == UN_OP)) {   // ← should be pI2
    m_stats->m_num_INTdecoded_insn[m_sid]++;
} else if (pI2->oprnd_type == FP_OP) {
    m_stats->m_num_FPdecoded_insn[m_sid]++;
}

This causes m_num_INTdecoded_insn to be incremented based on pI1's operand type when classifying pI2, silently producing incorrect decode statistics for dual-issued instructions. The bug is latent — it only manifests when both instructions are decoded in the same cycle and their operand types differ.

Fix

// After
if ((pI2->oprnd_type == INT_OP) ||
    (pI2->oprnd_type == UN_OP)) {
    m_stats->m_num_INTdecoded_insn[m_sid]++;
} else if (pI2->oprnd_type == FP_OP) {
    m_stats->m_num_FPdecoded_insn[m_sid]++;
}

Impact

  • No behavioral change to simulation execution — only statistics counters are affected
  • Simulation output (IPC, memory access patterns, functional correctness) is unchanged
  • Decode statistics (m_num_INTdecoded_insn, m_num_FPdecoded_insn) will now correctly reflect the second instruction's operand type in dual-issue scenarios
  • These counters feed into McPAT/AccelWattch for scheduler power estimation

Testing

Verified with Rodinia 2.0 hotspot benchmark on GTX1080Ti config. Simulation output log is identical; only per-SM decode stat counters change for workloads with dual-issued mixed INT/FP instruction pairs.

source setup_environment release
make -j
# Run any CUDA workload with dual-issue enabled and inspect
# gpgpu_stats output for m_num_INTdecoded_insn / m_num_FPdecoded_insn

In shader_core_ctx::decode() (shader.cc:911-912), the operand type
check for the second decoded instruction incorrectly referenced pI1
instead of pI2, causing m_num_INTdecoded_insn to be updated based
on the first instruction's type when classifying the second.

The bug is latent: it only triggers when two instructions are decoded
in the same cycle with differing operand types (e.g., one INT, one FP).
Simulation behavior is unaffected; only decode statistics are corrected.
@eunseo9311 eunseo9311 force-pushed the fix/decode-dual-issue-stat-pI2 branch from 8d76c4f to e495815 Compare March 25, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant