$ llvm-mca -mcpu=alderlake bin/03_llvm_mca.s | grep -E '^\[|Iterations|Total Cycles|IPC|Block RThroughput'
[0] Code Region - chain1
Iterations: 100 Total Cycles: 603
IPC: 0.33 Block RThroughput: 1.0
[1] Code Region - chain4
Iterations: 100 Total Cycles: 606
IPC: 1.32 Block RThroughput: 4.0Read it: chain1 needs 603 cycles for 100 iterations = 6.0 cycles per element, although its Block RThroughput (the port limit) is 1.0: the loop is LATENCY-bound six times over. chain4 processes 4 elements in the same 6.06 cycles = 1.5 cycles per element: the four chains overlap.
$ llvm-mca -mcpu=alderlake -timeline -iterations=3 bin/03_llvm_mca.s (chain1 region)
Instruction Info:
[1] [2] [3] [4] [5] [6] Instructions:
1 3 1.00 imulq %rdx, %rax
2 6 0.33 * addq (%rdi,%rcx,8), %rax
Timeline view:
[0,0] DeeeER . . . imulq %rdx, %rax
[0,1] DeeeeeeER . . . addq (%rdi,%rcx,8), %rax
[1,0] D======eeeER . . imulq %rdx, %rax
[1,1] D======eeeeeeER. . addq (%rdi,%rcx,8), %rax
[2,0] .D===========eeeER . imulq %rdx, %raxRead it: D = dispatched, e = executing, E = executed, = = waiting on a dependency. Iteration 1's imul waits (======) for iteration 0's add: the chain through %rax. Latency column: imul 3, add-from-memory 6.