#4548·mlx

[BUG] mx.split 视图 data_size 缺失报告 → elementwise int32 索引溢出 → 行 >= ceil(2^31/stride) 发生无声损坏

作者: fenglingai123创建于 2026年9月23日更新于 2026年9月23日

Split::eval in mlx/backend/common/common.cpp:

cpp
auto compute_new_flags = [](const auto& shape, const auto& strides,
                            size_t in_data_size, auto flags) {
  size_t data_size = 1;
  ...
  if (strides[i] > 0) {
    data_size *= shape[i];      // ← LOGICAL size, not buffer span
  }
  ...
};

array.h documents data_size as "the size (in elements) of the underlying buffer the array points to … last_offset − first_offset". For a contiguous array, the logical product equals the span, so this is usually harmless. For a split view (shape [M, N/2], source strides [N, 1]), they diverge: