Skip to content

Enable Vulkan vision runners on Android (#24503) - #24503

Open
JakeStevens wants to merge 1 commit into
pytorch:mainfrom
JakeStevens:export-D129370846
Open

JakeStevens wants to merge 1 commit into
pytorch:mainfrom
JakeStevens:export-D129370846

Conversation

@JakeStevens

@JakeStevens JakeStevens commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

The Vulkan engine, its graph passes and the vision runner were only defined in fbcode, so the runner could not be built for Android. This defines them in xplat too. backends/native/runtime/vulkan/targets.bzl no longer returns early in xplat, backends/native/runtime/vulkan/BUCK defines the xplat xplat_vulkan_runtime next to the fbcode one, and run_classification and run_classification_vulkan are declared for both cells. The fbcode targets are unchanged.

vulkan_passes_test needs neither a GPU nor SwiftShader, so it now also builds and runs in xplat. The xplat run_classification carries a CI label that builds it for Android arm64, which covers the Vulkan engine, its passes and ET-VK on Android. The new xplat targets use the default xplat platform set, which matches ET-VK's get_platforms().

Review fixes authored with Claude Code.

Differential Revision: D129370846

@pytorch-bot

pytorch-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⏳ 7 Pending, 1 Unrelated Failure

As of commit cd3c63b with merge base 186ca41 (image):

BROKEN TRUNK - The following job failed but were 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.

@pytorch-bot pytorch-bot Bot added the module: vulkan Issues related to the Vulkan delegate and code under backends/vulkan/ label Nov 3, 2026
@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 Nov 3, 2026
@meta-codesync

meta-codesync Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@JakeStevens has exported this pull request. If you are a Meta employee, you can view the originating Diff in D129370846.

@github-actions

github-actions Bot commented Nov 3, 2026

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.

@shoumikhin

Copy link
Copy Markdown
Contributor

@claude review effort=max

@claude

claude Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Claude finished @shoumikhin's task in 17m 29s —— View job


Summary: This build-only PR makes the native Vulkan engine and the vision runner build in xplat (Android), and nothing is confirmed broken, but I'm requesting changes: the new path is untested, the targets that link ET-VK are missing the platforms constraint other ET-VK consumers declare, and the new xplat target is in the wrong file.

Detailed review: PR #24503

Summary

The PR does three things:

  • Removes the xplat early return in backends/native/runtime/vulkan/targets.bzl.
  • Adds an xplat-side xplat_vulkan_runtime alias to ET-VK.
  • Takes run_classification and run_classification_vulkan out of their fbcode_target wrappers.

As a result, vulkan_passes, vulkan_engine and the vision runner are now also defined in xplat; fbcode is unchanged.

There are three problems:

  • Nothing tests the xplat path.
  • The targets that link ET-VK don't repeat ET-VK's platform constraint.
  • One logical target is now split across two files.

Both changed files were reviewed in full. Nothing was built, because this checkout has no Meta-internal Buck macros or toolchains. The diff was taken against HEAD~1, which is the merge base e655cb8: the shallow checkout has no merge base with origin/main, and fetching wasn't allowed.

Code Quality

  • (minor) backends/native/runtime/vulkan/targets.bzl:13-21: the xplat-only xplat_vulkan_runtime is defined in the shared targets.bzl.
    • Problem:
      • The fbcode version of the same target is in backends/native/runtime/vulkan/BUCK:8-16. That BUCK file says at lines 18-19 that targets.bzl is for targets shared between cells, and BUCK holds the cell-only ones.
      • One logical target is now split across two files and two mechanisms. fbcode uses fbcode_target(_kind = native.cxx_library) with @fbsource//xplat/... labels. xplat uses is_xplat() plus runtime.cxx_library with //executorch/... labels.
      • The deleted "Host-only for now" comment wasn't replaced, so neither copy refers to the other. Any future change to the ET-VK deps has to be made twice.
    • Fix:
      • Define the xplat version in BUCK next to the fbcode one, as non_fbcode_target(_kind = runtime.cxx_library, name = "xplat_vulkan_runtime", ...). This is the mechanism backends/native/examples/hf_llm/runtime/BUCK:108 uses. BUCK will also need to load runtime.
      • Reword the BUCK comment at lines 6-7 ("Link the host engine…") to cover both cells.
      • Reduce the targets.bzl change to deleting the early return, and drop the is_xplat load, which is then unused.
    • Fix this →

Infrastructure

  • (minor, build impact not verified) backends/native/runtime/vulkan/targets.bzl:14 and :59, and backends/native/examples/vision/BUCK:44: the targets that now link ET-VK in xplat declare no platforms.
    • Problem: xplat_vulkan_runtime, vulkan_engine and run_classification get the wrapper's default platform set. The ET-VK libraries they link are pinned to get_platforms(), which is [ANDROID, APPLE, CXX] (backends/vulkan/targets.bzl:93-94, :262, :288).
    • Existing practice:
      • ET-VK's own consumers pass platforms = get_platforms(), for example backends/vulkan/test/api_abstractions/targets.bzl:11,22,33, custom_ops and op_tests.
      • backends/native/runtime/engine/targets.bzl:35-38 makes this the rule for engines: each one "repeats its backend's platform constraint so builds for other platforms skip it instead of failing on the incompatible dependency".
      • examples/models/llama/runner/targets.bzl:67-70 puts ET-VK behind a config flag because "Vulkan API currently cannot build on some platforms".
    • What's verified: only the pattern mismatch. Whether a build actually breaks depends on the internal default xplat platform list, which isn't in this checkout; the OSS shim simply drops platforms.
    • Fix: load get_platforms from @fbsource//xplat/executorch/backends/vulkan:targets.bzl and pass platforms = get_platforms() on these three targets.
    • Fix this →

Testing

  • (major) backends/native/test/runtime/vulkan/targets.bzl:12-13: nothing builds or tests the xplat path this PR exists to enable.
    • No coverage:
      • The test file still returns early in xplat. In xplat, run_classification is the only target that depends on vulkan_engine, and nothing tests vulkan_passes.
      • None of these targets has a CI label for an Android mode. Compare ET-VK's get_labels() (backends/vulkan/targets.bzl:87-91) and ggml_ci_labels(...) (backends/native/runtime/engine/targets.bzl:86, backends/native/examples/hf_llm/runtime/BUCK:117).
    • vulkan_passes_test can move above the guard:
      • The guard was only needed because vulkan_passes didn't exist in xplat.
      • vulkan_passes_test (lines 52-72) depends only on :vulkan_passes and the graph libraries, and needs no GPU or SwiftShader.
      • vulkan_test_driver, vulkan_ptn_runner and vulkan_engine_test need the linux-x64 SwiftShader and should stay behind the guard.
    • No test plan: the description claims numerical behavior is preserved, but there is no test plan. Please add an Android-mode build of fbsource//xplat/executorch/backends/native/examples/vision:run_classification and an on-device run.
    • Fix this →

Recommendation

Request Changes

Nothing is confirmed broken, and fbcode is unaffected. What blocks approval is that the PR's only purpose, building the Vulkan engine for Android, has no xplat test and no recorded build or run.

The fixes are small:

  • Let vulkan_passes_test build in xplat, and add a test plan.
  • Add platforms = get_platforms(), or confirm that the default xplat platform set already matches ET-VK's.
  • Move the xplat xplat_vulkan_runtime definition into BUCK.

@meta-codesync meta-codesync Bot changed the title Enable Vulkan vision runners on Android Enable Vulkan vision runners on Android (#24503) Nov 3, 2026
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Nov 3, 2026
Summary:

The Vulkan engine, its graph passes and the vision runner were only defined in fbcode, so the runner could not be built for Android. This defines them in xplat too. `backends/native/runtime/vulkan/targets.bzl` no longer returns early in xplat, `backends/native/runtime/vulkan/BUCK` defines the xplat `xplat_vulkan_runtime` next to the fbcode one, and `run_classification` and `run_classification_vulkan` are declared for both cells. The fbcode targets are unchanged.

`vulkan_passes_test` needs neither a GPU nor SwiftShader, so it now also builds and runs in xplat. The xplat `run_classification` carries a CI label that builds it for Android arm64, which covers the Vulkan engine, its passes and ET-VK on Android. The new xplat targets use the default xplat platform set, which matches ET-VK's `get_platforms()`.

Review fixes authored with Claude Code.

Differential Revision: D129370846
Summary:

The Vulkan engine, its graph passes and the vision runner were only defined in fbcode, so the runner could not be built for Android. This defines them in xplat too. `backends/native/runtime/vulkan/targets.bzl` no longer returns early in xplat, `backends/native/runtime/vulkan/BUCK` defines the xplat `xplat_vulkan_runtime` next to the fbcode one, and `run_classification` and `run_classification_vulkan` are declared for both cells. The fbcode targets are unchanged.

`vulkan_passes_test` needs neither a GPU nor SwiftShader, so it now also builds and runs in xplat. The xplat `run_classification` carries a CI label that builds it for Android arm64, which covers the Vulkan engine, its passes and ET-VK on Android. The new xplat targets use the default xplat platform set, which matches ET-VK's `get_platforms()`.

Review fixes authored with Claude Code.

Differential Revision: D129370846

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

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported module: vulkan Issues related to the Vulkan delegate and code under backends/vulkan/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants