CPU 访问缓存和主存的延迟大概是多少 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
doraos

CPU 访问缓存和主存的延迟大概是多少

  •  
  •   doraos Jan 2, 2019 3834 views
    This topic created in 2671 days ago, the information mentioned may be changed or developed.

    用 adia64 这类软件测的是 L1 1-2ns (3-5 clock),L2 2-3.5ns(6-10clock),L3 10-15ns (20-50 clock), 主存 30-50ns(60-150clock) 但是一些书例如现代操作系统上写的 L1 是瞬间访问, L2 两三个时钟,而另一些书又和上面的数据更加接近

    5 replies    2019-01-02 14:00:07 +08:00
    xenme
        1
    xenme  
       Jan 2, 2019   1
    https://stackoverflow.com/questions/4087280/approximate-cost-to-access-various-caches-and-main-memory

    Core i7 Xeon 5500 Series Data Source Latency (approximate) [Pg. 22]

    local L1 CACHE hit, ~4 cycles ( 2.1 - 1.2 ns )
    local L2 CACHE hit, ~10 cycles ( 5.3 - 3.0 ns )
    local L3 CACHE hit, line unshared ~40 cycles ( 21.4 - 12.0 ns )
    local L3 CACHE hit, shared line in another core ~65 cycles ( 34.8 - 19.5 ns )
    local L3 CACHE hit, modified in another core ~75 cycles ( 40.2 - 22.5ns )

    remote L3 CACHE (Ref: Fig.1 [Pg. 5]) ~100-300 cycles ( 160.7 - 30.0 ns )

    local DRAM ~60 ns
    remote DRAM ~100 ns
    yanaraika
        2
    yanaraika  
       Jan 2, 2019   2
    http://instlatx64.atw.hu/ MemLatX64 有更精确的数据
    ryd994
        3
    ryd994  
       Jan 2, 2019 via Android   1
    寄存器才是指令直接访问
    29EtwXn6t5wgM3fD
        4
    29EtwXn6t5wgM3fD  
       Jan 2, 2019   1
    https://www.7-cpu.com/cpu/Cortex-A57.html

    AMD Opteron A1170 (ARM Cortex-A57), 2.0 GHz, 28 nm. RAM: 16 GB. (Probably it's SoftIron Overdrive 3000 server, DDR3 RDIMM).

    L1 Data cache = 32 KB, 64 B/line, 2-WAY.
    L1 Instruction cache = 48 KB, 64 B/line, 3-WAY.
    L2 Cache = 1 MB (per 2 cores), 64 B/line, 16-WAY.
    L3 Cache = 8 MB (per 8 cores), 64 B/line, ?-WAY.

    L1 Data Cache Latency = 4 cycles for simple access via pointer
    L1 Data Cache Latency = 5 cycles for access with complex address calculation (size_t n, *p; n = p[n]).
    L2 Cache Latency = 18 cycles
    L3 Cache Latency = 60 cycles
    RAM Latency = 60 cycles + 124 ns
    29EtwXn6t5wgM3fD
        5
    29EtwXn6t5wgM3fD  
       Jan 2, 2019   1
    https://www.7-cpu.com/cpu/Skylake_X.html

    Intel i7-7820X (Skylake X), 8 cores, 4.3 GHz (Turbo Boost), Mesh 2.4 GHz, 14 nm. RAM: 4x 8 GB DDR4-3400 16-18-18-36.

    L1 Data cache = 32 KB, 64 B/line, 8-WAY
    L1 Instruction cache = 32 KB, 64 B/line, 8-WAY.
    L2 cache = 1024 KB, 64 B/line, 16-WAY
    L3 cache = 11 MB, 64 B/line, 11-WAY

    L1 Data Cache Latency = 4 cycles for simple access via pointer
    L1 Data Cache Latency = 5 cycles for access with complex address calculation (size_t n, *p; n = p[n]).
    L2 Cache Latency = 14 cycles
    L3 Cache Latency = 68 cycles (3.6 GHz)
    L3 Cache Latency = 79 cycles (4.3 GHz) (77-81 cycles for different cores)
    RAM Latency = 79 cycles + 50 ns

    不管是 ARM 还是 x86 都需要 4/5 个时钟
    About     Help     Advertise   nbsp; Blog     API     FAQ     Solana     4469 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 37ms UTC 04:09 PVG 12:09 LAX 21:09 JFK 00:09
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86