This is an archive of the discontinued LLVM Phabricator instance.

[UpdateTestChecks] Add update_mca_test_checks.py script
ClosedPublic

Authored by gbedwell on Apr 6 2018, 7:10 AM.

Details

Summary

This script can be used to regenerate tests in the test/tools/llvm-mca directory (PR36904).

I've regenerated all of the subtarget specific tests as an example (command and console output below). In some of the cases they're now matching on a lot more tool output than they were previously. I can either commit these as-is, or leave for now. I've tested with Python 2.7 and 3.6 although the default is 2.7 for now to match the rest of the utility scripts. I've kept indentation at 2 spaces to match the rest of the LLVM project, but with all indentation warnings suppressed this runs cleanly through pep8, pylint and various other python style and linting tools I've tried.

C:\work\public-git\upstream-llvm\llvm\utils>py -2 update_mca_test_checks.py ..\test\tools\llvm-mca\*\*\*.s
Test path: ..\test\tools\llvm-mca\AArch64\CortexA57\direct-branch.s
Test path: ..\test\tools\llvm-mca\AArch64\Exynos\direct-branch.s
Test path: ..\test\tools\llvm-mca\AArch64\Exynos\scheduler-queue-usage.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\dot-product.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\hadd-read-after-ld-1.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\hadd-read-after-ld-2.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\instruction-info-view.s
update_mca_test_checks.py:297: Warning: not writing for prefix DISABLED due to presence of "DISABLED-NOT:" in input file.
Test path: ..\test\tools\llvm-mca\X86\BtVer2\load-store-alias.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\memcpy-like-test.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\pipes-fpu.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\read-advance-1.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\read-advance-2.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\register-files-1.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\register-files-2.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\register-files-3.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\register-files-4.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\register-files-5.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-aes.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-avx1.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-clmul.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-f16c.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-sse1.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-sse2.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-sse3.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-sse41.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-sse42.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-sse4a.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-ssse3.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\scheduler-queue-usage.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\simple-test.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\vec-logic-read-after-ld-1.s
Test path: ..\test\tools\llvm-mca\X86\BtVer2\vec-logic-read-after-ld-2.s

Diff Detail

Event Timeline

gbedwell created this revision.Apr 6 2018, 7:10 AM

Thanks Greg.
I slightly changed some of the tests at r329403.
It should simplify the diff from your patch.

It would be great to use a python3 shebang. These utilities are independent from other (possibly Python 2 specific) Python files

% head -n 1 utils/update_cc_test_checks.py
#!/usr/bin/env python3

It would be great to use a python3 shebang. These utilities are independent from other (possibly Python 2 specific) Python files

% head -n 1 utils/update_cc_test_checks.py
#!/usr/bin/env python3

We still have problems with some dev machines defaulting to python27 - as long as this file runs fine with both python27/pyjthon3 I don't see keeping to python27 as a problem - if its just flipping the shebangs thats a trivial future change,

gbedwell updated this revision to Diff 142425.Apr 13 2018, 9:25 AM

Rebased and made some minor edits. The stderr output is now a bit more verbose about what's actually been changed and it will now only prefix the advert if it has actually successfully written some check lines to that file.

RKSimon accepted this revision.Apr 13 2018, 9:51 AM

LGTM - thanks Greg!

This revision is now accepted and ready to land.Apr 13 2018, 9:51 AM
This revision was automatically updated to reflect the committed changes.