NVIDIA / NVIDIA/cutlass

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

Open Beginner friendly
#2,997 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

? - Needs Triage bug CUTLASS C++ inactive-90d
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

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.
        ...

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 cutlass/gemm/collective/sm100_blockscaled_mma_array_warpspecialized_rcggemm.hpp at the mSFB_nkl lambda around line 694, then search nearby kernels for the same implicit use of this in C++20 copy-capturing lambdas. Build CUTLASS with -std=c++20 and verify that the reported warning #2908-D no longer appears.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.