Skip to content

[BUG] warning #2908-D: the implicit by-copy capture of "this" is deprecated #2997

@Algy

Description

@Algy

Which component has the problem?

CUTLASS C++

Bug Report

Describe the bug

When buildling CUTLASS C++ with C++20, I encountered several warnings about lambda capture in kernels:

/cutlass/include/cutlass/gemm/collective/sm100_blockscaled_mma_array_warpspecialized_rcggemm.hpp(694): warning #2908-D: the implicit by-copy capture of "this" is deprecated
          Tensor mSFB_tmp = observed_tma_load_sfb_->get_tma_tensor(shape(layout_SFB));
                            ^
Remark: The warnings can be suppressed with "-diag-suppress <warning-number>"

Steps/Code to reproduce bug

Build with the compilation flag -std=c++20.

The warnings are caused by the implicit by-copy capture mode.

cutlass/gemm/collective/sm100_blockscaled_mma_array_warpspecialized_rcggemm.hpp:

   auto mSFB_nkl = [=](){ // capture by copy
      if constexpr (IsCtaN192) {
        Tensor mSFB_tmp = observed_tma_load_sfb_->get_tma_tensor(shape(layout_SFB)); // Access "this" implicitly.
        ...

To resolve this, you can either capture by reference or add this to the capture list i.e., [=, this]

   auto mSFB_nkl = [&](){ // capture by refernece
      if constexpr (IsCtaN192) {
        Tensor mSFB_tmp = observed_tma_load_sfb_->get_tma_tensor(shape(layout_SFB)); // Access "this" implicitly.
        ...

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