Feedback request regarding HSOC project (bringing sanity to the GHC performance test-suite)
jweakly at pdx.edu
Tue Sep 5 17:39:25 UTC 2017
That framework failure is due to a somewhat embarrassing error that I
thought I had caught earlier; line 298 shouldn't have existed (it was
a small mistake from converting the all.T file from using the old
function to using the new collect_stats function. I have fixed this
and it will be pushed by the time you read this email. That being
said, the individual tests or units are very isolated and a framework
failure simply means that unit didn't get run; in this case it means
that entire all.T file didn't get run since the error was in reading
the file, but the rest of the files should've had their performance
tests recorded properly.
The .git/refs/notes/perf is an implementation detail. Git notes have
the concept of namespaces; so, in order to avoid cluttering up a
global namespace in git notes with stuff only the performance tests
will use, all the performance metrics are stored in the namespace
This format of the git notes is mentioned in the code for the
testsuite but I will make this more visible in the README and other
documentation. The format of the git notes is:
$test-env $test_name $test_way $metric_measured $value_collected
(separated by tabs)
The maximum deviation the test allows is inside the respective
all.T's; additionally, if you set the verbosity level of the
test-suite to a value >= 4, you will see the expected value, allowed
deviation, lower bound, upper bound, the actual measured value, and
(if the test fell outside the bounds) how much the actual value
deviated from the expected value. This information will also print if
the test falls outside of the allowed bounds.
perf_notes.py exists as both an internal library and a measurement
tool (hopefully to be useful to developers). You can give the tool
several commits and it will give you a comparison of the union of all
the tests in those commits, with an output very similar in style to
noFib. I imagine this will be useful mostly to people who want to
improve the performance of the compiler so they can see which tests
have regressed the most over time (or which have improved the most
over time); but as it works over commits, it can also be useful for a
developer wanting to know if they've made a measurable difference with
The notes are updated every time the testsuite is ran. However they
are updated only at the very end of the execution of the testsuite in
a single command (the information is collected in a python
datastructure which is turned into a string and given to git notes).
This behavior means that if the testsuite is ran more than once
in-between commits that 'duplicate values' will exist in the git
notes. I'm not quite sure how to deal with this yet; I am considering
just grabbing the latest value if multiples exist. This also means you
can test just one test and then run other tests and have those values
added into the git notes without losing your older values which is why
the behavior is kept this way. (I will make sure this is more
prominent in the docs somewhere).
The note update is done using python's subprocess library. I have no
idea how resilient that is to git failure; I'd imagine that if it was
busy it would just silently fail to update. Fortunately, the update
process is as close to atomic as one can get. I'll see if I can figure
out a way to force a repo lock to test this out. I'm open to
suggestions as to how to deal with this better and I'll also google
around and see if anyone has a good solution.
Platform discrepancies are completely sidestepped because of the way
git notes work. The performance metrics are entirely local and stay on
your computer; they won't be pushed or shared with any other users.
That means that the performance numbers are completely tailored to
your platform so there is effectively an 0% margin of "OS-related"
error that needs to be accounted for. The collect_stats function is
very much designed to be declarative and "set it and forget it". As
such, the need to even record values at all is obsoleted (one of the
main motivators of this project in the first place).
Hopefully this answers some questions; I'll make sure this sort of
information is available somewhere so that later users can find these
answers again. Thanks for your thoughts! They were very helpful.
On Mon, Sep 4, 2017 at 10:02 PM, Phyx <lonetiger at gmail.com> wrote:
> Hi Jared,
> First off, thanks for all the hard work on this. I checked out your branch
> and made a run, I noticed at the end it had
> Framework failures:
> . ./perf/compiler/all.T  (unexpected indent (<string>, line 298))
> so I assume none of the perf tests were run?
> Though I do see a .git/refs/notes/perf, so I assume your ref is is perf?
> Doing a git notes --ref perf show I see somethings were collected at some
> local T3924 normal bytes allocated 47064
> local haddock.base normal bytes allocated 18427047160
> local haddock.Cabal normal bytes allocated 15863910848
> local haddock.compiler normal bytes allocated 50656428952
> which brings me up to my first question, I'm guessing the number here is the
> number of bytes allocated for the test? Is there a way for me to see
> what the maximum deviation the test allows is and how far I am from it? Do I
> just get the information like before only when a test fails? How does that
> look like? Same as before?
> It's also not entirely clear to be what perf_notes.py can be used, is it
> just an infrastructure tool? or is it something you foresee as useful for a
> lastly, how often do you update notes? It's probably too late for this now,
> but git, especially msys git can be especially slow, so I would have liked
> the notes to be updated in batches to not slow down the testsuite run on
> Which brings me to my next question, how resilient are you to failures
> updating git? some IDE/environments like vscode automatically issue git
> operations in the background. so git may be busy when you try to update and
> the operation would fail saying the repo is locked. Does your new system
> recover from such failures?
> Also how do you deal with platform discrepancies? We've had in the past
> tests that behave radically different on different platforms, so we've also
> historically had the ability to record a platform specific value.
> On Fri, Sep 1, 2017, 05:01 Jared Weakly <jweakly at pdx.edu> wrote:
>> Hey y'all,
>> A quick ToC before I dive right in:
>> * What my HSOC project is on
>> * My progress so far
>> * Feedback welcome
>> * What I have left to do
>> * Theoretical potential improvements
>> My HSOC project was on bringing sanity to the GHC performance test-suite.
>> My blog post on this is here:
>> The Trac ticket that corresponds to this is here:
>> The Phabricator ticket for this patch:
>> The tl;dr of my HSOC project is that GHC's performance tests currently
>> require the programmer to add in expected numbers manually, updated
>> them, handhold the testsuite, etc. This is a bit absurd and my
>> project's overall aim is to reduce the effort required of the
>> programmer to as close to zero as possible while simultaneously
>> increasing the potential ability of the testsuite to catch regressions
>> as much as possible.
>> My progress so far:
>> - I have a few comparison tools in perf_notes.py. These allow people
>> to compare performance numbers of tests across commits
>> - I have all the performance numbers generated by running the tests
>> automatically stored in git notes and referenced by both the
>> comparison tool and the testsuite
>> - I have refactored the testsuite to use my new code that pulls
>> expected numbers automatically from git notes (trivially passing if
>> the note does not yet exist for that test), then it compares that
>> expected number with the number that was gotten from running the
>> testsuite on the latest commit. The comparison passes if it's within a
>> certain deviation (20% by default, but can be customized by the
>> - I have refactored all of the all.T files to use the new comparison
>> functions for the performance tests and ensured that this doesn't
>> break any existing tests.
>> Anyone who wants to checkout the wip/perf-testsuite and try this out
>> is more than welcome. Feedback on anything is welcome; comments are
>> appreciated; discussion is welcome, etc.
>> What I have left to do is:
>> 1. Finish writing up the documentation
>> 2. Update the wiki in all the relevant places concerning
>> additions/modifications to the testsuite and test driver
>> 3. Make sure everyone is happy with the change (and make small changes
>> as necessary)
>> Possible features and improvements I am thinking about adding in:
>> * As a stopgap to full integration with performance tracking tools
>> (such as Gipedia), optionally emitting a test warning with the test
>> summary if there is any regression detected whatsoever (even if the
>> number falls within the allowed deviation)
>> * Some tests, such as T7702, have a somewhat nonsensical regression
>> percentage. Ideally the testsuite could handle those better. I could
>> potentially build in multiple ways to determine a regression
>> (percentage, 'above a certain value', 'taking longer than X amount of
>> time', as potential examples)
>> * Currently some tests require installing some Haskell packages; they
>> are skipped if the packages are not installed. I could try to build in
>> a way to automatically attempt to install all necessary Haskell
>> packages if someone attempts to run a test that requires them.
>> (Perhaps using a command such as 'make test exhaustive')
>> * The performance metric 'peak_megabytes' is sometimes not accurate
>> enough; I could see if adding something like `RTS -h -i0.01`
>> automatically to tests that use 'peak_megabytes' would resolve that.
>> Currently it is a manual debugging step.
>> Any thoughts? Comments? Questions?
>> Jared Weakly
>> ghc-devs mailing list
>> ghc-devs at haskell.org
More information about the ghc-devs