-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Merge 1.18 #6038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge 1.18 #6038
Conversation
By moving code to ITCM, like vm, gc, parse, runtime. The change affects mostly the execution speed of MicroPython code. The speed is increased by up to a factor of 6, especially for MCU with small cache.
There is no release of IDF v4.4 yet but master is now on v5.0-dev so a specific commit must be chosen to stick to v4.4. Signed-off-by: Damien George <[email protected]>
This forwards through directly to the NimBLE and BTStack connect functions. Signed-off-by: Jim Mussared <[email protected]>
We will use this fork for adding further features and patches to support MicroPython. Signed-off-by: Jim Mussared <[email protected]>
We're using the MicroPython fork of NimBLE, which on the `micropython_1_4_0` branch re-adds support for 64-bit targets and fixes initialisation of g_msys_pool_list. Also updates modbluetooth_nimble.c to suit v1.4. Signed-off-by: Jim Mussared <[email protected]>
This was fixed in NimBLE 1.4. Signed-off-by: Jim Mussared <[email protected]>
This will be used by https://micropython.org/download/ to generate the full listing of boards and firmware files. Optionally supports a board.md for additional customisation of the download page, as well as deploy.md for flashing instructions. Signed-off-by: Jim Mussared <[email protected]>
Signed-off-by: Jim Mussared <[email protected]>
In particular the UM S2 boards (and update the features list). Signed-off-by: Jim Mussared <[email protected]>
Following on from ba94025, the change here makes output about 15 times faster (now up to about 550 kbytes/sec). tinyusb_cdcacm_write_queue will return the number of bytes written, so there's no need to use tud_cdc_n_write_available. Signed-off-by: Damien George <[email protected]>
Prior to this commit IRQs on STM32F4 could be lost because SR is cleared by reading SR then reading DR. For example, if both RXNE and IDLE IRQs were active upon entry to the IRQ handler, then IDLE is lost because the code that handles RXNE comes first and accidentally clears SR (by reading SR then DR to get the incoming character). This commit fixes this problem by making the IRQ handler more atomic in the following operations: - get current IRQ status flags - deal with RX character - clear remaining status flags - call user handler On the STM32F4 it's very hard to get this right because the only way to clear IRQ status flags is to read SR then DR, but the read of DR may read some data which should remain in the register until the user wants to read it. And it won't work to cache the read because RTS/CTS flow control will then not work. So instead the new code disables interrupts if the DR is full and waits for the user to read it before reenabling the interrupts. Fixes issue mentioned in adafruit#4599 and adafruit#6082. Signed-off-by: Damien George <[email protected]>
Signed-off-by: Damien George <[email protected]>
To simplify the config. This commit does not change the build. Signed-off-by: Damien George <[email protected]>
Signed-off-by: Damien George <[email protected]>
Some of these will later be moved to CORE or BASIC, but EXTRA is a good starting point based on what stm32 uses. Signed-off-by: Jim Mussared <[email protected]>
This commit is a no-op change. Future improvements can come from making individual boards use CORE or BASIC. Signed-off-by: Jim Mussared <[email protected]>
This commit is a no-op change to simplify existing config. Signed-off-by: Jim Mussared <[email protected]>
This is an stm32-specific feature that's accessed via the pyb module, so not something that will be widely enabled. Signed-off-by: Damien George <[email protected]>
Computed goto costs 1800 bytes for 5-10% performance. Map caching and attr fast path costs 130 bytes for up to 30%. Net effect of those three optimisations: bm_chaos.py +16.059% (+/-0.09%) bm_fannkuch.py +11.145% (+/-0.01%) bm_fft.py +14.604% (+/-0.01%) bm_float.py +26.849% (+/-0.08%) bm_hexiom.py +34.039% (+/-0.03%) bm_nqueens.py +18.333% (+/-0.06%) bm_pidigits.py +4.472% (+/-0.03%) misc_aes.py +28.765% (+/-0.09%) misc_mandel.py +27.116% (+/-0.05%) misc_pystone.py +40.299% (+/-0.20%) misc_raytrace.py +22.812% (+/-0.07%) Also enable other EXTRA-level optimisations (module const, return_if_expr, triple_tuple_assign, factorial, mpz bitwise). Signed-off-by: Jim Mussared <[email protected]>
This makes it possible for cooperative multitasking systems to keep running event loops during garbage collector operations. For example, this can be used to ensure that a motor control loop runs approximately each 5 ms. Without this hook, the loop time can jump to about 15 ms. Addresses adafruit#3475. Signed-off-by: Laurens Valk <[email protected]>
Word-size specific configuration is now done automatically, so it no longer requires this to match the ARM configuration. Also it's less common to have 32-bit compilation support installed, so this will make it work "out of the box" for more people. Signed-off-by: Jim Mussared <[email protected]>
.. which occurs during qstring generation.
.. -mcache-lookup-bc is gone and forgotten
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IThank you for doing this! looked this over and I don't see anything. I want to check for asyncio.py whether we need both __await__()
and __iter__()
, but that should not affect this merge.
Do we need to change our frozen module specifications to use manifests? I don't see any changes to any mpconfigboard.mk
files.
I would rather wait and merge this after 7.2.0, because of the possibility of unforeseen problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For what it's worth I looked through and didn't notice anything that I think would cause any issues. If I get a moment later I'll try to build it and run it on a couple boards (I'll see if I have one that uses frozen modules to test that).
Tested on both a Feather nRF52840 and an UnexpectedMaker FeatherS2 both with the base build and a custom build where I included a frozen module to ensure it was included and loaded. Both worked. |
Did you try enabling the performance changes? What was the outcome? |
Does the below code have to change? It is referencing circuitpython/py/circuitpy_mpconfig.mk Line 167 in 16c44a4
|
No, I didn't want to complicate things or make this PR harder to merge. |
I think it may be worth spending a little time on the performance stuff to see if it's difficult. I think it's the headline change of 1.18 so MP knowledgeable folks may expect it when we promote that we've merged in 1.18. |
I'm now a bit confused. There are signs of LOAD_ATTR_FAST_PATH in main, which is enabled by default, but no supporting code for it. So this has become enabled during this merge of v1.18 -- see 53c5bde. I can go ahead and enable the cache on FULL_BUILD targets; it costs another ~264 bytes of code and 128 bytes of RAM. |
.. and remove a stanza for the "cache map lookup in bytecode" option, which has been removed by upstream in 1.18; it's superceded by these other improvements.
Sounds perfect! Thank you for looking into this. |
With both performance knobs turned to "go fast", a little loop on rp2040 became nearly 20% faster:
Before: 6.58µs/loop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! 🚀
Highlights:
A small amount of code size reduction may have taken place thanks to general code size reductions of the core.
For all MicroPython 1.18 release notes, many of which do not apply to CircuitPython, see https://github.com/micropython/micropython/releases/tag/v1.18
Status / checklist:
make VARIANT=coverage test
passesBoards tested: