NVIDIA / NVIDIA/cutlass

CuTeDSL: print_warning_once re-warns when more than one distinct message is used (lru_cache maxsize=1)

Open Beginner friendly
#3,501 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

CuTe DSL
Dominant language
C++
Stars
10.5k
Forks
2.1k
Avg merge
3d 11h
Merged PRs (30d)
7

Description

Description

BaseDSL.print_warning_once (cutlass/base_dsl/dsl.py ~line 813) caches on (self, message) with @lru_cache(maxsize=1):

@lru_cache(maxsize=1)
def print_warning_once(self, message: str) -> None:

With more than one distinct message, every new message evicts the previous cache entry, so alternating messages re-warn forever instead of once each.

Repro against nvidia-cutlass-dsl==4.7.0:

import warnings
from cutlass.base_dsl.dsl import BaseDSL

dsl = object.__new__(BaseDSL)
with warnings.catch_warnings(record=True) as rec:
    warnings.simplefilter("always")
    for msg in ["A", "B", "A", "B", "A"]:
        dsl.print_warning_once(msg)
print(len(rec))   # 5 warnings emitted; correct behavior is 2 (one per unique message)

Actual output: 5.

Suggested fix

Keep an instance-level set of already-emitted messages, or move the cache to a module-level function keyed on the message alone with unbounded 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 cutlass/base_dsl/dsl.py at BaseDSL.print_warning_once and reproduce the alternating-message example from the issue. Verify that repeated messages emit only one warning each, including when more than one distinct message is used; the existing reproduction provides the completion check.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
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.