Changeset 103768 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Mar 11, 2024 2:39:16 PM (9 months ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllN8vePython.py
r103756 r103768 659 659 660 660 661 def displayStatistics(aoThreadedFuncs, sHostArch): # type (list(ThreadedFunction)) -> True661 def analyzeThreadedFunctionsForNativeRecomp(aoThreadedFuncs, sHostArch): # type (list(ThreadedFunction)) -> True 662 662 """ 663 663 Displays statistics. … … 667 667 cNative = 0; 668 668 for oThreadedFunction in aoThreadedFuncs: 669 cNativeVariations = 0; 669 670 for oVariation in oThreadedFunction.aoVariations: 670 671 cTotal += 1; 671 672 oVariation.oNativeRecomp = analyzeVariantForNativeRecomp(oVariation, sHostArch); 672 673 if oVariation.oNativeRecomp and oVariation.oNativeRecomp.isRecompilable(): 673 cNative += 1; 674 cNativeVariations += 1; 675 cNative += cNativeVariations; 676 677 # If all variations can be recompiled natively, annotate the threaded 678 # function name accordingly so it'll be easy to spot in the stats. 679 if oThreadedFunction.sSubName: 680 if cNativeVariations == len(oThreadedFunction.aoVariations): 681 aoStmts = oThreadedFunction.oMcBlock.decode(); 682 oStmt = iai.McStmt.findStmtByNames(aoStmts, {'IEM_MC_NATIVE_IF': True,}); 683 if oStmt and NativeRecompFunctionVariation.kdOptionArchToVal[sHostArch] in oStmt.asArchitectures: 684 oThreadedFunction.sSubName += '_ne'; # native emit 685 elif oThreadedFunction.sSubName.find('aimpl') >= 0: 686 oThreadedFunction.sSubName += '_na'; # native aimpl 687 else: 688 oThreadedFunction.sSubName += '_nn'; # native native 689 elif cNativeVariations == 0: 690 oThreadedFunction.sSubName += '_ntodo'; # native threaded todo 691 else: 692 oThreadedFunction.sSubName += '_nm'; # native mixed 693 694 674 695 print('todo: %.1f%% / %u out of %u threaded function variations are recompilable' 675 696 % (cNative * 100.0 / cTotal, cNative, cTotal), file = sys.stderr); -
trunk/src/VBox/VMM/VMMAll/IEMAllThrdPython.py
r103757 r103768 1564 1564 self.dsCImplFlags = {} # type: Dict[str, bool] 1565 1565 ## The unique sub-name for this threaded function. 1566 self.sSubName = '';1566 self.sSubName = ''; 1567 1567 #if oMcBlock.iInFunction > 0 or (oMcBlock.oInstruction and len(oMcBlock.oInstruction.aoMcBlocks) > 1): 1568 1568 # self.sSubName = '_%s' % (oMcBlock.iInFunction); … … 1835 1835 'IEM_MC_MERGE_YREG_U64LOCAL_U64HI_ZX_VLMAX':'__yreg64', 1836 1836 }; 1837 kdAnnotateNameCallStmts = { 1838 'IEM_MC_CALL_CIMPL_0': '__cimpl', 1839 'IEM_MC_CALL_CIMPL_1': '__cimpl', 1840 'IEM_MC_CALL_CIMPL_2': '__cimpl', 1841 'IEM_MC_CALL_CIMPL_3': '__cimpl', 1842 'IEM_MC_CALL_CIMPL_4': '__cimpl', 1843 'IEM_MC_CALL_CIMPL_5': '__cimpl', 1844 'IEM_MC_CALL_CIMPL_6': '__cimpl', 1845 'IEM_MC_CALL_CIMPL_7': '__cimpl', 1846 'IEM_MC_DEFER_TO_CIMPL_0_RET': '__cimpl_defer', 1847 'IEM_MC_DEFER_TO_CIMPL_1_RET': '__cimpl_defer', 1848 'IEM_MC_DEFER_TO_CIMPL_2_RET': '__cimpl_defer', 1849 'IEM_MC_DEFER_TO_CIMPL_3_RET': '__cimpl_defer', 1850 'IEM_MC_DEFER_TO_CIMPL_4_RET': '__cimpl_defer', 1851 'IEM_MC_DEFER_TO_CIMPL_5_RET': '__cimpl_defer', 1852 'IEM_MC_DEFER_TO_CIMPL_6_RET': '__cimpl_defer', 1853 'IEM_MC_DEFER_TO_CIMPL_7_RET': '__cimpl_defer', 1854 'IEM_MC_CALL_VOID_AIMPL_0': '__aimpl', 1855 'IEM_MC_CALL_VOID_AIMPL_1': '__aimpl', 1856 'IEM_MC_CALL_VOID_AIMPL_2': '__aimpl', 1857 'IEM_MC_CALL_VOID_AIMPL_3': '__aimpl', 1858 'IEM_MC_CALL_VOID_AIMPL_4': '__aimpl', 1859 'IEM_MC_CALL_VOID_AIMPL_5': '__aimpl', 1860 'IEM_MC_CALL_AIMPL_0': '__aimpl_ret', 1861 'IEM_MC_CALL_AIMPL_1': '__aimpl_ret', 1862 'IEM_MC_CALL_AIMPL_2': '__aimpl_ret', 1863 'IEM_MC_CALL_AIMPL_3': '__aimpl_ret', 1864 'IEM_MC_CALL_AIMPL_4': '__aimpl_ret', 1865 'IEM_MC_CALL_AIMPL_5': '__aimpl_ret', 1866 'IEM_MC_CALL_AIMPL_6': '__aimpl_ret', 1867 'IEM_MC_CALL_VOID_AIMPL_6': '__aimpl_fpu', 1868 'IEM_MC_CALL_FPU_AIMPL_0': '__aimpl_fpu', 1869 'IEM_MC_CALL_FPU_AIMPL_1': '__aimpl_fpu', 1870 'IEM_MC_CALL_FPU_AIMPL_2': '__aimpl_fpu', 1871 'IEM_MC_CALL_FPU_AIMPL_3': '__aimpl_fpu', 1872 'IEM_MC_CALL_FPU_AIMPL_4': '__aimpl_fpu', 1873 'IEM_MC_CALL_FPU_AIMPL_5': '__aimpl_fpu', 1874 'IEM_MC_CALL_MMX_AIMPL_0': '__aimpl_mmx', 1875 'IEM_MC_CALL_MMX_AIMPL_1': '__aimpl_mmx', 1876 'IEM_MC_CALL_MMX_AIMPL_2': '__aimpl_mmx', 1877 'IEM_MC_CALL_MMX_AIMPL_3': '__aimpl_mmx', 1878 'IEM_MC_CALL_MMX_AIMPL_4': '__aimpl_mmx', 1879 'IEM_MC_CALL_MMX_AIMPL_5': '__aimpl_mmx', 1880 'IEM_MC_CALL_SSE_AIMPL_0': '__aimpl_sse', 1881 'IEM_MC_CALL_SSE_AIMPL_1': '__aimpl_sse', 1882 'IEM_MC_CALL_SSE_AIMPL_2': '__aimpl_sse', 1883 'IEM_MC_CALL_SSE_AIMPL_3': '__aimpl_sse', 1884 'IEM_MC_CALL_SSE_AIMPL_4': '__aimpl_sse', 1885 'IEM_MC_CALL_SSE_AIMPL_5': '__aimpl_sse', 1886 'IEM_MC_CALL_AVX_AIMPL_0': '__aimpl_avx', 1887 'IEM_MC_CALL_AVX_AIMPL_1': '__aimpl_avx', 1888 'IEM_MC_CALL_AVX_AIMPL_2': '__aimpl_avx', 1889 'IEM_MC_CALL_AVX_AIMPL_3': '__aimpl_avx', 1890 'IEM_MC_CALL_AVX_AIMPL_4': '__aimpl_avx', 1891 'IEM_MC_CALL_AVX_AIMPL_5': '__aimpl_avx', 1892 }; 1837 1893 def analyzeAndAnnotateName(self, aoStmts: List[iai.McStmt]): 1838 1894 """ … … 1840 1896 and sets self.sSubName if successfull. 1841 1897 """ 1898 # Operand base naming: 1842 1899 dHits = {}; 1843 1900 cHits = iai.McStmt.countStmtsByName(aoStmts, self.kdAnnotateNameMemStmts, dHits); … … 1847 1904 else: 1848 1905 cHits = iai.McStmt.countStmtsByName(aoStmts, self.kdAnnotateNameRegStmts, dHits); 1849 if not cHits: 1906 if cHits > 0: 1907 sStmtNm = sorted(dHits.keys())[-1]; # priority: STORE, MEM_MAP, FETCH. 1908 sName = self.kdAnnotateNameRegStmts[sStmtNm]; 1909 else: 1910 # No op details, try name it by call type... 1911 cHits = iai.McStmt.countStmtsByName(aoStmts, self.kdAnnotateNameCallStmts, dHits); 1912 if cHits > 0: 1913 sStmtNm = sorted(dHits.keys())[-1]; # Not really necessary to sort, but simple this way. 1914 self.sSubName = self.kdAnnotateNameCallStmts[sStmtNm]; 1850 1915 return; 1851 sStmtNm = sorted(dHits.keys())[-1]; # priority: STORE, MEM_MAP, FETCH. 1852 sName = self.kdAnnotateNameRegStmts[sStmtNm]; 1853 1854 oStmt = iai.McStmt.findStmtByNames(aoStmts, {'IEM_MC_NATIVE_IF': True,}); 1855 if oStmt and oStmt.asArchitectures: 1856 sName += '_n'; ## @todo check if enabled for the host architecture 1916 1917 # Add call info if any: 1918 dHits = {}; 1919 cHits = iai.McStmt.countStmtsByName(aoStmts, self.kdAnnotateNameCallStmts, dHits); 1920 if cHits > 0: 1921 sStmtNm = sorted(dHits.keys())[-1]; # Not really necessary to sort, but simple this way. 1922 sName += self.kdAnnotateNameCallStmts[sStmtNm][1:]; 1923 1857 1924 self.sSubName = sName; 1858 1925 return; … … 1949 2016 return sAnnotation; 1950 2017 1951 def analyze (self, oGenerator):2018 def analyzeThreadedFunction(self, oGenerator): 1952 2019 """ 1953 2020 Analyzes the code, identifying the number of parameters it requires and such. … … 2542 2609 dMinParamCounts = {}; 2543 2610 for oThreadedFunction in self.aoThreadedFuncs: 2544 oThreadedFunction.analyze (self);2611 oThreadedFunction.analyzeThreadedFunction(self); 2545 2612 for oVariation in oThreadedFunction.aoVariations: 2546 2613 dRawParamCounts[len(oVariation.dParamRefs)] = dRawParamCounts.get(len(oVariation.dParamRefs), 0) + 1; … … 2584 2651 # Analyze the threaded functions and their variations for native recompilation. 2585 2652 if fNativeRecompilerEnabled: 2586 ian. displayStatistics(self.aoThreadedFuncs, sHostArch);2653 ian.analyzeThreadedFunctionsForNativeRecomp(self.aoThreadedFuncs, sHostArch); 2587 2654 2588 2655 # Gather arguments + variable statistics for the MC blocks.
Note:
See TracChangeset
for help on using the changeset viewer.