参考: gem5_simpoint
**说明:**在gem5的发行版本中,fs.py中并不包含simpoint的创建和使用,所以官方文档http://gem5.org/Simpoints中的Profiling and Generating BBV存在错误,需要修改fs.py后才能使用,而se.py中已经包含simpoint的相关信息,故使用se.py来创建simpoint。
- 阅读本文需参考gem5中运行spec2006, SimPoint: 抽样创建模拟点减少spec2006运行时间
- 查看Simulation Points for SPEC CPU 2006, 主要讲解了simpoints数量的统计情况;Generation, Validation and Analysis of SPEC
CPU2006 Simulation Points Based on Branch,
Memory and TLB Characteristics simpoints数量机器运行花费的时间介绍;SimPoint 3.0: Faster and More Flexible
Program Phase Analysis simpoint及其参数介绍;
1. 分析与生成基本块向量(Basic block vector):
//示例代码
gem5/build/ALPHA/gem5.opt gem5/configs/example/spec06_se.py --benchmark=bzip2 --benchmark_stdout=gem5/m5out/bzip2.out --benchmark_stderr=gem5/m5out/bzip2.err -I 900000000000 --simpoint-profile --simpoint-interval=10000 --fastmem
查看m5out目录下可看到simpoint.bb.gz文件,simpoint分析必须使用AtomicSimpleCPU 和 fastmem。
// 以下为本人使用的生成simpoint.bb.gz方法,100Million为周期
$GEM5_DIR/build/ALPHA/gem5.fast --outdir=$OUTPUT_DIR $GEM5_DIR/configs/example/spec06_se.py --benchmark=$BENCHMARK --benchmark_st
dout=$OUTPUT_DIR/$BENCHMARK.out --benchmark_stderr=$OUTPUT_DIR/$BENCHMARK.err --simpoint-profile --simpoint-interval=100000000 --
fastmem | tee -a $SCRIPT_OUT
通过运行所有厕所集后,spec2006可运行的情况统计见 gem5: 可运行的spec2006 benchmark总结,生成的simpoint.bb.gz文件见simpoint.bb.gz,提取码: ecnu
**2. SimPoint Analysis: **
得到BBV文件后即可分析该测试程序的模拟点,运行脚本如下:
./simpoint -loadFVFile simpoint.bb.gz -maxK 30 -saveSimpoints <simpoint_file> -saveSimpointWeights <weight_file> -inputVectorsGzipped
生成的simpoints文件见spec06simpoints,提取码: ecnu
现在将对spec06simpoints中所有权重最大的simpoint进行统计,以后即可从该点运行,统计结果见spec2006中精确的simulation points执行点。
**3. Taking SimPoint Checkpoints in gem5: **
m5.fast configs/example/se.py --bench=bzip2 --take-checkpoint=3792 --at-instruction
使用上面的命令生成checkpoint, --take-checkpoint=3792参数为从精确执行点开始执行,即point * 100Million。
4.Resuming from gem5 SimPoint Checkpoints
m5.fast configs/example/se.py --bench=bzip2 --caches --l2cache --checkpoint-restore=3792 --at-instruction --max-inst=100000
以后运行改测试集,即可直接从checkpoint开始,然后运行指定的指令数目即可。