- Timestamp:
- Oct 12, 2024 4:40:07 AM (7 weeks ago)
- Location:
- trunk/src/VBox/ValidationKit/bootsectors
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-instr-3.c32
r106061 r106300 575 575 576 576 577 /* 578 * Code to make testing the tests faster. `bs3CpuInstr3_SkipIt()' randomly 579 * skips a large fraction of the micro-tests. It is sufficiently random 580 * that over a large number of runs, all micro-tests will be hit. 581 * 582 * This improves the runtime of the worst case (`#define ALL_TESTS' on a 583 * debug build, run with '--execute-all-in-iem') from ~9000 to ~800 seconds 584 * (on an Intel Core i7-10700, fwiw). 585 * 586 * To activate this 'developer's speed-testing mode', turn on 587 * `#define BS3_SKIPIT_DO_SKIP' here. 588 * 589 * BS3_SKIPIT_AVG_SKIP governs approximately how many micro-tests are 590 * skipped in a row; e.g. the default of 26 means about every 27th 591 * micro-test is run during a particular test run. (This is not 27x 592 * faster due to other activities which are not skipped!) Note this is 593 * only an average; the actual skips are random. 594 * 595 * You can also modify bs3CpuInstr3_SkipIt() to focus on specific sub-tests, 596 * using its (currently ignored) `bRing, iCfg, iTest, iVal, iVariant' args 597 * (to enable this: turn on `#define BS3_SKIPIT_DO_ARGS': which costs about 598 * 3% performance). 599 * 600 * Note! The skipping is not compatible with testing the native recompiler as 601 * it requires the test code to be run a number of times before it kicks 602 * in and does the native recompilation (currently around 16 times). 603 */ 604 #define BS3_SKIPIT_AVG_SKIP 26 605 #define BS3_SKIPIT_REPORT_COUNT 150000 606 #undef BS3_SKIPIT_DO_SKIP 607 #undef BS3_SKIPIT_DO_ARGS 608 609 #ifndef BS3_SKIPIT_DO_SKIP 610 # define BS3_SKIPIT(bRing, iCfg, iTest, iVal, iVariant) (false) 611 #else 612 # include <iprt/asm-amd64-x86.h> 613 # include <iprt/asm-math.h> 614 615 DECLINLINE(uint32_t) bs3CpuInstr3_SimpleRand(void) 577 #include <iprt/asm-amd64-x86.h> 578 #include <iprt/asm-math.h> 579 580 DECLINLINE(uint32_t) bs3CpuInstrX_SimpleRand(void) 616 581 { 617 582 /* … … 631 596 uint32_t uVal = s_uSeedMemory; 632 597 if (!uVal) 598 { 633 599 uVal = (uint32_t)ASMReadTSC(); 600 Bs3TestPrintf("PRNG initial seed: 0x%08lx\n", uVal); 601 } 634 602 uVal = ASMModU64ByU32RetU32(ASMMult2xU32RetU64(uVal, 16807), INT32_MAX); 635 603 s_uSeedMemory = uVal; … … 637 605 } 638 606 607 608 /* 609 * Code to make testing the tests faster. `bs3CpuInstrX_SkipIt()' randomly 610 * skips a fraction of the micro-tests. It is sufficiently random that 611 * over a large number of runs, all micro-tests will be hit. 612 * 613 * Full test runs take ever longer as we add more instructions and fancier 614 * ways of testing them. In one example scenario, a debug build running 615 * bs3-cpu-instr-3 under interpreted IEM went from 9000 to 800 seconds, 616 * with BS3_SKIPIT_AVG_SKIP set to 26. 617 * 618 * To activate this 'developer's speed-testing mode', define 619 * `BS3_SKIPIT_AVG_SKIP' to a positive integer like 10 or 200. 620 * 621 * BS3_SKIPIT_AVG_SKIP governs approximately how many micro-tests are 622 * skipped in a row; e.g. if set to 100, an average of 100 micro-tests 623 * in a row are skipped. (This is not a full 100x faster, due to other 624 * activities which are not skipped!) Note this is only an average; 625 * the actual skips are random. 626 * 627 * You can also modify bs3CpuInstrX_SkipIt() to focus on specific sub-tests, 628 * using its (currently ignored) `bRing, iCfg, iTest, iVal, iVariant' args 629 * (to enable this: turn on `#define BS3_SKIPIT_DO_ARGS': which costs about 630 * 3% performance). 631 * 632 * Note! For testing the native recompiler, configure the VM to invoke 633 * native recompilation quickly with: 634 * 635 * VBoxManage setextradata vmname VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled 1 636 * VBoxManage setextradata vmname VBoxInternal/Devices/VMMDev/0/Config/TestingThresholdNativeRecompiler 2 637 * VBoxManage setextradata vmname VBoxInternal/IEM/NativeRecompileAtUsedCount 1 638 */ 639 #define BS3_SKIPIT_AVG_SKIP 0 640 #define BS3_SKIPIT_REPORT_COUNT 1000000 641 #undef BS3_SKIPIT_DO_ARGS 642 639 643 static unsigned g_cSeen, g_cSkipped; 640 644 641 static void bs3CpuInstr3_ShowTallies(void) 642 { 645 static void bs3CpuInstrX_ShowTallies(bool always) 646 { 647 if (!g_cSkipped && !always) return; 643 648 Bs3TestPrintf("Micro-tests %d: tested %d / skipped %d\n", g_cSeen, g_cSeen - g_cSkipped, g_cSkipped); 644 649 } 645 650 646 651 # ifdef BS3_SKIPIT_DO_ARGS 647 # define BS3_SKIPIT(bRing, iCfg, iTest, iVal, iVariant) bs3CpuInstr 3_SkipIt(bRing, iCfg, iTest, iVal, iVariant)648 static bool bs3CpuInstr 3_SkipIt(uint8_t bRing, unsigned iCfg, unsigned iTest, unsigned iVal, unsigned iVariant)652 # define BS3_SKIPIT(bRing, iCfg, iTest, iVal, iVariant) bs3CpuInstrX_SkipIt(bRing, iCfg, iTest, iVal, iVariant) 653 static bool bs3CpuInstrX_SkipIt(uint8_t bRing, unsigned iCfg, unsigned iTest, unsigned iVal, unsigned iVariant) 649 654 # else 650 # define BS3_SKIPIT(bRing, iCfg, iTest, iVal, iVariant) bs3CpuInstr 3_SkipIt()651 static bool bs3CpuInstr 3_SkipIt(void)655 # define BS3_SKIPIT(bRing, iCfg, iTest, iVal, iVariant) bs3CpuInstrX_SkipIt() 656 static bool bs3CpuInstrX_SkipIt(void) 652 657 # endif 653 658 { … … 657 662 /* Cache calls to the relatively expensive random routine */ 658 663 if (!s_uTimes) 659 s_uTimes = bs3CpuInstr 3_SimpleRand() % (BS3_SKIPIT_AVG_SKIP * 2 + 1) + 1;664 s_uTimes = bs3CpuInstrX_SimpleRand() % (BS3_SKIPIT_AVG_SKIP * 2 + 1) + 1; 660 665 fSkip = --s_uTimes > 0; 661 666 if (fSkip) … … 663 668 664 669 if (++g_cSeen % BS3_SKIPIT_REPORT_COUNT == 0) 665 bs3CpuInstr 3_ShowTallies();670 bs3CpuInstrX_ShowTallies(false); 666 671 return fSkip; 667 672 } 668 669 #endif /* BS3_SKIPIT_DO_SKIP */670 673 671 674 … … 16246 16249 */ 16247 16250 Bs3TestDoModesByOne_pe32(g_aTests, RT_ELEMENTS(g_aTests), BS3TESTMODEBYONEENTRY_F_REAL_MODE_READY); 16248 #ifdef BS3_SKIPIT_DO_SKIP 16249 bs3CpuInstr3_ShowTallies(); 16250 #endif 16251 bs3CpuInstrX_ShowTallies(true); 16251 16252 } 16252 16253 else -
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-instr-4.c32
r106299 r106300 2273 2273 * ways of testing them. In one example scenario, a debug build running 2274 2274 * bs3-cpu-instr-3 under interpreted IEM went from 9000 to 800 seconds, 2275 * with BS3_SKIPIT_AVG_SKIP on the default26.2275 * with BS3_SKIPIT_AVG_SKIP set to 26. 2276 2276 * 2277 * To activate this 'developer's speed-testing mode', turn on2278 * ` #define BS3_SKIPIT_DO_SKIP' here.2277 * To activate this 'developer's speed-testing mode', define 2278 * `BS3_SKIPIT_AVG_SKIP' to a positive integer like 10 or 200. 2279 2279 * 2280 2280 * BS3_SKIPIT_AVG_SKIP governs approximately how many micro-tests are 2281 * skipped in a row; e.g. the default of 26 means that on average, every2282 * 26th micro-test is run during a particular test run. (This is not 26x2283 * faster, due to other activities which are not skipped!) Note this is2284 * only an average;the actual skips are random.2281 * skipped in a row; e.g. if set to 100, an average of 100 micro-tests 2282 * in a row are skipped. (This is not a full 100x faster, due to other 2283 * activities which are not skipped!) Note this is only an average; 2284 * the actual skips are random. 2285 2285 * 2286 2286 * You can also modify bs3CpuInstrX_SkipIt() to focus on specific sub-tests, … … 2296 2296 * VBoxManage setextradata vmname VBoxInternal/IEM/NativeRecompileAtUsedCount 1 2297 2297 */ 2298 #define BS3_SKIPIT_AVG_SKIP 262298 #define BS3_SKIPIT_AVG_SKIP 0 2299 2299 #define BS3_SKIPIT_REPORT_COUNT 1000000 2300 #undef BS3_SKIPIT_DO_SKIP2301 2300 #undef BS3_SKIPIT_DO_ARGS 2302 2301 2303 2302 #ifdef DEBUG_ramshankar 2304 # undef BS3_SKIPIT_DO_SKIP2305 # define BS3_SKIPIT_DO_SKIP2306 2303 # undef BS3_SKIPIT_AVG_SKIP 2307 # define BS3_SKIPIT_AVG_SKIP 802304 # define BS3_SKIPIT_AVG_SKIP 80 2308 2305 #endif 2309 2306 2310 #ifndef BS3_SKIPIT_DO_SKIP2311 # define BS3_SKIPIT(bRing, iCfg, iTest, iVal, iVariant) (false)2312 #else2313 2307 static unsigned g_cSeen, g_cSkipped; 2314 2308 2315 static void bs3CpuInstrX_ShowTallies( void)2309 static void bs3CpuInstrX_ShowTallies(bool always) 2316 2310 { 2311 if (!g_cSkipped && !always) return; 2317 2312 Bs3TestPrintf("Micro-tests %d: tested %d / skipped %d\n", g_cSeen, g_cSeen - g_cSkipped, g_cSkipped); 2318 2313 } … … 2337 2332 2338 2333 if (++g_cSeen % BS3_SKIPIT_REPORT_COUNT == 0) 2339 bs3CpuInstrX_ShowTallies( );2334 bs3CpuInstrX_ShowTallies(false); 2340 2335 return fSkip; 2341 2336 } 2342 2337 2343 #endif /* BS3_SKIPIT_DO_SKIP */2344 2338 2345 2339 /* … … 14741 14735 */ 14742 14736 Bs3TestDoModesByOne_pe32(g_aTests, RT_ELEMENTS(g_aTests), BS3TESTMODEBYONEENTRY_F_REAL_MODE_READY); 14743 #ifdef BS3_SKIPIT_DO_SKIP 14744 bs3CpuInstrX_ShowTallies(); 14745 #endif 14737 bs3CpuInstrX_ShowTallies(true); 14746 14738 } 14747 14739 else
Note:
See TracChangeset
for help on using the changeset viewer.