Skip to content

[BUG] The analysis result of iter_args in scf.for in CuTeDSL is incorrect. #3201

@TungtungQia

Description

@TungtungQia

Which component has the problem?

CuTe DSL

Bug Report

Describe the bug
https://github.com/TungtungQia/cutlass_scf_for/blob/f74fea9ce35868d3ae9f8d1dce1969d7250d3f90/python/CuTeDSL/cutlass/base_dsl/ast_preprocessor.py#L1506
active_symbols.remove(active_symbol)

This link deletes variables at the same scope level as the induction variable, causing scf.for's iter_args to miss capturing some 'active_symbol' variables.

Steps/Code to reproduce bug
In the case(test/examples/CuTeDSL/test_for_control_flow.py), the for loop cannot modify the value of the variable 'acc'.

Expected behavior
for loop carried reused target actual=[0, 4], expected=[1, 4] assert actual == expected AssertionError

Environment details (please complete the following information):

  • Environment location: [Bare-metal, Docker, Cloud(specify cloud provider)]

Additional context
Fix: Only delete the induction variable, and retain other variables at the same scope level as the induction variable in the active_symbols.

PR: #3200

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    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