Message406471
Here are the 3 steps to reproduce with minimal pgo training. (vs2019)
1. Download the source archive of PR29565 and extract.
https://github.com/python/cpython/archive/6a84d61c55f2e543cf5fa84522d8781a795bba33.zip
2. Apply the following patch.
==============================
--- PCbuild/build.bat
+++ PCbuild/build.bat
@@ -66 +66 @@
-set pgo_job=-m test --pgo
+set pgo_job=-c"pass"
--- PCbuild/pyproject.props
+++ PCbuild/pyproject.props
@@ -47,2 +47,3 @@
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalOptions Condition="$(SupportPGO) and $(Configuration) == 'PGUpdate'">/d2inlinelogfull:_PyEval_EvalFrameDefault %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
==============================
3. Build [Rebuild]
PCbuild\build --no-tkinter --pgo > build.log [-r]
According to the inlining section in the log, any function that has one or more conditional expressions got "reject" from inliner.
> Inlinee for function _PyEval_EvalFrameDefault
> -_Py_EnsureFuncTstateNotNULL (pgo hard reject)
> ...
> _Py_INCREF (pgu decision)
> _Py_INCREF (pgu decision)
> -_Py_XDECREF (pgo hard reject)
> -_Py_XDECREF (pgo hard reject)
> -_Py_DECREF (pgo hard reject)
> -_Py_DECREF (pgo hard reject)
> ...
Profiling scores can be shown on VS2019 Command Prompt.
pgomgr PCbuild\amd64\python311.pgd /summary [/detail] > largefile.txt
* pgomgr.exe (or profile itself) has an issue.
https://developercommunity.visualstudio.com/t/1560909
Unused opcodes in this training
ROT_THREE, DUP_TOP_TWO, UNARY_POSITIVE, UNARY_NEGATIVE,
BINARY_OP_ADD_FLOAT, UNARY_INVERT, BINARY_OP_MULTIPLY_INT,
BINARY_OP_MULTIPLY_FLOAT, GET_LEN, MATCH_MAPPING, MATCH_SEQUENCE,
MATCH_KEYS, LOAD_ATTR_SLOT, LOAD_METHOD_CLASS, GET_AITER, GET_ANEXT,
BEFORE_ASYNC_WITH, END_ASYNC_FOR, STORE_ATTR_SLOT,
STORE_ATTR_WITH_HINT, GET_YIELD_FROM_ITER, PRINT_EXPR, YIELD_FROM,
GET_AWAITABLE, LOAD_ASSERTION_ERROR, SETUP_ANNOTATIONS, UNPACK_EX,
DELETE_ATTR, DELETE_GLOBAL, ROT_N, COPY, DELETE_DEREF,
LOAD_CLASSDEREF, MATCH_CLASS, SET_UPDATE, DO_TRACING
I managed to activate inliner experimentally by removing the 36 op-cases from switch and merging/removing many macros.
Static instruction counts of _PyEval_EvalFrameDefault()
PR29565 : 6882 (down to 4400 with above change)
PR29482 : 7035
PR29482~1 : 7742
3.10.0+ : 3980 (well inlined sharing DISPATCH macro)
3.10.0 : 5559
3.10b1 : 5680
3.10a7 : 4117 (well inlined) |
|
Date |
User |
Action |
Args |
2021-11-17 14:26:10 | neonene | set | recipients:
+ neonene, lemburg, gvanrossum, rhettinger, paul.moore, vstinner, tim.golden, Mark.Shannon, zach.ware, steve.dower, malin, pablogsal, brandtbucher, erlendaasland, kj |
2021-11-17 14:26:10 | neonene | set | messageid: <1637159170.1.0.96621397837.issue45116@roundup.psfhosted.org> |
2021-11-17 14:26:10 | neonene | link | issue45116 messages |
2021-11-17 14:26:09 | neonene | create | |
|