Skip to content

Commit

Permalink
End the indirect jump when potential hotspot is detected
Browse files Browse the repository at this point in the history
Currently, the indirect jump does not switch to T1C when potential
hotspot is detected, it would make execution stuck in interpreter mode.
This modification make execution end when potential hotspot is detected.
  • Loading branch information
qwe661234 committed Mar 4, 2024
1 parent 7ebe625 commit c5625e8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/rv32_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ RVOP(
for (int i = 0; i < HISTORY_SIZE; i++) { \
if (ir->branch_table->PC[i] == PC) { \
ir->branch_table->times[i]++; \
MUST_TAIL return block->ir_head->impl(rv, block->ir_head, \
cycle, PC); \
if (cache_hot(rv->block_cache, PC)) \
goto end_insn; \
} \
} \
/* update branch history table */ \
Expand All @@ -243,6 +243,8 @@ RVOP(
} \
ir->branch_table->times[min_idx] = 1; \
ir->branch_table->PC[min_idx] = PC; \
if (cache_hot(rv->block_cache, PC)) \
goto end_insn; \
MUST_TAIL return block->ir_head->impl(rv, block->ir_head, cycle, PC); \
}
#endif
Expand All @@ -267,6 +269,7 @@ RVOP(
RV_EXC_MISALIGN_HANDLER(pc, insn, false, 0);
#endif
LOOKUP_OR_UPDATE_BRANCH_HISTORY_TABLE();
end_insn:
rv->csr_cycle = cycle;
rv->PC = PC;
return true;
Expand Down Expand Up @@ -2286,6 +2289,7 @@ RVOP(
{
PC = rv->X[ir->rs1];
LOOKUP_OR_UPDATE_BRANCH_HISTORY_TABLE();
end_insn:
rv->csr_cycle = cycle;
rv->PC = PC;
return true;
Expand Down Expand Up @@ -2338,6 +2342,7 @@ RVOP(
rv->X[rv_reg_ra] = PC + 2;
PC = jump_to;
LOOKUP_OR_UPDATE_BRANCH_HISTORY_TABLE();
end_insn:
rv->csr_cycle = cycle;
rv->PC = PC;
return true;
Expand Down

1 comment on commit c5625e8

@jserv
Copy link
Contributor

@jserv jserv commented on c5625e8 Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmarks

Benchmark suite Current: c5625e8 Previous: dfdadc8 Ratio
Dhrystone 1638.55 Average DMIPS over 10 runs 1572 Average DMIPS over 10 runs 0.96
Coremark 1505.072 Average iterations/sec over 10 runs 1500.847 Average iterations/sec over 10 runs 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.