Skip to content

[BUG] CUTE_DSL_KEEP=sass is ignored in cutlass-dsl 4.6.0 #3365

Description

@tridao

Which component has the problem?

CuTe DSL

Bug Report

nvidia-cutlass-dsl==4.6.0 documents CUTE_DSL_KEEP=sass, and the deprecated CUTE_DSL_KEEP_SASS=1 warning recommends it, but the consolidated env var does not enable SASS dumping.

Minimal repro:

from __future__ import annotations

import os
import subprocess
import sys


CHECK = r"""
import importlib.metadata as metadata
import os
from cutlass.base_dsl.env_manager import EnvironmentVarManager, _parse_keep_tokens

m = EnvironmentVarManager("CUTE_DSL")
print("version:", metadata.version("nvidia-cutlass-dsl"))
print("CUTE_DSL_KEEP:", os.getenv("CUTE_DSL_KEEP"))
print("CUTE_DSL_KEEP_SASS:", os.getenv("CUTE_DSL_KEEP_SASS"))
print("parse('sass'):", sorted(_parse_keep_tokens("sass", "CUTE_DSL")))
print("keep_tokens:", sorted(m.keep_tokens))
print("keep_sass:", m.keep_sass)
"""


def check(label: str, env_update: dict[str, str]) -> bool:
    env = os.environ.copy()
    for key in ("CUTE_DSL_KEEP", "CUTE_DSL_KEEP_SASS"):
        env.pop(key, None)
    env.update(env_update)
    env["PYTHONWARNINGS"] = "ignore::DeprecationWarning"

    print(f"\n== {label} ==")
    output = subprocess.check_output([sys.executable, "-c", CHECK], env=env, text=True)
    print(output, end="")
    return "keep_sass: True" in output


documented_works = check("documented CUTE_DSL_KEEP=sass", {"CUTE_DSL_KEEP": "sass"})
deprecated_works = check("deprecated CUTE_DSL_KEEP_SASS=1", {"CUTE_DSL_KEEP_SASS": "1"})

if not documented_works and deprecated_works:
    print("\nBUG: CUTE_DSL_KEEP=sass is ignored, but CUTE_DSL_KEEP_SASS=1 works.")
    raise SystemExit(1)

Observed:

== documented CUTE_DSL_KEEP=sass ==
version: 4.6.0
CUTE_DSL_KEEP: sass
CUTE_DSL_KEEP_SASS: None
parse('sass'): []
keep_tokens: []
keep_sass: False

== deprecated CUTE_DSL_KEEP_SASS=1 ==
version: 4.6.0
CUTE_DSL_KEEP: None
CUTE_DSL_KEEP_SASS: 1
parse('sass'): []
keep_tokens: ['sass']
keep_sass: True

Expected: CUTE_DSL_KEEP=sass should set keep_tokens == ["sass"] and
keep_sass == True.

Likely fix: add "sass" to the accepted CUTE_DSL_KEEP token set used by
_parse_keep_tokens.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions