Open
Description
🐛 Describe the bug
Some models containing avgpool1d ops delegated to Vulkan fail to load with following error: IndexError: vector::_M_range_check: __n (which is 18446744073709551614) >= this->size() (which is 4)
. Maxpool1d fails in the same way, as do the adaptive versions of both avgpool and maxpool.
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 Model(torch.nn.Module):
def __init__(
self,
kernel_size=3,
stride=None,
padding=0,
ceil_mode=False,
count_include_pad=True,
):
super().__init__()
self.avgpool = torch.nn.AvgPool1d(
kernel_size=kernel_size,
stride=stride,
padding=padding,
ceil_mode=ceil_mode,
count_include_pad=count_include_pad,
)
def forward(self, x):
return self.avgpool(x)
model = Model()
inputs = (
torch.randn(1, 3, 10),
)
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:
IndexError: vector::_M_range_check: __n (which is 18446744073709551614) >= this->size() (which is 4)
Traceback
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[13], line 42
35 lowered = to_edge_transform_and_lower(
36 ep,
37 partitioner=[VulkanPartitioner()],
38 compile_config=EdgeCompileConfig(_check_ir_validity=False)
39 ).to_executorch()
40 print(lowered.exported_program())
---> 42 et_model = _load_for_executorch_from_buffer(lowered.buffer)
43 et_outputs = et_model([*inputs])[0]
45 print(f"Inputs: {inputs}")
IndexError: vector::_M_range_check: __n (which is 18446744073709551614) >= this->size() (which is 4)
Versions
Run on Meta internal master, Jul 3, fbcode/SwiftShader