TensorView::operator- does not compile; TensorViewPlanarComplex::reset ignores its size parameter
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.5k
- Forks
- 2.1k
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 7
Description
Description
Two small public-API breakages in the tensor view headers, both verified by compiling against include/ only.
1. TensorView::operator-(TensorCoord) cannot compile
include/cutlass/tensor_view.h ~lines 258-267 constructs a base-class object but returns it as the derived type:
TensorView operator-(TensorCoord const& b) const {
TensorRef result(*this); // base-class alias
result.add_pointer_offset(-this->offset(b));
return result; // no base->derived conversion
}
tensor_view.h:266:12: error: could not convert 'result' from
'cutlass::TensorRef<float, cutlass::layout::RowMajor>' to 'cutlass::TensorView<float, cutlass::layout::RowMajor>'
operator+, +=, -= are all fine; this one looks like a copy-paste from TensorRef. The identical pattern exists in include/cutlass/tensor_view_planar_complex.h ~lines 250-259.
2. TensorViewPlanarComplex::reset ignores its size parameter
include/cutlass/tensor_view_planar_complex.h ~lines 162-165:
void reset(Element* ptr, Layout const &layout, LongIndex imaginary_stride, TensorCoord size) {
Base::reset(ptr, layout, imaginary_stride);
this->resize(extent_); // self-assignment; parameter 'size' never used
}
After pv.reset(pbuf, RowMajor(8), 32, {8,8}) on a view that was 4x4, the pointer and stride update but extent() still reports 4x4. Plain TensorView::reset correctly resizes to its argument.
Suggested fix
Mirror operator+: construct TensorView result(*this); result.add_pointer_offset(...); return result; (and the planar-complex analogue). In reset, call this->resize(size);.
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 include/cutlass/tensor_view.h and include/cutlass/tensor_view_planar_complex.h, comparing the broken operator- implementations with operator+. Inspect the reset overload in tensor_view_planar_complex.h and compile the include-only reproductions described in the issue. Done means both operator- overloads compile and reset updates the view extent to the supplied size.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100