Skip to content

Top-Down Methodology #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: fdp-develop
Choose a base branch
from
Draft

Top-Down Methodology #10

wants to merge 7 commits into from

Conversation

cosmiclat05
Copy link
Collaborator

No description provided.

@cosmiclat05 cosmiclat05 requested a review from dhschall June 6, 2025 16:41
dhschall pushed a commit that referenced this pull request Jun 10, 2025
…#2346)

For a number of common instructions, gem5's built-in ARM disassembler
doesn't print the instruction operands. This can be a bit of a headache
when you don't want to use libcapstone, and are looking at instruction
traces.

Reproducer:

test.S
```
    .text
    .globl _start
_start:
    ldr x30, [sp]
    ldr x30, [sp], gem5#16
    str x30, [sp]
    str x30, [sp], gem5#16

    ldp x10, x20, [x30]
    stp x10, x20, [x30]
    ldp w10, w20, [x30]
    stp w10, w20, [x30]
    ldp x10, x20, [x30], #-8  // post-index, negative
    stp x10, x20, [x30, gem5#16]! // pre-index, write-back
    ldp w10, w20, [x30, gem5#32]  // pre-index, no write-back
    stp w10, w20, [x30], gem5#128 // post-index, positive

    dc zva, x17
    dc cvac, x17

    isb
    isb #10

    dsb nsh
    dsb sy
    dsb #8

    .long 0xff210110 // m5_op EXIT
```

```
# Build binary
aarch64-linux-gnu-gcc -c test.S -o test.o
aarch64-linux-gnu-ld -o test.arm64 test.o -N -Ttext 0x10 -static

# objdump disassembly
aarch64-linux-gnu-objdump -D test.arm64

# gem5 disassembly
./build/ARM/gem5.opt configs/example/arm/baremetal.py --tarmac-gen --kernel test.arm64 | grep ' IT '
```
Copy link
Owner

@dhschall dhschall left a comment

Choose a reason for hiding this comment

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

Thanks for already cleaning up things.

The main comment I have at the moment is formatting. Mainly indentation.

Check this: https://github.com/gem5/gem5/pull/2313/files
They will soon merge it. But you might be able to copy already the .clang-format in your gem5 dir and then run git clang-format.

"Backend Bound, fraction of slots lost due to backend resource "
"constraints."),
ADD_STAT(
retiring,
Copy link
Owner

Choose a reason for hiding this comment

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

Can you format it as done above

ADD_STAT(fetchLatency,
statistics::units::Rate<statistics::units::Count,
statistics::units::Count>::get(),
"Fetch Latency Bound, frontend stalls due to instruction cache "
Copy link
Owner

Choose a reason for hiding this comment

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

Its not only instruction cache but also TLB and BTB

cpu->cpuStats.topDownStats.topDownL1.frontendBound - fetchLatency;
}

// CPU::CPUStats::TopDownStats::TopDownFrontendBoundL2::TopDownFrontendBoundL2(CPU
Copy link
Owner

Choose a reason for hiding this comment

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

Is that not ready or why is it commented?

statistics::units::Count>::get(),
"Core Bound, backend stalls due to functional unit constraints") {
// Backend L2
executionStalls = (cpu->iew.instQueue.getStats().numInstsExec0 -
Copy link
Owner

Choose a reason for hiding this comment

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

This is not properly indented. Should be consistent. 4 spaces.
Same in the lines below and a lot of other places

statistics::units::Count>::get(),
"Store Bound") {
// Backend Bound / Memory Bound L3
l1Bound = (cpu->iew.instQueue.getStats().loadStallCycles -
Copy link
Owner

Choose a reason for hiding this comment

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

Indentation

@@ -602,9 +615,11 @@ Decode::decode(bool &status_change, ThreadID tid)
// check if stall conditions have passed

if (decodeStatus[tid] == Blocked) {
++stats.blockedCycles;
fetchBubbles -= decodeWidth;
Copy link
Owner

Choose a reason for hiding this comment

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

Indentation

@@ -299,6 +299,8 @@ class Decode
*/
bool squashAfterDelaySlot[MaxThreads];

unsigned fetchBubbles = 0;
Copy link
Owner

Choose a reason for hiding this comment

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

IMHO it's redundant. Just use inst_availabe

@@ -180,47 +180,58 @@ InstructionQueue::name() const
InstructionQueue::IQStats::IQStats(CPU *cpu, const unsigned &total_width)
: statistics::Group(cpu),
ADD_STAT(instsAdded, statistics::units::Count::get(),
"Number of instructions added to the IQ (excludes non-spec)"),
"Number of instructions added to the IQ (excludes non-spec)"),
Copy link
Owner

Choose a reason for hiding this comment

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

Can you revert that. Its not currently indented and not part of your PR

.flags(statistics::pdf);
idleRate
.prereq(idleRate);
ADD_STAT(predictedBranches, statistics::units::Count::get(),
Copy link
Owner

Choose a reason for hiding this comment

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

Why did that change? Most of it is still the same.

ADD_STAT(fetchBubblesMax, statistics::units::Count::get(),
"Stat for Top-Down Methodology, number of cycles in which no "
"instructions are delivered to backend") {
predictedBranches.prereq(predictedBranches);
Copy link
Owner

Choose a reason for hiding this comment

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

Wrong indentation

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.

2 participants