Gem5 simpoint 全流程

  1. 使用gem5 生成 simpoint
    cmdline:
build/X86/gem5.fast configs/spec2017/se_spec17.py --spec-2017-bench 
--spec-size=ref --warmup-insts=1000000 --maxinsts=100000000000 
--arch=X86 --cpu-type=AtomicSimpleCPU --sys-clock=1.6GHz 
--cpu-clock=3.5GHz --mem-size=16GB --mem-type=DDR4_2400_4x16 
--simpoint-profile 
--simpoint-interval 100000000  --l4-size=512MB -b mcf 

生成的文件目录,其中simpoint.bb.gz生成的压缩文件,供simpoint使用。

./mcf/
├── benchmark_err
├── benchmark_out
├── config.ini
├── config.json
├── dumpDebugState.txt
├── simerr
├── simout
├── simpoint.bb.gz
└── stats.txt
  1. 使用simpoint处理simpoint.bb.gz 生成weights和simpoint
    simpoint weight 格式
    此时我们得到了
./mcf/
├── benchmark_err
├── benchmark_out
├── config.ini
├── config.json
├── dumpDebugState.txt
├── simerr
├── simout
├── simpoint.bb.gz
├── simpoints
├── stats.txt
└── weights
  1. gem5输入simpoints和weights,在对应的节点产生checkpoint
    我的实验warm up inst 4Billion比较长,可以根据自己需要修改,比如10K。
build/X86/gem5.fast 
configs/spec2017/se_spec17.py --spec-2017-bench --spec-size=ref 
--warmup-insts=1000000 --maxinsts=100000000000 
--arch=X86 --cpu-type=X86TimingSimpleCPU 
--sys-clock=1.6GHz --cpu-clock=3.5GHz --mem-size=16GB --mem-type=DDR4_2400_4x16 
--caches --cache-level=4 --l4-size=512MB 
-b mcf 
--take-simpoint-checkpoint=mcf/simpoints, mcf/weights,100000000,4000000000

4)产生了checkpoint之后的目录如下图所示:
这里我换了一个program,因为正好在跑这个。

cactuBSSN/
├── benchmark_err
├── benchmark_out
├── config.ini
├── config.json
├── cpt.simpoint_00_inst_6600000000_weight_0.177177_interval_100000000_warmup_4000000000
│   ├── m5.cpt
│   └── system.physmem.store0.pmem
├── cpt.simpoint_01_inst_49400000000_weight_0.058058_interval_100000000_warmup_4000000000
│   ├── m5.cpt
│   └── system.physmem.store0.pmem
├── cpt.simpoint_02_inst_51400000000_weight_0.014014_interval_100000000_warmup_4000000000
│   ├── m5.cpt
│   └── system.physmem.store0.pmem
├── cpt.simpoint_03_inst_56700000000_weight_0.612613_interval_100000000_warmup_4000000000
│   ├── m5.cpt
│   └── system.physmem.store0.pmem
├── cpt.simpoint_04_inst_82500000000_weight_0.138138_interval_100000000_warmup_4000000000
│   ├── m5.cpt
│   └── system.physmem.store0.pmem
├── simerr
├── simout
└── stats.txt

m5.cpt即为当前cpu运行状态的快照,比如寄存器值,页表映射关系之类的:
在这里插入图片描述
system.physmem.store0.pmem则是当时的内存的状态。
因此有了cpt和pmem,gem5就可以从任意一个checkpoint restore,开始执行。

5)restore checkpoint

build/X86/gem5.fast configs/spec2017/se_spec17.py
--spec-2017-bench --spec-size=ref 
--warmup-insts=1000000
--arch=X86 --cpu-type=X86O3CPU 
--sys-clock=1.6GHz --cpu-clock=3.5GHz --caches --cache-level=4 
--mem-size=16GB --mem-type=DDR4_2400_4x16 
--l4-size=256MB 
-b cactuBSSN
 --restore-simpoint-checkpoint -r 4 
 --checkpoint-dir gem5-results-2017-20220902-checkpoint/512MB/cactuBSSN

这里的 -r 4 比较特殊,这里计数是按1开头的,因此-r 4实际上对应 第4)步中的第3个checkpoint:
cpt.simpoint_03_inst_56700000000_weight_0.612613_interval_100000000_warmup_4000000000

Resuming from cactuBSSN/cpt.simpoint_03_inst_56700000000_weight_0.612613_interval_100000000_warmup_4000000000
Resuming from SimPoint #3, start_inst:56700000000, weight:0.612613, interval:100000000, warmup:4000000000
Global frequency set at 1000000000000 ticks per second
warn: No dot file generated. Please install pydot to generate the dot file and pdf.
build/X86/mem/dram_interface.cc:692: warn: DRAM device capacity (4096 Mbytes) does not match the address range assigned (16384 Mbytes)
0: system.remote_gdb: listening for remote gdb on port 7000
build/X86/sim/process.cc:405: warn: Checkpoints for pipes, device drivers and sockets do not work.
Switch at curTick count:10000
build/X86/sim/simulate.cc:194: info: Entering event queue @ 187482902990720.  Starting simulation...
Switched CPUS @ tick 187482903000720
switching cpus
system.cpu old->new system.switch_cpus
build/X86/sim/simulate.cc:194: info: Entering event queue @ 187482903000720.  Starting simulation...
build/X86/sim/power_state.cc:106: warn: PowerState: Already in the requested power state, request ignored
build/X86/sim/simulate.cc:194: info: Entering event queue @ 187482903000822.  Starting simulation...
O3CPU0 At 187487215508450 Tid[0] 10000000 instructions are executed.
O3CPU0 At 187491429812258 Tid[0] 20000000 instructions are executed.
O3CPU0 At 187495683554894 Tid[0] 30000000 instructions are executed.

使用restore checkpoint的方法就可以快速的从各个截点恢复执行,原理有点儿像分支预测里面的checkpoint和上下文切换的context。

在这里插入图片描述

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 15
    评论
gem5学习基础完整版,介绍了gem5环境的安装,以及一些基本概念。 gem5仿真器是用于计算机系统体系结构研究的模块化平台,涵盖系统级体系结构以及处理器微体系结构。1、多个可互换的CPU型号。 gem5提供了四种基于解释的CPU模型:简单的单CPI CPU; 有序CPU的详细模型和无序CPU的详细模型。 这些CPU模型使用通用的高级ISA描述。 此外,gem5具有基于KVM的CPU,该CPU使用虚拟化来加速仿真。 2、完集成的GPU模型,可以执行真实计算机ISA,并支持与主机CPU共享的虚拟内存。 3、NoMali GPU模型。 gem5带有集成的NoMali GPU模型,该模型与Linux和Android GPU驱动程序堆栈兼容,因此无需进行软件渲染。 NoMali GPU不产生任何输出,但可以确保以CPU为中心的实验产生代表性的结果。 4、事件驱动的内存系统。 gem5具有详细的,事件驱动的内存系统,包括高速缓存,交叉开关,探听过滤器以及快速而准确的DRAM控制器模型,用于捕获当前和新兴内存的影响,例如内存。 LPDDR3 / 4/5,DDR3 / 4,GDDR5,HBM1 / 2/3,HMC,WideIO1 / 2。 可以灵活地布置组件,例如,以具有异构存储器的复杂的多级非均匀高速缓存层次结构来建模。 5、基于跟踪的CPU模型,可播放弹性跟踪,这些跟踪是由附着到乱序CPU模型的探针生成的依赖项和定时注释的跟踪。 跟踪CPU模型的重点是以快速,合理的方式而不是使用详细的CPU模型来实现内存系统(高速缓存层次结构,互连和主内存)的性能探索。 6、异构和异构多核。 可以将CPU模型和缓存组合到任意拓扑中,从而创建同构异构的多核系统。 MOESI侦听缓存一致性协议可保持缓存一致性。 7、多种ISA支持。 gem5将ISA语义与其CPU模型解耦,从而实现对多个ISA的有效支持。 目前gem5支持Alpha,ARM,SPARC,MIPS,POWER,RISC-V和x86 ISA。 有关更多信息,请参见支持的体系结构。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 15
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值