ithemal / bhive

MIT License
35 stars 12 forks source link

Cycles for no op too high? #12

Open anilavakundu opened 2 years ago

anilavakundu commented 2 years ago

Hi I was testing the timing harness script

I was looking at the output cycles for a no-op instruction (hex equivalent of 90)

The following is the output that I am getting

mmap aux mem: Success
L1 READ IDX = 1
L1 WRITE IDX = 1
ICACHE IDX = 2
mprotect: Success
mprotect: Success
bad inst is at 0x557d55c9612b, signal = 11
VAL OF RSP = 0x2324800
RESTARTING AT 0x557d55c9509d, fault addr = 0x2324800
get regs: Bad file descriptor
set regs: Bad file descriptor
cont: Bad file descriptor
bad inst is at 0x557d55c96014, signal = 11
VAL OF RSP = 0x2324800
RESTARTING AT 0x557d55c95063, fault addr = 0x700000000000
get regs: Bad file descriptor
set regs: Bad file descriptor
cont: Bad file descriptor
Core_cyc    L1_read_misses  L1_write_misses iCache_misses   Context_switches
828 20  -1  1   0
721 0   -1  0   0
722 0   -1  0   0
724 0   -1  0   0
722 0   -1  0   0
722 0   -1  0   0
723 0   -1  0   0
722 0   -1  0   0
725 0   -1  0   0
724 0   -1  0   0
724 0   -1  0   0
723 0   -1  0   0
722 0   -1  0   0
721 0   -1  0   0
722 0   -1  0   0

Why is the cycles for a no-op instruction this high? Am I doing something wrong?

AjayBrahmakshatriya commented 2 years ago

Hi @anilavakundu thanks a lot for trying out the BHive testing harness. If I understand correctly the result you have copied is from the command - ?

./test 90 200 (or 100)

This is not the complete procedure to measure the throughput for an instruction. You should measure the average cycles for 100 and 200 iterations. Then take the difference and divide by 100.

This is documented in the README in the timing-harness directory - https://github.com/ithemal/bhive/blob/master/timing-harness/README.md

# We calculate the throughput as follows. $ python <(echo 'print "Throughput:", (891.0 - 791.0)/100') Throughput: 1.00

Hope this helps