Skip to content
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

[SR-4675] Report detailed build version from Benchmark drivers #47252

Open
palimondo mannequin opened this issue Apr 23, 2017 · 10 comments
Open

[SR-4675] Report detailed build version from Benchmark drivers #47252

palimondo mannequin opened this issue Apr 23, 2017 · 10 comments

Comments

@palimondo
Copy link
Mannequin

palimondo mannequin commented Apr 23, 2017

Previous ID SR-4675
Radar None
Original Reporter @palimondo
Type Improvement
Status In Progress
Resolution
Additional Detail from JIRA
Votes 0
Component/s Project Infrastructure
Labels Improvement, Performance
Assignee @palimondo
Priority Medium

md5: e8809188119162febcdf298bae1cc028

relates to:

  • SR-4659 Benchmark logs should be tied to tested tree version

Issue Description:

When running performance tests and comparing them between different builds, it would be helpful to have an attribute that would report version information about the benchmark suite build retrieved from git.

We should add a --version attribute to Benchmark_* drivers, that prints git commit hash, to uniquely identify each build of benchmark suite during development. This should probably be retrieved by cmake during build, because Benchmark_Driver script could be run later on top of modified working directory and would be no longer able to determine the revision used during the build of individual drivers (O, Onone, Ounchecked).

The version information should probably also include branch information, and links to github repositories, when comparing PR from forks. ❓

Retrieving Git version from CMake: http://stackoverflow.com/a/6526533/41307

@palimondo
Copy link
Mannequin Author

palimondo mannequin commented Jun 5, 2018

@gottesmm could you take this up? Can you add Benchmark_O --version parameter that would report the same info as swift --version? I have looked at cmake a bit, but I’m not clear on how to make it work. It looks like you have more experience in the area...

@gottesmm
Copy link
Member

gottesmm commented Jun 6, 2018

@palimondo I am working on other things right now. Let me explain to you how to do this if it interests you. I think this would be another one of those really nice solid contributions to get under your belt.

I do not think that one can programmatically AFAIKT get this information (but I may be wrong). That suggests to me we should go down the cmake configure route. To see how to do that, please first read this section of the cmake guide:

https://cmake.org/cmake/help/v3.4/command/configure_file.html

and look at these examples from the benchmark suite itself where we have accomplished such things.

https://github.com/apple/swift/blob/master/benchmark/scripts/CMakeLists.txt

There are a few challenges here that we need to consider:

  1. How would this work in swiftpm? At least this shouldn't break swiftpm.

  2. Given that we support out of tree benchmarking, I would rather the benchmark suite be consistent and just use the version output from the swiftc that it is using to compile the sources. That can be done via runcmd: https://github.com/apple/swift/blob/master/benchmark/cmake/modules/SwiftBenchmarkUtils.cmake#L53

Your thoughts?

@palimondo
Copy link
Mannequin Author

palimondo mannequin commented Jun 15, 2018

So far I got a Version.swift.in that produces Version.swift using the configure_file. Any tip on how to make this work with SwiftPM?

This is my first look at SwiftPM, so… looking at Package.swift, it looks like I can run arbitrary code there? Would it be OK to shell out there with swiftc --version and generate Version.swift myself? Basically reimplementing runcmd and configure_file from cmake side?

@gottesmm
Copy link
Member

There are a bunch of ways we can do this. I am really not sure what is the "right way". Lets ask the SwiftPM people if there is a better way to do this: @aciidb0mb3r.

@gottesmm
Copy link
Member

@palimondo I talked with some people and some further thoughts:

1. I think for the swiftpm case it is ok to just output nothing or at least a message that says N/A. SwiftPM will eventually have a feature to do this but they do not today.

2. The information that you really want is swift version and benchmark version. That to me says that we want swiftc --version as a human readable string and to get the actual git hash of the benchmark suite.

@gottesmm
Copy link
Member

Let me add a bit more information here. When I spoke with the swiftpm people they were pretty against shelling out. That is why I am suggesting that we just do something with swiftpm that doesn't print out the version. Since it is only for editing at this point, it is fine to do.

@palimondo
Copy link
Mannequin Author

palimondo mannequin commented Jun 16, 2018

Umm… I think this still leaves me with a problem: To make the benchmark compile, I have to have Version.swift file present for the build. I'd be generating that with cmake as you taught me from examples above using the Version.swift.in, with only latter being in the version control. But SwiftPM requires me to have Version.swift under version control too… so I would always be leaving the Verision.swift in modified state as far as git is concerned. Wouldn't that we less than ideal? Am I missing something?

@gottesmm
Copy link
Member

I would have a separate Version.swift for swiftpm.

@gottesmm
Copy link
Member

Let me elaborate slightly. With cmake we have much more control vs swiftpm. So I imagine it would work like this:

  1. In the cmake case you configure Version.swift.in into the build directory and teach cmake how to find it. CMake won't know anything about SwiftPMVersion.swift.

  2. SwiftPM will just pick up SwiftPMVersion.swift by default if you put it in the utils directory.

@palimondo
Copy link
Mannequin Author

palimondo mannequin commented Jun 20, 2018

OK, I think I got this (in principle). I'm stuck on building with SwiftPM. It always crashes on me.
https://gist.github.com/palimondo/1af3c794ef2efe17bbb15e71127a61aa

@gottesmm can you get the benchmarks to build with SwiftPM?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant