[QST] [CuTeDSL] `cast_tensor` corner case when no stride = 1
Open
Nobody has claimed this yet.
? - Needs Triage
inactive-30d
inactive-90d
question
- Dominant language
- C++
- Stars
- 10.5k
- Forks
- 2.1k
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 7
Description
What is your question?
When none of a tensor's stride includes 1, cute.recast_tensor becomes no-op.
@cute.jit
def func():
tensor = cute.make_rmem_tensor((1, 2), cute.Float64)
print(tensor.shape, "->", cute.recast_tensor(tensor, dtype=cute.Float16).shape) # --> works
tensor = cute.make_rmem_tensor((1, 1), cute.Float64)
print(tensor.shape, "->", cute.recast_tensor(tensor, dtype=cute.Float16).shape) # --> no-op
layout = cute.make_layout(
shape=(((2, 2, 2), 1), 1, 2),
stride=(((0, 16, 0), 0), 0, 0),
)
tensor = cute.make_rmem_tensor(layout, cute.Float64)
print(tensor.shape, "->", cute.recast_tensor(tensor, dtype=cute.Float16).shape) # --> no-op
layout = cute.make_layout(
shape=(((2, 2, 2), 1), 1, 2),
stride=(((0, 1, 0), 0), 0, 0),
)
tensor = cute.make_rmem_tensor(layout, cute.Float64)
print(tensor.shape, "->", cute.recast_tensor(tensor, dtype=cute.Float16).shape) # --> works
func()
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 by running the provided cute.jit reproducer and inspect the cute.recast_tensor entry point, comparing the cases with and without a stride of 1. Done means the no-stride-1 cases have the intended recast shape and a regression check covers these examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100