Skip to content

Platform plugin interface: Cortex-M pilot - #230

Draft
marchioa wants to merge 25 commits into
pulp-platform:develfrom
FondazioneChipsIT:am/plugin-interface
Draft

marchioa wants to merge 25 commits into
pulp-platform:develfrom
FondazioneChipsIT:am/plugin-interface

Conversation

@marchioa

@marchioa marchioa commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Draft, stacked on #229. Review only the commits after LINT: enforce PEP 8 naming with ruff in pre-commit.

Platforms register themselves through Python entry points, so core and the test harness no longer name them. Cortex-M (QEMU-ARM) is the pilot. After this PR, core, the harness and the CMake files do not mention it, and everything Cortex-M lives in deeploy/targets/cortexm/.

Follow-up, in a separate PR: Extract deeploy/targets/cortexm/ into its own deeploy-cortexm distribution, and remove the last Cortex-M names from the CLI runners and deeployStateEqualityTest.py

After pulling, existing clones need git submodule sync && git submodule update --init (CMSIS-NN moved). The old TargetLibraries/CMSIS/third_party/CMSIS-NN checkout can be deleted.

Added

  • deeploy/plugins.py: PlatformPlugin and discovery through the deeploy.platforms entry-point group (API version 1). Only the selected platform is imported.
  • deeploy/targets/cortexm/plugin.py: Cortex-M registers itself as QEMU-ARM.
  • deeploy/targets/cortexm/tests.py: the Cortex-M test list, registered under a separate deeploy.platform_tests group so test data stays out of the plugin API. DeeployTest/test_utils/platform_tests.py loads it; test_platforms.py generates the tests and conftest.py registers the markers.
  • deeploy/targets/cortexm/cmake/platform.cmake: the Cortex-M build, included by the top-level CMakeLists.txt from the plugin's cmake_dir.
  • import-linter in pre-commit: only deeploy.targets.cortexm may import deeploy.targets.cortexm. The scripts directly in DeeployTest/ are not packages and are not checked yet.
  • DeeployTest/test_plugins.py: unit tests for plugin discovery.

Changed

  • platform_mapping.py and generateNetwork.py get the platform, deployer and defaults from the plugin. emulate_cmsis_requant replaces the isinstance(CMSISPlatform) check for EmulateCMSISRequantPass.
  • testMemoryLevelExtension.py builds its mock deployer from any plugin, with no per-platform branch.
  • The harness passes the plugin's cmake_dir as -DDEEPLOY_PLATFORM_CMAKE_DIR. Configuring CMake by hand for QEMU-ARM now also needs -DDEEPLOY_PLATFORM_CMAKE_DIR=deeploy/targets/cortexm/cmake.
  • Cortex-M files gathered in deeploy/targets/cortexm/ (pure moves): cmake/cmsis → cmake/, TargetLibraries/CMSIS → lib/, DeeployTest/Platforms/QEMU_ARM → test_app/, CMSIS-NN → third_party/CMSIS-NN. packages.find excludes third_party, so CMSIS-NN's scripts stay out of the wheel.

Fixed

  • Invalid \% escapes in the Cortex-M CLCA template: a SyntaxWarning since Python 3.12, and an error under pytest's filterwarnings. The strings are the same, so the generated code is unchanged.

Removed

  • test_cortexm_config.py: the tests come from the manifest.
  • testEngineAwareOptimizerWrapper.py, testComponentGraph.py and test_utils/graph_coloring.py: they imported modules that never existed in the public repository, and no test ran them.
  • The unused Apollo3 and Apollo4 platform names.

PR Merge Checklist

  1. The PR is rebased on the latest devel commit and pointing to devel.
  2. Your PR reviewed and approved.
  3. All checks are passing.
  4. The CHANGELOG.md file has been updated.
  5. If the docker was modified, change back its link after review.

marchioa added a commit to FondazioneChipsIT/Deeploy that referenced this pull request Dec 4, 2026
and convert one-element arrays explicitly and keep generated code identical
marchioa added a commit to FondazioneChipsIT/Deeploy that referenced this pull request Dec 4, 2026
@marchioa
marchioa force-pushed the am/plugin-interface branch from 29ead00 to 1acbe6f Compare December 4, 2026 11:08
- ConvTransposeLayer.computeShapes: in_shapes / out_shapes.
- TilingVariableReplacement.apply: the snippet's representation becomes snippet_op_repr,
  which would otherwise collide with operatorRepresentation -> op_repr
- map: CSV of the derived module/package names, for review
- apply: rename imports, paths and files; add the Deeploy.py alias
…ename/module_rename.py)

Old import paths keep working through Deeploy.py for one release.
testEngineAwareOptimizerWrapper.py and testComponentGraph.py import
modules that never existed in the public repository.
No test or CI job runs them.
test_utils/graph_coloring.py was used only by these two.
@marchioa
marchioa force-pushed the am/plugin-interface branch from 1acbe6f to 4b2c8cf Compare December 4, 2026 14:11

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant