pytorch / pytorch/executorch

Maxvit model fails to run on Vulkan

Open
#14,056 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backend tester module: vulkan
Dominant language
Python
Stars
5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
581

Description

🐛 Describe the bug

The maxvit_t model from torchvision fails at runtime on the Vulkan backend with "Exception raised from toTensorRef at /pytorch/executorch/../executorch/backends/vulkan/runtime/graph/containers/Value.h:266: (isTensorRef()) is false! Expected value to have type TensorRef, got TENSOR instead.".

Export repro:

import torch
import torchvision
from executorch.exir import to_edge_transform_and_lower

from executorch.backends.vulkan.partitioner.vulkan_partitioner import VulkanPartitioner

inputs = (torch.randn(1, 3, 224, 224),)
model = torchvision.models.maxvit_t().eval()

ep = torch.export.export(model, inputs)

model = to_edge_transform_and_lower(
    torch.export.export(model, inputs),
    partitioner=[VulkanPartitioner()],
).to_executorch()

It fails to run on MoltenVK for a different reason, so I don't have a nice local repro on M1 for the toTensorRef error. Logs from CI with Swiftshader can be found at https://github.com/pytorch/executorch/actions/runs/17505373586/job/49727768697.

Versions

Commit https://github.com/pytorch/executorch/commit/fbda3a9545de747329577bd910086072ec5c7ad1, M1 Mac, using MoltenVK

cc @SS-JIA @manuelcandales @cbilgin

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the export repro with VulkanPartitioner and review the Vulkan backend path related to the reported toTensorRef failure. The CI Swiftshader logs linked in the issue may help compare the failure; done means maxvit_t exports and runs successfully on Vulkan without this runtime error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.