NVIDIA / NVIDIA/cutlass

TensorView::operator- does not compile; TensorViewPlanarComplex::reset ignores its size parameter

Open Beginner friendly
#3,517 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

CUTLASS C++
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.