[MLX] Empty matrix multiplication crashes the process in Contiguous::eval_gpu
Maintainer antworten meist innerhalb von 1 Tag
@jay23606 arbeitet bereits daran.
Seit 20.11.2026.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 68/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Bereich
- backend, machine-learning
Rechercherichtung
Start by tracing the MLX backend execution path to Contiguous::eval_gpu, using the standalone op_test_runner reproduction with the empty (0, 5) and (5, 10) inputs. Compare MLX delegated execution with the portable kernel control; done means the runtime returns an empty (0, 10) tensor or safely rejects the unsupported shape instead of crashing.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
An MLX-delegated torch.mm with valid inputs of shapes (0, 5) and (5, 10) terminates the process with SIGSEGV. PyTorch eager and the ExecuTorch portable kernel both return the expected empty (0, 10) tensor. Export succeeds and assigns the operation to MLX, so the failure reaches applications at runtime.
Reproduced on ExecuTorch 3e8e3f8a0ea22bac35cd67757add7a82c82bd287 with its original MLX pin 1f8e74e3f12f31365464a6867c6579f0e9b29d85 (v0.32.2), and independently with the proposed MLX pin 14dc9c673bce9a51dca4e58f5b2ccae80736431d. This predates the pin update being investigated for #25319.
Environment: Apple M5 Max, macOS 27.2, Release build, Python 3.12, PyTorch 2.15.0. Both the MLX-enabled Python runtime and the standalone C++ op_test_runner crash. Disabling TF32 does not prevent it.
With an MLX-enabled ExecuTorch Python runtime, this is sufficient to reproduce:
import torch
from executorch.backends.mlx.partitioner import MLXPartitioner
from executorch.exir import to_edge_transform_and_lower
from executorch.extension.pybindings.portable_lib import (
_get_registered_backend_names,
_load_for_executorch_from_buffer,
)
assert "MLXBackend" in _get_registered_backend_names()
class Model(torch.nn.Module):
def forward(self, a, b):
return torch.mm(a, b)
inputs = (torch.empty(0, 5), torch.ones(5, 10))
model = Model().eval()
print(model(*inputs)) # tensor([], size=(0, 10))
ep = torch.export.export(model, inputs)
edge = to_edge_transform_and_lower(ep, partitioner=[MLXPartitioner()])
assert sum(
n.target == torch.ops.higher_order.executorch_call_delegate
for n in edge.exported_program().graph.nodes
) == 1
program = edge.to_executorch()
runtime = _load_for_executorch_from_buffer(program.buffer)
print(runtime.forward(inputs)) # SIGSEGV
As a control, replacing the lowering with to_edge(ep) executes successfully through the portable kernel.
The standalone runner stops at a null dereference in Contiguous::eval_gpu:
stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
mlx::core::Contiguous::eval_gpu(...) + 40
mlx::core::gpu::eval(...)
mlx::core::eval_impl(...)
mlx::core::async_eval(...)
executorch::backends::mlx::MLXBackend::execute(...)
executorch::runtime::Method::execute_instruction()
Expected: return the empty output. Unsupported empty shapes should at least be rejected safely before native execution. A normal model input should not terminate a hosting process.
Found during OpInfo validation; reproduced independently of that harness. Investigated and written with assistance from OpenAI Codex.
cc @metascroy
- Vorherrschende Sprache
- Python
- Sterne
- 5.2k
- Forks
- 1.3k
- Ø Merge
- 1 T. 7 Std.
- Gemergte PRs (30 T.)
- 644
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus pytorch/executorch
-
to_edge_transform_and_lower ignores some ops_to_not_decompose requests: multi-output ops, and non-core ops without a decompositionEvtl. vergeben @Eureka-Zhang hat das vor 7 Tagen übernommen. Offenmodule: exir
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
pytorch/executorch#25620 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Qualcomm AI Engine Direct - fp16a8w quantization crashes on layer_normEvtl. vergeben @psiddh hat das vor 21 Tagen übernommen. Offenbug module: qnn partner: qualcomm
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
pytorch/executorch#24434 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement triaged
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 68/100
pytorch/executorch#21640 ·
Maintainer antworten meist innerhalb von 1 Tag
-
quantize_per_channel and dequantize_per_tensor.tensor abort the process on a float32 scaleEvtl. vergeben @AxelNoun hat das heute übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
pytorch/executorch#25873 ·
Maintainer antworten meist innerhalb von 1 Tag
-
XNNPACK INT4 linear returns incorrect per-channel outputs and fails groupwise FP16 on Apple M4 MaxEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offenbug module: quantization module: xnnpack
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 43/100
pytorch/executorch#25854 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in pytorch/executorch
Ähnliche Issues
-
Container fails to start when GitHub Releases is unavailable: uv run re-downloads the tvl wheelOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
trezor/trezor-user-env#421 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 91/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
tangentcode/tangentswarm#167 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag