Skip to content

[DOC] issue in doc example of cutlass.cute.composition #2657

@command-c

Description

@command-c

Report incorrect documentation

Location of incorrect documentation

https://docs.nvidia.com/cutlass/media/docs/pythonDSL/cute_dsl_api/cute.html#cutlass.cute.composition

Describe the problems or issues found in the documentation
The example shown in the document may have wrong shape that cannot be composed.

Steps taken to verify documentation is incorrect
The example given is:

import cutlass.cute as cute
@cute.jit
def foo():
    # Create a layout that maps (i,j) to i*4 + j
    L1 = cute.make_layout((2, 3), stride=(4, 1))
    # Create a layout that maps (i,j) to i*3 + j
    L2 = cute.make_layout((3, 4), stride=(3, 1))
    # Compose L1 and L2
    L3 = cute.composition(L1, L2)
    # L3 now maps coordinates through L2 then L1
foo()

will give error:

error: unable to compute the following composition: '!cute.layout<"(2,3):(4,1)">' o '!cute.layout<"(3,4):(3,1)">

Suggested fix for documentation
Could change to another shapes like:

@cute.jit
def foo():
    # Create a layout that maps (i,j) to i*4 + j
    L1 = cute.make_layout((6, 2), stride=(8, 3))
    # Create a layout that maps (i,j) to i*3 + j
    L2 = cute.make_layout((4, 3), stride=(3, 1))
    # Compose L1 and L2
    L3 = cute.composition(L1, L2)
    # L3 now maps coordinates through L2 then L1
    print(L3)


foo() #((2,2),3):((24,3),8)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions