Skip to content

[Feature]: support dynamic while#531

Draft
xudoyuan wants to merge 2 commits into
mainfrom
visit_while
Draft

[Feature]: support dynamic while#531
xudoyuan wants to merge 2 commits into
mainfrom
visit_while

Conversation

@xudoyuan
Copy link
Copy Markdown
Contributor

Motivation

Technical Details

Test Plan

Test Result

Submission Checklist

if not torch.cuda.is_available():
pytest.skip("CUDA/ROCm not available", allow_module_level=True)

import flydsl.compiler as flyc
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <E402> reported by reviewdog 🐶
Module level import not at top of file

pytest.skip("CUDA/ROCm not available", allow_module_level=True)

import flydsl.compiler as flyc
import flydsl.expr as fx
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <E402> reported by reviewdog 🐶
Module level import not at top of file


import flydsl.compiler as flyc
import flydsl.expr as fx
from flydsl.expr import buffer_ops
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <E402> reported by reviewdog 🐶
Module level import not at top of file

def _k_while_constexpr(Out: fx.Tensor, iters: fx.Constexpr[int]):
acc = fx.Int32(0)
i = 0
while const_expr(i < iters):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <F821> reported by reviewdog 🐶
Undefined name const_expr

Comment on lines +8 to +16
import pytest

from flydsl._mlir.ir import Context, FunctionType, InsertionPoint, IntegerType, Location, Module
from flydsl._mlir.dialects import arith, func
from flydsl.compiler.ast_rewriter import CanonicalizeWhile, ReplaceIfWithDispatch
from flydsl.expr.numeric import Int32


def test_scf_while_dispatch_single_result():
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

Suggested change
import pytest
from flydsl._mlir.ir import Context, FunctionType, InsertionPoint, IntegerType, Location, Module
from flydsl._mlir.dialects import arith, func
from flydsl.compiler.ast_rewriter import CanonicalizeWhile, ReplaceIfWithDispatch
from flydsl.expr.numeric import Int32
def test_scf_while_dispatch_single_result():
import pytest
from flydsl._mlir.dialects import arith, func
from flydsl._mlir.ir import Context, FunctionType, InsertionPoint, IntegerType, Location, Module
from flydsl.compiler.ast_rewriter import CanonicalizeWhile, ReplaceIfWithDispatch
from flydsl.expr.numeric import Int32
def test_scf_while_dispatch_single_result():


from flydsl._mlir.ir import Context, FunctionType, InsertionPoint, IntegerType, Location, Module
from flydsl._mlir.dialects import arith, func
from flydsl.compiler.ast_rewriter import CanonicalizeWhile, ReplaceIfWithDispatch
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <F401> reported by reviewdog 🐶
flydsl.compiler.ast_rewriter.ReplaceIfWithDispatch imported but unused

Suggested change
from flydsl.compiler.ast_rewriter import CanonicalizeWhile, ReplaceIfWithDispatch
from flydsl.compiler.ast_rewriter import CanonicalizeWhile

"""Side-effect only while loop: no result_names, no yield values."""
with Context(), Location.unknown():
module = Module.create()
i32 = IntegerType.get_signless(32)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <F841> reported by reviewdog 🐶
Local variable i32 is assigned to but never used

Suggested change
i32 = IntegerType.get_signless(32)
IntegerType.get_signless(32)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant