-
Notifications
You must be signed in to change notification settings - Fork 651
Open
Labels
backend testerThis bug was found by the backend test suite.This bug was found by the backend test suite.module: vulkanIssues related to the Vulkan delegate and code under backends/vulkan/Issues related to the Vulkan delegate and code under backends/vulkan/
Description
🐛 Describe the bug
When running the following repro on the Vulkan delegate, outputs differ from eager mode. ET portable matches eager.
import torch
from executorch.backends.vulkan.partitioner.vulkan_partitioner import VulkanPartitioner
from executorch.exir import to_edge_transform_and_lower, EdgeCompileConfig, to_edge
from executorch.extension.pybindings.portable_lib import _load_for_executorch_from_buffer
class IndexSelectModel(torch.nn.Module):
def __init__(self, dim=0):
super().__init__()
self.dim = dim
def forward(self, x, indices):
return torch.index_select(x, self.dim, indices)
model = IndexSelectModel(dim=0)
indices = torch.tensor([0, 1], dtype=torch.int64)
inputs = (
torch.randn(5, 5),
indices,
)
eager_outputs = model(*inputs)
ep = torch.export.export(model.eval(), inputs)
print(ep)
lowered = to_edge_transform_and_lower(
ep,
partitioner=[VulkanPartitioner()],
compile_config=EdgeCompileConfig(_check_ir_validity=False)
).to_executorch()
print(lowered.exported_program())
et_model = _load_for_executorch_from_buffer(lowered.buffer)
et_outputs = et_model([*inputs])[0]
print(f"Inputs: {inputs}")
print(f"Eager: {eager_outputs}")
print(f"ET: {et_outputs}")
Outputs:
Inputs: (tensor([[-0.4567, -0.3723, -0.1551, -0.7132, -0.5437],
[ 1.5363, 0.7774, 1.8513, 1.4016, 0.6614],
[ 0.2748, -0.6432, -0.8875, -1.6339, -0.4679],
[-1.1551, 0.0595, 0.4082, -1.3087, -0.7413],
[-0.1365, 0.1206, 0.6683, 1.3647, -0.3534]]), tensor([0, 1]))
Eager: tensor([[-0.4567, -0.3723, -0.1551, -0.7132, -0.5437],
[ 1.5363, 0.7774, 1.8513, 1.4016, 0.6614]])
ET: tensor([[-0.4567, -0.3723, -0.1551, -0.7132, -0.5437],
[-0.4567, -0.3723, -0.1551, -0.7132, -0.5437]])
Versions
Run on Meta internal master, Jul 3, fbcode/SwiftShader
Metadata
Metadata
Assignees
Labels
backend testerThis bug was found by the backend test suite.This bug was found by the backend test suite.module: vulkanIssues related to the Vulkan delegate and code under backends/vulkan/Issues related to the Vulkan delegate and code under backends/vulkan/
Type
Projects
Status
To triage