[Feature]: support dynamic while#531
Draft
xudoyuan wants to merge 2 commits into
Draft
Conversation
| if not torch.cuda.is_available(): | ||
| pytest.skip("CUDA/ROCm not available", allow_module_level=True) | ||
|
|
||
| import flydsl.compiler as flyc |
| pytest.skip("CUDA/ROCm not available", allow_module_level=True) | ||
|
|
||
| import flydsl.compiler as flyc | ||
| import flydsl.expr as fx |
|
|
||
| import flydsl.compiler as flyc | ||
| import flydsl.expr as fx | ||
| from flydsl.expr import buffer_ops |
| def _k_while_constexpr(Out: fx.Tensor, iters: fx.Constexpr[int]): | ||
| acc = fx.Int32(0) | ||
| i = 0 | ||
| while const_expr(i < iters): |
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(): |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
| """Side-effect only while loop: no result_names, no yield values.""" | ||
| with Context(), Location.unknown(): | ||
| module = Module.create() | ||
| i32 = IntegerType.get_signless(32) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Technical Details
Test Plan
Test Result
Submission Checklist