-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dialects: Implement stencil.return multiple results (#659)
This PR intends to update the support for multiple stencil results. The [earlier version](#648) produced some bugs when lowered via Psyclone, this patch should not face a similar problem. Here's a [link](https://xdsl.zulipchat.com/#narrow/stream/362011-xDSL/topic/stencil.20dialect/near/346783038) to @mesham's original issue related to this. edit @georgebisbas : Also check: #659 (comment)
- Loading branch information
Showing
4 changed files
with
145 additions
and
86 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from xdsl.dialects.builtin import FloatAttr, f32 | ||
from xdsl.dialects.experimental.stencil import ReturnOp, ResultType | ||
|
||
from xdsl.utils.test_value import TestSSAValue | ||
|
||
|
||
def test_stencil_return_single_float(): | ||
float_val1 = TestSSAValue(FloatAttr(4.0, f32)) | ||
return_op = ReturnOp.get([float_val1]) | ||
|
||
assert return_op.arg[0] is float_val1 | ||
|
||
|
||
def test_stencil_return_multiple_floats(): | ||
float_val1 = TestSSAValue(FloatAttr(4.0, f32)) | ||
float_val2 = TestSSAValue(FloatAttr(5.0, f32)) | ||
float_val3 = TestSSAValue(FloatAttr(6.0, f32)) | ||
|
||
return_op = ReturnOp.get([float_val1, float_val2, float_val3]) | ||
|
||
assert return_op.arg[0] is float_val1 | ||
assert return_op.arg[1] is float_val2 | ||
assert return_op.arg[2] is float_val3 | ||
|
||
|
||
def test_stencil_return_single_ResultType(): | ||
result_type_val1 = TestSSAValue(ResultType.from_type(f32)) | ||
return_op = ReturnOp.get([result_type_val1]) | ||
|
||
assert return_op.arg[0] is result_type_val1 | ||
|
||
|
||
def test_stencil_return_multiple_ResultType(): | ||
result_type_val1 = TestSSAValue(ResultType.from_type(f32)) | ||
result_type_val2 = TestSSAValue(ResultType.from_type(f32)) | ||
result_type_val3 = TestSSAValue(ResultType.from_type(f32)) | ||
|
||
return_op = ReturnOp.get( | ||
[result_type_val1, result_type_val2, result_type_val3]) | ||
|
||
assert return_op.arg[0] is result_type_val1 | ||
assert return_op.arg[1] is result_type_val2 | ||
assert return_op.arg[2] is result_type_val3 |
This file contains 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
This file contains 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
Oops, something went wrong.