[BUG] Discrepancy between CuTe C++ and pycute
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.5k
- Forks
- 2.1k
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 7
Description
Which component has the problem?
CUTLASS C++
Bug Report
Describe the bug
There is a discrepancy in behavior between pycute and Cute C++: composition_impl() at layout.hpp:1076-1077 uses a weak stride divisibility condition that accepts compositions pycute rejects:
// layout.hpp:1076-1077
CUTE_STATIC_ASSERT_V( ((rest_stride % curr_shape) == Int<0>{}) or (rest_stride < curr_shape), "Stride Divisibility Condition");
The weak condition violates the documented C(i) = A(B(i)) contract for standalone composition.
Steps/Code to reproduce bug
A=(4,6,8):(2,3,5), B=6:3), c = A o B
CuTe C++:
#include <cute/layout.hpp>
using namespace cute;
// Compiles, produces (_2,_3):(_6,_3), but C(2)=3 != A(B(2))=7
auto C = composition(
make_layout(make_shape(_4{},_6{},_8{}), make_stride(_2{},_3{},_5{})),
make_layout(_6{}, _3{}));
pycute:
import pycute
# Raises AssertionError — rejects the composition
pycute.composition( pycute.Layout((4, 6, 8), (2, 3, 5)), pycute.Layout(6, 3))
Expected behavior
pycute is correct
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in layout.hpp at composition_impl(), around lines 1076-1077, and run the C++ reproducer from the issue alongside the pycute example. Trace the standalone composition contract and add regression coverage for the provided layouts; done means the invalid composition is rejected consistently while valid compositions continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100