cpu.mode fastest code on the internet
solution

sol_3860713_1787981813753161157_4

C++ Scalar sparse merge dot 3 runs
01 source
Submitted source 723 bytes
Compiler clang++ Flags -O3 -march=native -std=c++20
show source
#include <cstddef>
#include <cstdint>

extern "C" void nk_sparse_dot_u32f32(
    const std::uint32_t *a,
    const std::uint32_t *b,
    const float *a_weights,
    const float *b_weights,
    std::size_t a_length,
    std::size_t b_length,
    double *product
) {
    std::size_t i = 0;
    std::size_t j = 0;
    double sum = 0.0;

    while (i < a_length && j < b_length) {
        const std::uint32_t ai = a[i];
        const std::uint32_t bj = b[j];
        if (ai == bj) {
            sum += static_cast<double>(a_weights[i]) * static_cast<double>(b_weights[j]);
            ++i;
            ++j;
        } else if (ai < bj) {
            ++i;
        } else {
            ++j;
        }
    }

    *product = sum;
}
02 jobs
Systems 03 jobs
03 counters
Performance counters 26 counters
cyclesi
172,934,002
Show more
branch_instructionsi
46,502,940
branch_missesi
5,114,641
dtlb_load_misses.walk_completedi
1,291
instructionsi
116,242,515
mem_bound_stalls.load_dram_hiti
558,713
mem_bound_stalls.load_l2_hiti
2,604,714
mem_bound_stalls.load_llc_hiti
35,136
mem_inst_retired.split_loadsi
1,169
mem_load_retired.l1_missi
329,164
mem_load_retired.l2_missi
4,737
mem_load_retired.l3_missi
3,991
tma_backend_boundi
4,512,505
tma_backend_bound_alloc_restrictionsi
234,416
tma_backend_bound_non_memory_scheduleri
1,577,820
tma_backend_bound_registeri
340
tma_backend_bound_reorder_bufferi
969,025
tma_backend_bound_serializationi
1,324,940
tma_bad_speculationi
463,346,684
tma_bad_speculation_branch_mispredicti
463,299,091
tma_bad_speculation_machine_clearsi
47,593
tma_frontend_bandwidthi
235,460,399
tma_frontend_boundi
287,570,016
tma_frontend_latencyi
52,109,617
tma_memory_boundi
322,845
tma_retiringi
116,867,597
04 top down
Top-down analysis Gracemont E-core
05 profile
load profile