Skip to content

[DOC] Dynamic-layout guide example uses incompatible singleton strides #3760

Open

Description

@0z5a

Report incorrect documentation

Location: Framework integration guide, dynamic-layout code example, at the v4.8.1 source revision.

Problem and reproduction: The example assumes that singleton dimensions of b have stride 1, but the shown PyTorch construction retains stride 4:

import torch
from cutlass.cute.runtime import from_dlpack

b = torch.empty(32, 1, 1, 1, 4).permute(3, 4, 1, 0, 2)
print(b.stride())  # (4, 1, 4, 4, 4)
from_dlpack(b).mark_layout_dynamic(leading_dim=0)
# Expected strides[leading_dim] == 1, but got 4

The same mismatch affects the later leading_dim=2 example. The t1 and t2 examples also print t2 and t3, respectively, before those variables have been defined.

Verification: Ran the six positive examples t0–t5 in a GH200 environment with the main editable core and torch 2.11.0, and an H100 environment with CuTe DSL 4.8.1 and torch 2.13.0. The original and a print-only repair fail at the stride check. Using explicit singleton strides and correcting the print variables makes all six layouts match the documented output in both environments. This checks tensor-layout metadata, not GPU kernel performance; deliberate-error snippets elsewhere in the guide are outside this report.

Suggested fix: Construct b with torch.empty_strided((1, 4, 1, 32, 1), (1, 1, 1, 4, 1)), and print the variables just defined.

Activity

  1. 0z5a commented on Oct 20, 2026

    @0z5a
    Author

    Submitted #3757 with explicit singleton strides and the corrected print variables. All six positive layouts t0–t5 match the documented output in both the GH200 and H100 environments. The runtime behavior and deliberate-error examples are unchanged.

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