Rescheduling native compiler passes. #15212
Unanswered
agatti
asked this question in
Core Development
Replies: 1 comment
-
The Thumb2 emitter has a lot of instructions that are varying length; see eg Note that the bytecode emitter does have cases where the bytecode can change size in the last pass, and in that case is does request another pass from the compiler, until the bytecode size stops changing. But there, the bytecode can only decrease in size in the final pass(es), which makes it simpler. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As per subject, is it possible to reschedule compiler passes from a native code generator backend? Or if not, can that be worked around without patching too much code?
On RISC-V most of the code sequence generators to implement for a native code backend can have different sequences of varying length depending on the input values and that doesn't seem to play nicely with how the compiler expects things to be.
From what I understand, the compiler only passes the correct values to generate code for on the last pass, and by then the code should not change in length (as per what's in
docs/develop/compiler.rst
and the assertion atpy/asmbase.c
on line 93). The problem is that I generate wrong code sequences until it's too late for the compiler to handle.I worked around that by padding code blocks with NOPs, but for the average function the result is having a generated native block that's more than 30% made up of NOPs.
I can probably patch the ASM API by changing the return code for ASM_END_PASS into a boolean indicating whether the pass must be re-run or not and act accordingly, but in that case would the compiler throw away what it computed thus far making this pointless?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions