| Loop Id: 62 | Module: attention-clang-skl256 | Source: attention_v2.cpp:26-194 [...] | Coverage: 0.02% |
|---|
| Loop Id: 62 | Module: attention-clang-skl256 | Source: attention_v2.cpp:26-194 [...] | Coverage: 0.02% |
|---|
0x4030 MOV (%RSP),%R15 |
0x4034 INC %R15D |
0x4037 ADD %R12,%RCX |
0x403a CMP 0x40(%RSP),%R15D |
0x403f JE 41a0 |
0x4045 MOV %R15,(%RSP) |
0x4049 IMUL %R12D,%R15D |
0x404d XOR %ESI,%ESI |
0x404f JMP 4077 |
(63) 0x4060 VCVTSD2SS %XMM0,%XMM0,%XMM0 |
(63) 0x4064 LEA (%R15,%RSI,1),%EDI |
(63) 0x4068 VMOVSS %XMM0,(%RAX,%RDI,4) |
(63) 0x406d INC %RSI |
(63) 0x4070 CMP 0x28(%RSP),%RSI |
(63) 0x4075 JE 4030 |
(63) 0x4077 CMPL $0x3,0xb8(%RSP) |
(63) 0x407f JAE 4090 |
(63) 0x4081 VXORPS %XMM0,%XMM0,%XMM0 |
(63) 0x4085 XOR %EDI,%EDI |
(63) 0x4087 JMP 4159 |
(63) 0x4090 VXORPS %XMM0,%XMM0,%XMM0 |
(63) 0x4094 MOV %RSI,%R8 |
(63) 0x4097 XOR %EDI,%EDI |
(63) 0x4099 MOV 0x140(%RSP),%R10 |
(63) 0x40a1 MOV %R13,%RAX |
(63) 0x40a4 LEA (%R12,%R12,2),%R13 |
(63) 0x40a8 LEA (%R12,%R12,1),%RDX |
(63) 0x40ac NOPL (%RAX) |
(32) 0x40b0 LEA (%RCX,%RDI,1),%R9D |
(32) 0x40b4 VMOVSS (%R14,%R9,4),%XMM1 |
(32) 0x40ba VCVTSS2SD %XMM1,%XMM1,%XMM1 |
(32) 0x40be MOV %R8D,%R9D |
(32) 0x40c1 VMOVSS (%R11,%R9,4),%XMM2 |
(32) 0x40c7 VCVTSS2SD %XMM2,%XMM2,%XMM2 |
(32) 0x40cb LEA 0x1(%RCX,%RDI,1),%R9D |
(32) 0x40d0 VMOVSS (%R14,%R9,4),%XMM3 |
(32) 0x40d6 VCVTSS2SD %XMM3,%XMM3,%XMM3 |
(32) 0x40da LEA (%R12,%R8,1),%R9D |
(32) 0x40de VMOVSS (%R11,%R9,4),%XMM4 |
(32) 0x40e4 VCVTSS2SD %XMM4,%XMM4,%XMM4 |
(32) 0x40e8 LEA 0x2(%RCX,%RDI,1),%R9D |
(32) 0x40ed VMOVSS (%R14,%R9,4),%XMM5 |
(32) 0x40f3 VFMADD213SD %XMM0,%XMM1,%XMM2 |
(32) 0x40f8 VCVTSS2SD %XMM5,%XMM5,%XMM0 |
(32) 0x40fc LEA (%RDX,%R8,1),%R9D |
(32) 0x4100 VMOVSS (%R11,%R9,4),%XMM1 |
(32) 0x4106 VFMADD213SD %XMM2,%XMM3,%XMM4 |
(32) 0x410b VCVTSS2SD %XMM1,%XMM1,%XMM1 |
(32) 0x410f LEA 0x3(%RCX,%RDI,1),%R9D |
(32) 0x4114 VMOVSS (%R14,%R9,4),%XMM2 |
(32) 0x411a VFMADD213SD %XMM4,%XMM0,%XMM1 |
(32) 0x411f VCVTSS2SD %XMM2,%XMM2,%XMM2 |
(32) 0x4123 LEA (%R13,%R8,1),%R9D |
(32) 0x4128 VMOVSS (%R11,%R9,4),%XMM0 |
(32) 0x412e VCVTSS2SD %XMM0,%XMM0,%XMM0 |
(32) 0x4132 VFMADD213SD %XMM1,%XMM2,%XMM0 |
(32) 0x4137 ADD $0x4,%RDI |
(32) 0x413b ADD %RAX,%R8 |
(32) 0x413e CMP %RDI,%R10 |
(32) 0x4141 JNE 40b0 |
(63) 0x4147 TEST $0x3,%R12B |
(63) 0x414b MOV %RAX,%R13 |
(63) 0x414e MOV 0x30(%RSP),%RAX |
(63) 0x4153 JE 4060 |
(63) 0x4159 MOV %R12,%R8 |
(63) 0x415c IMUL %RDI,%R8 |
(63) 0x4160 ADD %RSI,%R8 |
(63) 0x4163 ADD %ECX,%EDI |
(63) 0x4165 MOV 0xb0(%RSP),%R9 |
(63) 0x416d NOPL (%RAX) |
(64) 0x4170 MOV %EDI,%R10D |
(64) 0x4173 VMOVSS (%R14,%R10,4),%XMM1 |
(64) 0x4179 VCVTSS2SD %XMM1,%XMM1,%XMM1 |
(64) 0x417d MOV %R8D,%R10D |
(64) 0x4180 VMOVSS (%R11,%R10,4),%XMM2 |
(64) 0x4186 VCVTSS2SD %XMM2,%XMM2,%XMM2 |
(64) 0x418a VFMADD231SD %XMM2,%XMM1,%XMM0 |
(64) 0x418f ADD %R12,%R8 |
(64) 0x4192 INC %EDI |
(64) 0x4194 DEC %R9 |
(64) 0x4197 JNE 4170 |
(63) 0x4199 JMP 4060 |
/home/eoseret/Applications/llm-attention/attention_v2.cpp: 26 - 194 |
-------------------------------------------------------------------------------- |
26: for (unsigned int i = 0; i < M; ++i) { |
27: for (unsigned int j = 0; j < N; ++j) { //vectorized |
28: double sum = 0.0; |
29: #pragma clang loop vectorize(enable) |
30: for (unsigned int k = 0; k < K; ++k) { //vectorized |
31: sum += (double)A[i * K + k] * (double)B[k * N + j]; |
32: } |
33: C[i * N + j] = alpha * static_cast<float>(sum); |
[...] |
194: start = std::chrono::steady_clock::now(); |
| Coverage (%) | Name | Source Location | Module |
|---|---|---|---|
| ►100.00+ | __libc_init_first | libc.so.6 | |
| ○ | __libc_start_main | libc.so.6 | |
| ○ | _start | attention-clang-skl256 |
| min | med | avg | max |
|---|---|---|---|
| Percentile Index | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100 |
|---|---|---|---|---|---|---|---|---|---|---|
| Value |
| min | med | avg | max |
|---|---|---|---|
| Percentile Index | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100 |
|---|---|---|---|---|---|---|---|---|---|---|
| Value |
| Path / |
| Metric | Value |
|---|---|
| CQA speedup if no scalar integer | 1.00 |
| CQA speedup if FP arith vectorized | 1.00 |
| CQA speedup if fully vectorized | 13.09 |
| CQA speedup if no inter-iteration dependency | NA |
| CQA speedup if next bottleneck killed | 1.29 |
| Bottlenecks | micro-operation queue, |
| Function | main |
| Source | attention_v2.cpp:26-26,attention_v2.cpp:194-194 |
| Source loop unroll info | NA |
| Source loop unroll confidence level | NA |
| Unroll/vectorization loop type | NA |
| Unroll factor | NA |
| CQA cycles | 2.25 |
| CQA cycles if no scalar integer | 2.25 |
| CQA cycles if FP arith vectorized | 2.25 |
| CQA cycles if fully vectorized | 0.17 |
| Front-end cycles | 2.25 |
| P0 cycles | 1.50 |
| P1 cycles | 1.75 |
| P2 cycles | 1.00 |
| P3 cycles | 1.00 |
| P4 cycles | 1.00 |
| P5 cycles | 1.50 |
| P6 cycles | 1.50 |
| P7 cycles | 1.00 |
| DIV/SQRT cycles | 0.00 |
| Inter-iter dependencies cycles | 0 |
| FE+BE cycles (UFS) | NA |
| Stall cycles (UFS) | NA |
| Nb insns | 9.00 |
| Nb uops | 9.00 |
| Nb loads | 2.00 |
| Nb stores | 1.00 |
| Nb stack references | 2.00 |
| FLOP/cycle | 0.00 |
| Nb FLOP add-sub | 0.00 |
| Nb FLOP mul | 0.00 |
| Nb FLOP fma | 0.00 |
| Nb FLOP div | 0.00 |
| Nb FLOP rcp | 0.00 |
| Nb FLOP sqrt | 0.00 |
| Nb FLOP rsqrt | 0.00 |
| Bytes/cycle | 8.89 |
| Bytes prefetched | 0.00 |
| Bytes loaded | 12.00 |
| Bytes stored | 8.00 |
| Stride 0 | 0.00 |
| Stride 1 | 0.00 |
| Stride n | 0.00 |
| Stride unknown | 2.00 |
| Stride indirect | 0.00 |
| Vectorization ratio all | 0.00 |
| Vectorization ratio load | NA |
| Vectorization ratio store | 0.00 |
| Vectorization ratio mul | NA |
| Vectorization ratio add_sub | 0.00 |
| Vectorization ratio fma | NA |
| Vectorization ratio div_sqrt | NA |
| Vectorization ratio other | 0.00 |
| Vector-efficiency ratio all | 10.42 |
| Vector-efficiency ratio load | NA |
| Vector-efficiency ratio store | 12.50 |
| Vector-efficiency ratio mul | NA |
| Vector-efficiency ratio add_sub | 12.50 |
| Vector-efficiency ratio fma | NA |
| Vector-efficiency ratio div_sqrt | NA |
| Vector-efficiency ratio other | 6.25 |
| Metric | Value |
|---|---|
| CQA speedup if no scalar integer | 1.00 |
| CQA speedup if FP arith vectorized | 1.00 |
| CQA speedup if fully vectorized | 13.09 |
| CQA speedup if no inter-iteration dependency | NA |
| CQA speedup if next bottleneck killed | 1.29 |
| Bottlenecks | micro-operation queue, |
| Function | main |
| Source | attention_v2.cpp:26-26,attention_v2.cpp:194-194 |
| Source loop unroll info | NA |
| Source loop unroll confidence level | NA |
| Unroll/vectorization loop type | NA |
| Unroll factor | NA |
| CQA cycles | 2.25 |
| CQA cycles if no scalar integer | 2.25 |
| CQA cycles if FP arith vectorized | 2.25 |
| CQA cycles if fully vectorized | 0.17 |
| Front-end cycles | 2.25 |
| P0 cycles | 1.50 |
| P1 cycles | 1.75 |
| P2 cycles | 1.00 |
| P3 cycles | 1.00 |
| P4 cycles | 1.00 |
| P5 cycles | 1.50 |
| P6 cycles | 1.50 |
| P7 cycles | 1.00 |
| DIV/SQRT cycles | 0.00 |
| Inter-iter dependencies cycles | 0 |
| FE+BE cycles (UFS) | NA |
| Stall cycles (UFS) | NA |
| Nb insns | 9.00 |
| Nb uops | 9.00 |
| Nb loads | 2.00 |
| Nb stores | 1.00 |
| Nb stack references | 2.00 |
| FLOP/cycle | 0.00 |
| Nb FLOP add-sub | 0.00 |
| Nb FLOP mul | 0.00 |
| Nb FLOP fma | 0.00 |
| Nb FLOP div | 0.00 |
| Nb FLOP rcp | 0.00 |
| Nb FLOP sqrt | 0.00 |
| Nb FLOP rsqrt | 0.00 |
| Bytes/cycle | 8.89 |
| Bytes prefetched | 0.00 |
| Bytes loaded | 12.00 |
| Bytes stored | 8.00 |
| Stride 0 | 0.00 |
| Stride 1 | 0.00 |
| Stride n | 0.00 |
| Stride unknown | 2.00 |
| Stride indirect | 0.00 |
| Vectorization ratio all | 0.00 |
| Vectorization ratio load | NA |
| Vectorization ratio store | 0.00 |
| Vectorization ratio mul | NA |
| Vectorization ratio add_sub | 0.00 |
| Vectorization ratio fma | NA |
| Vectorization ratio div_sqrt | NA |
| Vectorization ratio other | 0.00 |
| Vector-efficiency ratio all | 10.42 |
| Vector-efficiency ratio load | NA |
| Vector-efficiency ratio store | 12.50 |
| Vector-efficiency ratio mul | NA |
| Vector-efficiency ratio add_sub | 12.50 |
| Vector-efficiency ratio fma | NA |
| Vector-efficiency ratio div_sqrt | NA |
| Vector-efficiency ratio other | 6.25 |
| Path / |
| Function | main |
| Source file and lines | attention_v2.cpp:26-194 |
| Module | attention-clang-skl256 |
| nb instructions | 9 |
| nb uops | 9 |
| loop length | 33 |
| used x86 registers | 5 |
| used mmx registers | 0 |
| used xmm registers | 0 |
| used ymm registers | 0 |
| used zmm registers | 0 |
| nb stack references | 2 |
| micro-operation queue | 2.25 cycles |
| front end | 2.25 cycles |
| P0 | P1 | P2 | P3 | P4 | P5 | P6 | P7 | |
|---|---|---|---|---|---|---|---|---|
| uops | 1.50 | 1.50 | 1.00 | 1.00 | 1.00 | 1.50 | 1.50 | 1.00 |
| cycles | 1.50 | 1.75 | 1.00 | 1.00 | 1.00 | 1.50 | 1.50 | 1.00 |
| Cycles executing div or sqrt instructions | NA |
| Longest recurrence chain latency (RecMII) | 0.00 |
| Front-end | 2.25 |
| Dispatch | 1.75 |
| Data deps. | 0.00 |
| Overall L1 | 2.25 |
| all | 0% |
| load | NA (no load vectorizable/vectorized instructions) |
| store | 0% |
| mul | NA (no mul vectorizable/vectorized instructions) |
| add-sub | 0% |
| fma | NA (no fma vectorizable/vectorized instructions) |
| div/sqrt | NA (no div/sqrt vectorizable/vectorized instructions) |
| other | 0% |
| all | 10% |
| load | NA (no load vectorizable/vectorized instructions) |
| store | 12% |
| mul | NA (no mul vectorizable/vectorized instructions) |
| add-sub | 12% |
| fma | NA (no fma vectorizable/vectorized instructions) |
| div/sqrt | NA (no div/sqrt vectorizable/vectorized instructions) |
| other | 6% |
| Instruction | Nb FU | P0 | P1 | P2 | P3 | P4 | P5 | P6 | P7 | Latency | Recip. throughput | Vectorization |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| MOV (%RSP),%R15 | 1 | 0 | 0 | 0.50 | 0.50 | 0 | 0 | 0 | 0 | 4-5 | 0.50 | N/A |
| INC %R15D | 1 | 0.25 | 0.25 | 0 | 0 | 0 | 0.25 | 0.25 | 0 | 1 | 0.25 | N/A |
| ADD %R12,%RCX | 1 | 0.25 | 0.25 | 0 | 0 | 0 | 0.25 | 0.25 | 0 | 1 | 0.25 | scal (12.5%) |
| CMP 0x40(%RSP),%R15D | 1 | 0.25 | 0.25 | 0.50 | 0.50 | 0 | 0.25 | 0.25 | 0 | 1 | 0.50 | N/A |
| JE 41a0 <main+0x1cc0> | 1 | 0.50 | 0 | 0 | 0 | 0 | 0 | 0.50 | 0 | 0 | 0.50-1 | N/A |
| MOV %R15,(%RSP) | 1 | 0 | 0 | 0.33 | 0.33 | 1 | 0 | 0 | 0.33 | 3 | 1 | scal (12.5%) |
| IMUL %R12D,%R15D | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | N/A |
| XOR %ESI,%ESI | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | scal (6.3%) |
| JMP 4077 <main+0x1b97> | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1-2 | N/A |
| Function | main |
| Source file and lines | attention_v2.cpp:26-194 |
| Module | attention-clang-skl256 |
| nb instructions | 9 |
| nb uops | 9 |
| loop length | 33 |
| used x86 registers | 5 |
| used mmx registers | 0 |
| used xmm registers | 0 |
| used ymm registers | 0 |
| used zmm registers | 0 |
| nb stack references | 2 |
| micro-operation queue | 2.25 cycles |
| front end | 2.25 cycles |
| P0 | P1 | P2 | P3 | P4 | P5 | P6 | P7 | |
|---|---|---|---|---|---|---|---|---|
| uops | 1.50 | 1.50 | 1.00 | 1.00 | 1.00 | 1.50 | 1.50 | 1.00 |
| cycles | 1.50 | 1.75 | 1.00 | 1.00 | 1.00 | 1.50 | 1.50 | 1.00 |
| Cycles executing div or sqrt instructions | NA |
| Longest recurrence chain latency (RecMII) | 0.00 |
| Front-end | 2.25 |
| Dispatch | 1.75 |
| Data deps. | 0.00 |
| Overall L1 | 2.25 |
| all | 0% |
| load | NA (no load vectorizable/vectorized instructions) |
| store | 0% |
| mul | NA (no mul vectorizable/vectorized instructions) |
| add-sub | 0% |
| fma | NA (no fma vectorizable/vectorized instructions) |
| div/sqrt | NA (no div/sqrt vectorizable/vectorized instructions) |
| other | 0% |
| all | 10% |
| load | NA (no load vectorizable/vectorized instructions) |
| store | 12% |
| mul | NA (no mul vectorizable/vectorized instructions) |
| add-sub | 12% |
| fma | NA (no fma vectorizable/vectorized instructions) |
| div/sqrt | NA (no div/sqrt vectorizable/vectorized instructions) |
| other | 6% |
| Instruction | Nb FU | P0 | P1 | P2 | P3 | P4 | P5 | P6 | P7 | Latency | Recip. throughput | Vectorization |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| MOV (%RSP),%R15 | 1 | 0 | 0 | 0.50 | 0.50 | 0 | 0 | 0 | 0 | 4-5 | 0.50 | N/A |
| INC %R15D | 1 | 0.25 | 0.25 | 0 | 0 | 0 | 0.25 | 0.25 | 0 | 1 | 0.25 | N/A |
| ADD %R12,%RCX | 1 | 0.25 | 0.25 | 0 | 0 | 0 | 0.25 | 0.25 | 0 | 1 | 0.25 | scal (12.5%) |
| CMP 0x40(%RSP),%R15D | 1 | 0.25 | 0.25 | 0.50 | 0.50 | 0 | 0.25 | 0.25 | 0 | 1 | 0.50 | N/A |
| JE 41a0 <main+0x1cc0> | 1 | 0.50 | 0 | 0 | 0 | 0 | 0 | 0.50 | 0 | 0 | 0.50-1 | N/A |
| MOV %R15,(%RSP) | 1 | 0 | 0 | 0.33 | 0.33 | 1 | 0 | 0 | 0.33 | 3 | 1 | scal (12.5%) |
| IMUL %R12D,%R15D | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | N/A |
| XOR %ESI,%ESI | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | scal (6.3%) |
| JMP 4077 <main+0x1b97> | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1-2 | N/A |
