80 lines
2.0 KiB
Python
80 lines
2.0 KiB
Python
import os
|
|
from pathlib import Path
|
|
from subprocess import Popen, run
|
|
|
|
from speccpu import SPEC, check_bench_dir, find_build, get_benchspec_dir, x264
|
|
from speccpu.flaglib.perf import record as recordflags
|
|
|
|
|
|
def x264_disable_mc_mul(
|
|
spec_dir: Path,
|
|
spec_config: str,
|
|
spec_outputroot: Path,
|
|
):
|
|
spec = SPEC(spec_dir)
|
|
spec_env = spec.env()
|
|
|
|
x264_dir = get_benchspec_dir(spec_outputroot) / "625.x264_s"
|
|
|
|
assert check_bench_dir(x264_dir)
|
|
x264_build = find_build(x264_dir / "build")
|
|
|
|
assert x264_build.exists()
|
|
assert "x264_src" in os.listdir(x264_build)
|
|
|
|
mc_src = x264.MCBuilder().with_disabled_iscale_mul().build()
|
|
|
|
recompiled_x264_path = x264.recompile_mc_src(mc_src, x264_build, spec_env)
|
|
|
|
# Execute that new binary
|
|
x264.update_exe(recompiled_x264_path, x264_dir / "exe")
|
|
|
|
x264_run = x264_dir / "run" / "run_base_refspeed_mytest-m64.0000"
|
|
|
|
def runcpu():
|
|
return Popen(
|
|
spec.mkcmd_runcpu(
|
|
spec_config,
|
|
["x264_s"],
|
|
setprocgroup=True,
|
|
workload="ref",
|
|
output_root=spec_outputroot,
|
|
build_type=SPEC.BuildType.Nobuild,
|
|
),
|
|
env=spec_env,
|
|
encoding="utf-8",
|
|
)
|
|
|
|
run(
|
|
[
|
|
"perf",
|
|
"record",
|
|
*recordflags(
|
|
[
|
|
str(x264_run / "x264_s_base.mytest-m64"),
|
|
*x264.specinvoke_args["ref"],
|
|
],
|
|
output=str(Path() / "x264.perf"),
|
|
),
|
|
],
|
|
check=True,
|
|
cwd=x264_run,
|
|
)
|
|
|
|
|
|
def main():
|
|
spec_path = Path("/home/lyc/spec2017-1.1.8-new")
|
|
x264_run_id = "f7e8503c-b8ca-47c9-879f-d1e73bbedc99"
|
|
x264_config = spec_path / "config" / f"{x264_run_id}.cfg"
|
|
x264_outputroot = Path("/home/lyc/work-ts/local/specOutput") / x264_run_id
|
|
|
|
x264_disable_mc_mul(
|
|
spec_path,
|
|
str(x264_config),
|
|
x264_outputroot,
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|