Skip to content

Arm backend: Install TOSA and VGF tooling from pip#18840

Merged
zingo merged 1 commit intopytorch:mainfrom
perheld:change-1202756
Apr 14, 2026
Merged

Arm backend: Install TOSA and VGF tooling from pip#18840
zingo merged 1 commit intopytorch:mainfrom
perheld:change-1202756

Conversation

@perheld
Copy link
Copy Markdown
Collaborator

@perheld perheld commented Apr 13, 2026

Install tosa-tools and the ML SDK model-converter/VGF packages from pip instead of cloning tosa-tools from source.

Update the VGF runtime to the 0.9 decoder API and export VK_LAYER_PATH for the pip-installed emulation layer so the Vulkan ML layers are discovered at runtime.

Signed-off-by: per.held@arm.com
Change-Id: I2d3c2acd21a1bbe587d9af0b44479407afdab82d

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

Install tosa-tools and the ML SDK model-converter/VGF packages from
pip instead of cloning tosa-tools from source.

Update the VGF runtime to the 0.9 decoder API and export VK_LAYER_PATH
for the pip-installed emulation layer so the Vulkan ML layers are
discovered at runtime.

Signed-off-by: per.held@arm.com
Change-Id: I2d3c2acd21a1bbe587d9af0b44479407afdab82d
Copilot AI review requested due to automatic review settings April 13, 2026 10:58
@perheld perheld requested a review from digantdesai as a code owner April 13, 2026 10:58
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Apr 13, 2026

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 6 New Failures, 4 Unrelated Failures

As of commit 5e21dc4 with merge base 2eaa16c (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but was present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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 13, 2026
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

This PR updates the Arm backend setup to install TOSA tooling and Arm ML SDK VGF/emulation-layer tooling from PyPI instead of cloning/building from source, and updates the VGF runtime integration to match the 0.9 decoder API.

Changes:

  • Replace tosa-tools source checkout/build with tosa-tools PyPI installation.
  • Update VGF runtime decoding to use the 0.9 decoder API (size-aware decoders).
  • Export/propagate VK_LAYER_PATH for the pip-installed Vulkan ML emulation layer and bump ML SDK package pins to 0.9.0.

Reviewed changes

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

Show a summary per file
File Description
examples/arm/setup.sh Removes tosa-tools git clone/build and installs TOSA tooling via a requirements file.
backends/arm/scripts/mlsdk_utils.sh Adds propagation of VK_LAYER_PATH from pip-installed emulation layer tooling.
backends/arm/runtime/VGFSetup.h Updates process_vgf signature to accept the VGF blob size.
backends/arm/runtime/VGFSetup.cpp Updates VGF decoder construction to the 0.9 size-aware API.
backends/arm/runtime/VGFBackend.cpp Passes VGF blob size into process_vgf.
backends/arm/requirements-arm-vgf.txt Pins ML SDK VGF/emulation-layer packages to 0.9.0.
backends/arm/requirements-arm-tosa.txt Adds tosa-tools PyPI package pin and removes now-unneeded items.
Comments suppressed due to low confidence (1)

backends/arm/runtime/VGFSetup.cpp:364

  • Typo in error message: "internalsr" looks unintended and makes logs harder to search/understand. Consider changing to "internals" or similar.
  if (not(header_decoder && module_decoder && sequence_decoder &&
          resource_decoder && constant_decoder && header_decoder->IsValid() &&
          header_decoder->CheckVersion())) {
    ET_LOG(Error, "Failed to process VGF file internalsr");
    return false;

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

Comment thread examples/arm/setup.sh
@@ -335,36 +335,6 @@ if [[ $is_script_sourced -eq 0 ]]; then
CMAKE_POLICY_VERSION_MINIMUM=3.5 \
pip install --no-dependencies -r "$et_dir/backends/arm/requirements-arm-tosa.txt"
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

pip install --no-dependencies will skip transitive deps for the newly added tosa-tools PyPI package. Either remove --no-dependencies for this install or explicitly list all tosa-tools runtime/build dependencies in requirements-arm-tosa.txt to avoid incomplete/fragile installs.

Suggested change
pip install --no-dependencies -r "$et_dir/backends/arm/requirements-arm-tosa.txt"
pip install -r "$et_dir/backends/arm/requirements-arm-tosa.txt"

Copilot uses AI. Check for mistakes.
Comment on lines 335 to +350
// Prepare temporary decoders
unique_ptr<vgflib::HeaderDecoder> header_decoder =
vgflib::CreateHeaderDecoder(vgf_data);
vgflib::CreateHeaderDecoder(vgf_data, vgflib::HeaderSize(), vgf_size);
if (!header_decoder) {
ET_LOG(Error, "Failed to create VGF header decoder");
return false;
}

unique_ptr<vgflib::ModelSequenceTableDecoder> sequence_decoder =
vgflib::CreateModelSequenceTableDecoder(
vgf_data + header_decoder->GetModelSequenceTableOffset());
vgf_data + header_decoder->GetModelSequenceTableOffset(),
header_decoder->GetModelSequenceTableSize());
unique_ptr<vgflib::ModuleTableDecoder> module_decoder =
vgflib::CreateModuleTableDecoder(
vgf_data + header_decoder->GetModuleTableOffset());
vgf_data + header_decoder->GetModuleTableOffset(),
header_decoder->GetModuleTableSize());
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

header_decoder offsets/sizes are used to compute pointers and create the other decoders before verifying header_decoder->IsValid() / CheckVersion(). If the blob header is malformed, this can lead to out-of-bounds pointer arithmetic/reads. Validate the header (and ideally bounds-check offset+size against vgf_size) before constructing the table/constant decoders.

Copilot uses AI. Check for mistakes.
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Apr 13, 2026

To add the ciflow label ciflow/trunk please first approve the workflows that are awaiting approval (scroll to the bottom of this page).

This helps ensure we don't trigger CI on this PR until it is actually authorized to do so. Please ping one of the reviewers if you do not have access to approve and run workflows.

@zingo zingo added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm ciflow/trunk release notes: arm Changes to the ARM backend delegate labels Apr 13, 2026
@zingo
Copy link
Copy Markdown
Collaborator

zingo commented Apr 14, 2026

Error seems unrelated

@zingo zingo merged commit 3d4be1d into pytorch:main Apr 14, 2026
425 of 445 checks passed
@perheld perheld deleted the change-1202756 branch April 14, 2026 08:22
jpiat pushed a commit to jpiat/executorch that referenced this pull request Apr 14, 2026
Install tosa-tools and the ML SDK model-converter/VGF packages from pip
instead of cloning tosa-tools from source.

Update the VGF runtime to the 0.9 decoder API and export VK_LAYER_PATH
for the pip-installed emulation layer so the Vulkan ML layers are
discovered at runtime.

Signed-off-by: per.held@arm.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: arm Changes to the ARM backend delegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants