This is an archive of the discontinued LLVM Phabricator instance.

[MCA][x86][NFC] Add tests for -register-file-stats, -scheduler-stats
ClosedPublic

Authored by lebedev.ri on Jun 14 2018, 1:04 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

lebedev.ri created this revision.Jun 14 2018, 1:04 PM
RKSimon added inline comments.Jun 15 2018, 12:51 AM
test/tools/llvm-mca/X86/register-file-statistics.s
4 ↗(On Diff #151407)

Try to use shorter prefixes: SNB, IVB, HSW, BDW are the most common acronyms

11 ↗(On Diff #151407)

Use --check-prefixes if you can, although I don't see any usage of ALL.

45 ↗(On Diff #151407)

A lot of these prefixes look redundant?

lebedev.ri added inline comments.Jun 15 2018, 1:14 AM
test/tools/llvm-mca/X86/register-file-statistics.s
45 ↗(On Diff #151407)

Oh, indeed.

BTW, in this file, everything before Register File statistics: isn't expected to be here.
Can

Iterations:        100
Instructions:      100
Total Cycles:      51
Dispatch Width:    2
IPC:               1.96
Block RThroughput: 0.5

be named a "-basic-stats", and an option to control that output be added?
@andreadb does that sound reasonable?

Remove leftover noise.

andreadb added inline comments.Jun 15 2018, 3:44 AM
test/tools/llvm-mca/X86/register-file-statistics.s
45 ↗(On Diff #151407)

Not really.
I think the summary view should never be optional in llvm-mca.
It is only a few lines, and it gives a nice overview of the run.

lebedev.ri added inline comments.Jun 15 2018, 3:53 AM
test/tools/llvm-mca/X86/register-file-statistics.s
45 ↗(On Diff #151407)

I agree that it is quite essential for normal usage,
but in the edge-case use-case like this, it does not seem to be of much use..

test/tools/llvm-mca/X86/scheduler-queue-usage.s
110–114 ↗(On Diff #151464)

Hm, it seems i have picked a bad example.

lebedev.ri marked an inline comment as done.

Use xor %eax, %ebx instead of xor %eax, %eax
so that btver2 also shows up in -scheduler-stats

andreadb added inline comments.Jun 15 2018, 4:23 AM
test/tools/llvm-mca/X86/register-file-statistics.s
45 ↗(On Diff #151407)

My opinion is that register pressure should be always put into perspective.
Register pressure tends to change over the course of a simulation for many reasons (i.e. the presence of long latency instructions, long data dependencies, lack of resources versus high dispatch rate). So, the number of iterations usually matters, and it helps putting the register usage into perspective.
That being said, if other reviewers are okay with this change, then I won't oppose it.

lebedev.ri added inline comments.Jun 15 2018, 4:31 AM
test/tools/llvm-mca/X86/register-file-statistics.s
45 ↗(On Diff #151407)

I'm not denying any of that.
I'm simply saying that in these two testcases, the only thing they are intended to produce,
is to dump the ProcResGroup<>.BufferSize, and RegisterFile<>.NumPhysRegs.

andreadb added inline comments.Jun 15 2018, 5:50 AM
test/tools/llvm-mca/X86/register-file-statistics.s
45 ↗(On Diff #151407)

As I wrote, I am okay with this change if other reviewers are okay with it.
Since Clement (and presumably Greg) are okay with it (based on the feedback from D48209), then I am not going to oppose this patch.

As a side note, the subject of this patch is a bit misleading.
There are already existing tests for -register-file-stats and -scheduler-stats in X86/BtVer2 directory.

My understanding is that your original plan is to add test coverage specifically for the register file usage in Znver1 (in the summary, you wrote that this is a spin-off of D47676). If my understanding is correct, then please move these tests into directory ZnVer1, and make those tests znver1 only.

lebedev.ri added inline comments.Jun 15 2018, 6:00 AM
test/tools/llvm-mca/X86/register-file-statistics.s
45 ↗(On Diff #151407)

Thanks!

...

Yes and no.
It was indeed intended to show the Znver1 change.
But it tries to address somewhat larger problem that these basic, common to all processors,
things aren't being tested for all the processors.
I.e. much like the test/tools/llvm-mca/X86/cpus.s, which is catch-all.

So i could make it znver1-specific, but it seems that in this case,
the more general approach is slightly better.
It would of course not make much sense to do that for every asm sequence
(as opposed to duplicating those test files per-cpu).

andreadb accepted this revision.Jun 15 2018, 6:05 AM

Well, I guess it doesn't hurt to have these new tests.
We already have tests for all the views and all the stats. But you are right, we don't have tests _only_ for those two flags.

It looks good to me.

Thanks,
-Andrea

This revision is now accepted and ready to land.Jun 15 2018, 6:05 AM

Well, I guess it doesn't hurt to have these new tests.
We already have tests for all the views and all the stats. But you are right, we don't have tests _only_ for those two flags.

It looks good to me.

Thanks,
-Andrea

Thank you for the review!

This revision was automatically updated to reflect the committed changes.