Skip to content

torch_musa: boolean masked assignment fails past 2^31 elements #146

Description

@cheersluvs

Component: torch_musa / MUDNN

Environment

component version
card MTT S5000, 79.9 GiB
MUSA toolkit / mcc 4.3.5 (release_musa_4.3.0)
torch 2.9.0
torch_musa 2.9.0

Summary

RuntimeError: FillOp MUDNN failed in: RunMask

from tensor[bool_mask] = 0 on a tensor of 3.22e9 elements (98304 × 64 × 512),
just past 2^31 = 2.147e9.

Reproduction

import torch
n = 98304 * 64 * 512          # 3.22e9, past 2^31
a = torch.randn(n, dtype=torch.float32, device="musa")
m = a > 0
a[m] = 0.0                    # RuntimeError: FillOp MUDNN failed in: RunMask
torch.musa.synchronize()

Impact

Beyond the direct failure, this breaks torch.testing.assert_close: its
mismatch-reporting path performs exactly abs_diff[matches_flat] = 0 in order to
compute max_abs_diff. On any large tensor a comparison that should print a
diff instead raises an opaque RuntimeError: Comparing ... containing no
numbers. That misdirects debugging — we spent a round chasing a phantom numerical
regression before noticing the crash was in the reporting code and not in the
comparison itself.

Any test suite validating large tensors on MUSA is affected.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions