These changes are to allow to a Result object to have nested Result objects in order to support microbenchmarks. Currently lit is restricted to reporting one result object for one test, this change provides support for when a test that wants to report individual timings for individual kernels.
This is revision is result of the discussions in https://reviews.llvm.org/D32272#794759, https://reviews.llvm.org/D37421#f8003b27 and https://reviews.llvm.org/D38496 that I have seen. It is a separation of the changes purposed in https://reviews.llvm.org/D40077.
With this change I will be adding the LCALS (Livermore Compiler Analysis Loop Suite) collection of loop kernels to the llvm test suite using the google benchmark library (https://reviews.llvm.org/D43319).
Previously microbenchmarks had been handled by using macros to section groups of microbenchmarks together and build many executables while still getting a grouped timing (MultiSource/TSVC). Recently the google benchmark library was added to the test suite and utilized with a litsupport plugin. However the limitation of 1 test 1 result limited its use to passing a runtime option to run only 1 microbenchmark with several hand written tests (MicroBenchmarks/XRay). This runs the same executable many times with different hand written tests. I will update the litsupport plugin to utilize the new functionality (https://reviews.llvm.org/D43316).
These changes allow lit to report micro test results if desired in order to get many precise timing results from 1 run of 1 test executable.
Example Output from LCALS:
Terminal:
PASS: test-suite :: MicroBenchmarks/LCALS/SubsetBRawLoops/lcalsBRaw.test (1 of 1) ********** TEST 'test-suite :: MicroBenchmarks/LCALS/SubsetBRawLoops/lcalsBRaw.test' RESULTS ********** MicroBenchmarks: 12 compile_time: 6.9610 hash: "5075a3ae907cf9631cdc4cf8401cbfb3" link_time: 0.0426 ********** *** MICRO-TEST: BM_IF_QUAD_RAW/171 exec_time: 2.6995 *** MICRO-TEST: BM_IF_QUAD_RAW/44217 exec_time: 698.8880 *** MICRO-TEST: BM_IF_QUAD_RAW/5001 exec_time: 78.9838 *** MICRO-TEST: BM_INIT3_RAW/171 exec_time: 0.2248 *** MICRO-TEST: BM_INIT3_RAW/44217 exec_time: 168.0970 *** MICRO-TEST: BM_INIT3_RAW/5001 exec_time: 15.1119 *** MICRO-TEST: BM_MULADDSUB_RAW/171 exec_time: 0.4491 *** MICRO-TEST: BM_MULADDSUB_RAW/44217 exec_time: 169.6760 *** MICRO-TEST: BM_MULADDSUB_RAW/5001 exec_time: 16.1443 *** MICRO-TEST: BM_TRAP_INT_RAW/171 exec_time: 2.0922 *** MICRO-TEST: BM_TRAP_INT_RAW/44217 exec_time: 540.9620 *** MICRO-TEST: BM_TRAP_INT_RAW/5001 exec_time: 61.1846
Partial JSON output:
"tests": [ { "code": "PASS", "elapsed": null, "metrics": { "exec_time": 540.962 }, "name": "test-suite :: MicroBenchmarks/LCALS/SubsetBRawLoops/lcalsBRaw.test:BM_TRAP_INT_RAW/44217", "output": "" }, { "code": "PASS", "elapsed": null, "metrics": { "exec_time": 2.6995 }, "name": "test-suite :: MicroBenchmarks/LCALS/SubsetBRawLoops/lcalsBRaw.test:BM_IF_QUAD_RAW/171", "output": "" }, { "code": "PASS", "elapsed": null, "metrics": { "exec_time": 169.676 }, "name": "test-suite :: MicroBenchmarks/LCALS/SubsetBRawLoops/lcalsBRaw.test:BM_MULADDSUB_RAW/44217", "output": "" }, { "code": "PASS", "elapsed": null, "metrics": { "exec_time": 168.097 }, "name": "test-suite :: MicroBenchmarks/LCALS/SubsetBRawLoops/lcalsBRaw.test:BM_INIT3_RAW/44217", "output": "" }, { "code": "PASS", "elapsed": null, "metrics": { "exec_time": 16.1443 }, "name": "test-suite :: MicroBenchmarks/LCALS/SubsetBRawLoops/lcalsBRaw.test:BM_MULADDSUB_RAW/5001", "output": "" }, { "code": "PASS", "elapsed": null, "metrics": { "exec_time": 61.1846 }, "name": "test-suite :: MicroBenchmarks/LCALS/SubsetBRawLoops/lcalsBRaw.test:BM_TRAP_INT_RAW/5001", "output": "" },
IIRC Python 2.x and 3.x behave different regarding .items().
Do we force Python 3 for LIT?