-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
workloads/geekbench: Add support for Geekbench command-line build #1278
base: master
Are you sure you want to change the base?
Conversation
@@ -20,10 +20,11 @@ | |||
import json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow Linux kernel coding guideline regarding the commit message.
Describe your changes in imperative mood, e.g. “make xyzzy do frotz” instead of “[This patch] makes xyzzy do frotz” or “[I] changed xyzzy to do frotz”, as if you are giving orders to the codebase to change its behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to update copyright year (# Copyright 2013-2018 ARM Limited
at the beginning of file) as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this # Copyright 2024 ARM Limited
? I am not so sure about this, since I didn't create a new page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd go for 2013-2025 to keep the same format, but yes ideally we should be updating the copyright year each time we update a file (although as you can see we are a little out of date...).
wa/workloads/geekbench/__init__.py
Outdated
def init_resources(self, context): | ||
# Necessary files to run the benchmark will be retrieved from WA as a tar file. | ||
# WA will look for 'gb_cli_artifacts_<version>.tar' file to deploy them to the | ||
# working directory. If there is no specified version, it will look for version 6.3.0 by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line (and few more lines below) is too long (106 chars). Please ensure your changes are PEP-8 compliant. autopep8
command might be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was using maxLineLength=120
, I didn't see any rule for max length in the WA documentation. Also in the same file I can see that some lines > 100.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://peps.python.org/pep-0008/#maximum-line-length says 79 & 72, but I think 100 is OK in general.
wa/workloads/geekbench/__init__.py
Outdated
super(GeekbenchCmdline, self).initialize(context) | ||
# Extract the tar file | ||
self.target.execute("{} tar -xf {} -C {}".format(self.target.busybox, | ||
self.tar_file, self.target_working_directory)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be easier to maintain since we would not need to match spacing until (
.
self.target.execute(
"{} tar -xf {} -C {}".format(
self.target.busybox, self.tar_file, self.target_working_directory))
@@ -20,10 +20,11 @@ | |||
import json | |||
from collections import defaultdict | |||
|
|||
from wa import ApkUiautoWorkload, Parameter | |||
from wa import Workload, ApkUiautoWorkload, Parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workload
is imported, but I'm unsure if it's used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workload
is used from GeekbenchCmdline
class
wa/workloads/geekbench/__init__.py
Outdated
|
||
parameters = [ | ||
Parameter('cpumask', kind=str, | ||
default=None, override=False, mandatory=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't default value be ''
since the type is str
?
wa/workloads/geekbench/__init__.py
Outdated
if self.upload: | ||
self.params += '--upload ' | ||
else: | ||
self.params += '--no-upload ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.params += '--upload ' if self.upload else '--no-upload '
would be slightly more Pythonic.
wa/workloads/geekbench/__init__.py
Outdated
extension = os.path.splitext(self.output_file)[1][1:] | ||
if self.output_file and extension not in self.allowed_extensions: | ||
msg = 'No allowed extension specified. Allowed extensions: {}' | ||
raise ValueError(msg.format(', '.join(self.allowed_extensions))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be more appropriate to build error message in a single place?
msg = f"No allowed extension specified. Allowed extensions: {', '.join(self.allowed_extensions)}"
raise ValueError(msg)
for match in matches: | ||
scores.append(int(re.search(r'\d+', match).group(0))) | ||
if self.section == 4: | ||
context.add_metric("OpenCL Score " + self.workloads[workload], scores[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can also be Vulkan
in addition to OpenCL
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenCL
and Vulkan
has different sections. I changed this part a bit. You can check the updated version.
|
||
def extract_results(self, context): | ||
super(GeekbenchCmdline, self).extract_results(context) | ||
# Extract results on the target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment should be swapped with the previous line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment still pending?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I did change the comment with the previous line.
wa/workloads/geekbench/__init__.py
Outdated
|
||
@once | ||
def finalize(self, context): | ||
# Clean up the working directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can drop this comment. It does not add much value.
@@ -20,10 +20,11 @@ | |||
import json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd go for 2013-2025 to keep the same format, but yes ideally we should be updating the copyright year each time we update a file (although as you can see we are a little out of date...).
wa/workloads/geekbench/__init__.py
Outdated
|
||
parameters = [ | ||
Parameter('cpumask', kind=str, | ||
default='', override=False, mandatory=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless we're setting override
or mandatory
we don't need to explicitly need to set these values for these Parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will remove those options.
wa/workloads/geekbench/__init__.py
Outdated
self.deployable_assets = [''.join(['gb_cli_artifacts', '_', self.version, '.tar'])] | ||
|
||
# Create a working directory | ||
self.target.working_directory = self.target.path.join(self.target.working_directory, f'gb_cli-{self.version}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't be trying to change the working directory of the target from a workload.
Is this meant to be self.target_working_directory
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will change this part.
But I am still changing the working_directory
in the agenda file when I am running the workload. Otherwise it gives me a permission error and cannot execute the binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the working_directory
from the agenda is fine as this would be a conscious decision by the user and would impact all workloads equally.
Otherwise it gives me a permission error and cannot execute the binary.
If these are binaries that require execution permission, is there a reason they need to be in the working directory? Or could we use target.install
for this instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Marc,
I did change this part and now I am extracting the assets in the executables_directory
. Also there is no need to change working_directory
in the agenda file.
wa/workloads/geekbench/__init__.py
Outdated
|
||
# Create a working directory | ||
self.target.working_directory = self.target.path.join(self.target.working_directory, f'gb_cli-{self.version}') | ||
self.target.execute("mkdir -p {}".format(self.target.working_directory)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
wa/workloads/geekbench/__init__.py
Outdated
def validate(self): | ||
super(GeekbenchCmdline, self).validate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're not doing anything workload specific here do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will remove that one.
Does Geekbench command line not require a license to run? Should we be upstreaming workloads that have such a dependency? |
Hi Scott,
On the other hand... Not having the GB6 cmd line version prevents us from being efficient in our experiments (and aligned across different teams that everyone can reproduce exactly the same scenario). The APK from public store doesn't allow you to run single sub-test and be more precised how it should be run. |
If we agree that the dependency is for users of WA to sort themselves then that's fine. We have a geekbench cli workload that we have used for years and have not upstreamed because we were under the impression that such a thing was frowned upon. |
wa/workloads/geekbench/__init__.py
Outdated
def run(self, context): | ||
super(GeekbenchCmdline, self).run(context) | ||
taskset = f"taskset {self.cpumask}" if self.cpumask else "" | ||
cmd = '{} {}/{} {}'.format(taskset, self.target_exec_directory, self.binary_name, self.params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use target.join()
instead of hardcoding a /
.
wa/workloads/geekbench/__init__.py
Outdated
super(GeekbenchCmdline, self).setup(context) | ||
|
||
self.params = '' | ||
if self.section == 4: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC the 3 options for section
are 1,4,9, is there a reason that we have 3 separate if statements all of which include the same self.params += '--section {} '.format(self.section)
line?
Would it make more sense to only add the core explicitly for section 1?
|
||
def extract_results(self, context): | ||
super(GeekbenchCmdline, self).extract_results(context) | ||
# Extract results on the target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment still pending?
Hi @scojac01, That's interesting, I had thought we had set precedence for this back with the geekbench-corporate workload, in that if we can assume that it is reasonable that a non-trivial amount of other users would be able to source the appropriate workloads, then it could still be beneficial to upstream the workload. Are you aware of of substantial differences between the availability of the corporate vs the cli flavours of the workloads? |
Add Geekbench command-line build workload for Android targets. Geekbench apks allow to user to run the tests altogether. Using the command-line, a single test or multiple tests can be specified. Signed-off-by: Elif Topuz <[email protected]>
Hi @marcbonnici That's fair enough. We must have missed that but happy with that precedent. The cli workload is the corporate one just triggered in a different method with a few extra params. The license should be the same so no impact there. |
Geekbench command-line build is added for Android. Geekbench apks allow to user to run the tests altogether. Using the command-line build, a single test or multiple tests can be specified.