Commit f2d89db
Fail loudly on unknown MLX block kinds; fix MLX build docs
M4 - silent fallthroughs in mlxbackend.cpp, now loud (ASSERT_UNREACHABLE,
the file's existing idiom):
- BlockVariant::apply switch default returned the input unchanged, a silent
identity no-op block. Now asserts; kept as a default: label so the active
-Wswitch-default (CMakeLists.txt) stays clean.
- The trunk block-construction loop silently dropped unknown kinds. Added an
else { ASSERT_UNREACHABLE; }.
- The nested-bottleneck construction loop was a genuine latent bug, not just a
missing guard: parseResidualBlockStack (desc.cpp, shared by trunk and nested)
accepts nested_bottleneck_block inside a nested bottleneck and the desc layer
handles it, but the MLX nested loop omitted NESTED_BOTTLENECK_BLOCK_KIND and
silently dropped such a block. Added the missing case (mirroring the trunk
loop and Eigen's shared BlockStack) plus an else-assert.
M3 - Compiling.md implied the MLX backend builds with make, but CMakeLists.txt
hard-fails MLX without the Ninja generator (same Swift/C++ interop requirement
as Metal). Added -G Ninja to the MLX cmake example, listed MLX alongside Metal
for the Ninja prerequisite, and noted MLX uses ninja to build.
Verification: build clean; runtests + runnnlayertests pass; testgpuerror
g170-b6c96 vs eigen_reference.json fp32 near-exact (winrate max 0.00036%) /
fp16 max 0.55% (unchanged); testgpuerror on the b4c256h4nbttflrs nested-
bottleneck+transformer model loads through the modified nested loop and runs
forward with no assert (fp16 ~0.27%).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 3ae836d commit f2d89db
2 files changed
Lines changed: 25 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1167 | 1167 | | |
1168 | 1168 | | |
1169 | 1169 | | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
1170 | 1175 | | |
1171 | 1176 | | |
1172 | 1177 | | |
| |||
1175 | 1180 | | |
1176 | 1181 | | |
1177 | 1182 | | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
1178 | 1186 | | |
1179 | 1187 | | |
1180 | 1188 | | |
1181 | 1189 | | |
1182 | 1190 | | |
1183 | 1191 | | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
1184 | 1195 | | |
1185 | 1196 | | |
1186 | 1197 | | |
| |||
1221 | 1232 | | |
1222 | 1233 | | |
1223 | 1234 | | |
1224 | | - | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
1225 | 1240 | | |
1226 | 1241 | | |
1227 | 1242 | | |
| |||
1327 | 1342 | | |
1328 | 1343 | | |
1329 | 1344 | | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
1330 | 1351 | | |
1331 | 1352 | | |
1332 | 1353 | | |
| |||
0 commit comments