Skip to content

Commit

Permalink
[tools] Permit benchmark experiments without boost control (RobotLoco…
Browse files Browse the repository at this point in the history
…motion#21640)

Contemporary AMD processors have a frequency boost feature, called
"Precision Boost". Sadly, the Linux kernel driver configuration as of
Ubuntu Jammy + Linux 6.5 does not expose boost control. Some user land
control does appear to be promised for future kernels.

In the mean time, this patch permits benchmark experiments to run, but
prints a console warning that results may be noisy.
  • Loading branch information
rpoyner-tri authored Jun 29, 2024
1 parent 12a283a commit 27d462a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tools/performance/benchmark_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ def sudo(*args, quiet=False):
subprocess.run(new_args, stderr=subprocess.STDOUT, check=True)


class NoBoost:
def is_supported(self):
return True

def get_boost(self):
"""Return the current boost state; True means boost is enabled."""
return False

def set_boost(self, boost_value):
"""Set the boost state; True means boost is enabled."""
say("No method of cpu boost control was found;"
" nothing is changed. Benchmark results may be noisy.")


class IntelBoost:
# This is the Linux kernel configuration file for Intel's "turbo boost".
# https://www.kernel.org/doc/html/v4.12/admin-guide/pm/intel_pstate.html#no-turbo-attr
Expand Down Expand Up @@ -114,7 +128,7 @@ class CpuSpeedSettings:
"""Routines for controlling CPU speed."""
def __init__(self):
self._boost = None
for boost in [LinuxKernelBoost, IntelBoost]:
for boost in [LinuxKernelBoost, IntelBoost, NoBoost]:
if boost().is_supported():
self._boost = boost()

Expand Down

0 comments on commit 27d462a

Please sign in to comment.