MLX mode never reaches the mx.addmm dispatches because BlasOpt is excluded
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 1-2 天
- 新手友好度
- 57/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
Start by reading MLXLinker and the BlasOpt rewrite rules, then inspect the Gemv and Ger dispatches in link/mlx/dispatch/blas.py. Reproduce the two examples in the issue and inspect the MLX graph to confirm which rewrites run. Done when both expressions reach the intended mx.addmm dispatches and the outer product is handled in MLX mode.
由索引模型根据 Issue 内容生成。
描述
MLXLinker lists BlasOpt among its incompatible rewrites, so Gemv and Ger never appear in an MLX graph, and their mx.addmm dispatches in link/mlx/dispatch/blas.py are unreachable. A @ v + b runs as a Matmul plus a separate Add, and an outer product col @ row runs as a Matmul. local_dot_to_mul leaves core outer products alone so GER can handle them, but MLX mode never produces a GER. #2514 adds local_outer_dot_to_mul for Numba, which has no GER either, and tagging it mlx would cover the outer product. #2406 turns Gemv and Ger into plain Ops, but MLX still excludes BlasOpt there.
import re
import mlx.core as mx
import numpy as np
import pytensor
import pytensor.tensor as pt
A = pt.matrix("A", dtype="float32")
v = pt.vector("v", dtype="float32")
b = pt.vector("b", dtype="float32")
col = pt.matrix("col", shape=(None, 1), dtype="float32")
row = pt.matrix("row", shape=(1, None), dtype="float32")
rng = np.random.default_rng(0)
cases = {
"A @ v + b": ([A, v, b], A @ v + b, [rng.normal(size=(5, 3)), rng.normal(size=3), rng.normal(size=5)]),
"col @ row": ([col, row], col @ row, [rng.normal(size=(5, 1)), rng.normal(size=(1, 3))]),
}
for name, (inputs, output, values) in cases.items():
fn = pytensor.function(inputs, output, mode="MLX")
mx.export_to_dot("graph.dot", fn.vm.jit_fn(*[mx.array(value.astype("float32")) for value in values]))
print(name, [type(node.op).__name__ for node in fn.maker.fgraph.toposort()], re.findall(r'label ="([^"]+)"', open("graph.dot").read()))
# A @ v + b ['DimShuffle', 'Dot', 'DimShuffle', 'Elemwise'] ['Transpose', 'Reshape', 'Matmul', 'Transpose', 'Reshape', 'Add']
# col @ row ['Dot'] ['Matmul']
- 主要语言
- Python
- 星标
- 654
- 派生
- 258
- 平均合并
- 2 天 7 小时
- 30 天内合并 PR
- 39
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pymc-devs/pytensor 的其他 Issue
-
Docs of mode still mentions C/CVM as the default with FAST_RUN可能已有人在做 @ADITYASINGH1206 于 8 天前认领。 未关闭docs
难度 2/5 1-3 小时 新手友好度 62/100
pymc-devs/pytensor#2641 · 1 条评论 ·
维护者通常 1 天内回复
-
docs
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
BUG: geomspace returns wrong sign for the endpoints when start and stop are negative可能已有人在做 @mayuriphad 于 27 天前认领。 未关闭
难度 2/5 1 小时以内 新手友好度 85/100
维护者通常 1 天内回复
-
Reciprocal.impl computes np.float32(1.0) / x: float32 precision for float64 scalars under NEP 50 (Python linker)可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
pymc-devs/pytensor#2430 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
pymc-devs/pytensor#2428 · 5 条评论 ·
维护者通常 1 天内回复
查看 pymc-devs/pytensor 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
dgunning/edgartools#2019 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
topoteretes/cognee#6818 · 1 条评论 ·
维护者通常 1 天内回复
-
source_verification_agent: no outcome when the publisher confirms a work but its DOI resolves to a different record可能已有人在做 @pinjun99 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
Imbad0202/academic-research-skills#1159 · 1 条评论 ·
维护者通常 1 天内回复
-
[Bug]: DoubleMLData.from_arrays checks the treatment d with force_all_x_finite instead of force_all_d_finite可能已有人在做 @leninworld 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 88/100
DoubleML/doubleml-for-py#471 ·
维护者通常 1 天内回复