Skip to content

Enable Arm VGF delegate in pybind builds#19223

Open
robell wants to merge 2 commits intopytorch:mainfrom
robell:arm_pybind
Open

Enable Arm VGF delegate in pybind builds#19223
robell wants to merge 2 commits intopytorch:mainfrom
robell:arm_pybind

Conversation

@robell
Copy link
Copy Markdown
Collaborator

@robell robell commented Apr 30, 2026

  • Enable VGF in pybind build if directed by env var.
  • Use VGF pybind in the wheel builds, based on package availability.

Change-Id: I63caf3a3691022c83468a9c45f30884222779d33

Summary

This adds VGF runtime delegate to end pip installs, and gives the option for ./install_executorch.sh to include it for developer side.

It'll need some testing of the wheel building to check that works reliably, but it's designed to fall back to the "normal" wheel builds if the dependencies aren't available.

This tidies up vgf with runtime installation further to the following:

  1. developer flows ./examples/arm/setup.sh --enable-mlsdk-deps export EXECUTORCH_PYBIND_ENABLE_VGF=ON ./install_executorch.sh --editable --optional-dependency vgf

  2. wheel builds: # will invoke .ci/scripts/wheel/pre_build_script.sh # suitable platforms have EXECUTORCH_PYBIND_ENABLE_VGF=ON set

  3. end users: pip install executorch[vgf] # published wheels contain runtime delegate on supported platforms

I'd still like to remove emulation_layer from the requirements as a platform setup item (vulkan and emulated vs real is a property of the platform we land on, not our problem to solve).

cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson

- Enable VGF in pybind build if directed by env var.
- Use VGF pybind in the wheel builds, based on package availability.

This tidies up vgf with runtime installation further to the following:

1. developer flows
 ./examples/arm/setup.sh --enable-mlsdk-deps
 export EXECUTORCH_PYBIND_ENABLE_VGF=ON
 ./install_executorch.sh --editable --optional-dependency vgf

2. wheel builds:
 # will invoke .ci/scripts/wheel/pre_build_script.sh
 # suitable platforms have EXECUTORCH_PYBIND_ENABLE_VGF=ON set

3. end users:
 pip install executorch[vgf]
 # published wheels contain runtime delegate on supported platforms

I'd still like to remove emulation_layer from the requirements as a
platform setup item (vulkan and emulated vs real is a property of the
platform we land on, not our problem to solve).

Change-Id: I63caf3a3691022c83468a9c45f30884222779d33
Signed-off-by: Rob Elliott <Robert.Elliott@arm.com>
Copilot AI review requested due to automatic review settings April 30, 2026 11:00
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Apr 30, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19223

Note: Links to docs will display an error until the docs builds have been completed.

❌ 258 New Failures, 17 Unrelated Failures

As of commit f96ed0e with merge base d6f1625 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 30, 2026
@github-actions github-actions Bot added ciflow/trunk module: arm Issues related to arm backend labels Apr 30, 2026
@github-actions
Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in mechanism to build and ship the Arm VGF delegate in Python (pybind) builds, including CI wheel builds that can gracefully fall back when VGF inputs aren’t available.

Changes:

  • Gate EXECUTORCH_BUILD_VGF (and currently also Vulkan) in the pybind preset via EXECUTORCH_PYBIND_ENABLE_VGF.
  • Split Arm VGF pip requirements into AoT vs runtime (requirements-arm-vgf.txt vs new requirements-arm-vgf-runtime.txt) and update Arm setup flow accordingly.
  • Update wheel pre-build script to enable VGF when the runtime pip package can be installed.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/cmake/preset/pybind.cmake Adds env-var-driven enablement for VGF (and Vulkan) in pybind preset on Linux/macOS.
examples/arm/setup.sh Installs Arm VGF AoT vs runtime pip dependencies based on selected flags.
backends/arm/scripts/setup-mlsdk-from-source.sh Updates “keep in sync” comment to include the new runtime requirements file.
backends/arm/requirements-arm-vgf.txt Removes ai_ml_sdk_vgf_library from the AoT requirements list.
backends/arm/requirements-arm-vgf-runtime.txt New runtime requirements file for VGF library pip dependency.
CMakeLists.txt Links vgf_backend into pybind _dep_libs when VGF is enabled.
.ci/scripts/wheel/pre_build_script.sh Attempts to install VGF runtime pip package and sets env var to enable VGF in wheel builds if available.
Comments suppressed due to low confidence (1)

backends/arm/requirements-arm-vgf.txt:10

  • After removing ai_ml_sdk_vgf_library from this requirements file, it no longer represents the full set of deps implied by the vgf extra in pyproject.toml (which also includes ml_dtypes and tosa-tools). Since this file is referenced as something that should be kept in sync with packaging metadata, consider either (a) updating pyproject.toml/extras to reflect the split between AoT vs runtime deps, or (b) clarifying in this file (and its header comment) that it is only the AoT subset and is not expected to match pyproject.toml exactly.

ai_ml_emulation_layer_for_vulkan == 0.9.0
ai_ml_sdk_model_converter == 0.9.0


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +31 to +34
set(_executorch_pybind_enable_vgf OFF)
if(DEFINED ENV{EXECUTORCH_PYBIND_ENABLE_VGF})
set(_executorch_pybind_enable_vgf "$ENV{EXECUTORCH_PYBIND_ENABLE_VGF}")
endif()
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If EXECUTORCH_PYBIND_ENABLE_VGF is defined but empty, _executorch_pybind_enable_vgf becomes an empty string and later set_overridable_option(... ${_executorch_pybind_enable_vgf}) will expand to a missing argument, causing a CMake configure error. Consider normalizing the env var (treat empty as OFF) and/or quoting the variable when passing it to set_overridable_option so an empty value is still a valid argument.

Copilot uses AI. Check for mistakes.
Comment thread .ci/scripts/wheel/pre_build_script.sh
Comment thread backends/arm/requirements-arm-vgf-runtime.txt
@robell robell added the ciflow/binaries/all Release PRs with this label will build wheels for all python versions label Apr 30, 2026
Signed-off-by: Rob Elliott <Robert.Elliott@arm.com>
Change-Id: I5680de25e7a004ac6883bd4f855baee1bf6b4874
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/binaries/all Release PRs with this label will build wheels for all python versions ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: arm Issues related to arm backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants