From 8d74060c313d5d62120e7cdbae288e984397b9cd Mon Sep 17 00:00:00 2001 From: Sasha Lopoukhine Date: Sun, 2 Jul 2023 10:04:49 +0100 Subject: [PATCH] from_constant -> constant_map --- tests/dialects/test_affine.py | 12 ++++++------ xdsl/dialects/builtin.py | 4 ++-- xdsl/ir/affine/affine_map.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/dialects/test_affine.py b/tests/dialects/test_affine.py index 9c64e32cc6..3f3ce386df 100644 --- a/tests/dialects/test_affine.py +++ b/tests/dialects/test_affine.py @@ -14,8 +14,8 @@ def test_simple_for(): def test_for_mismatch_operands_results_counts(): attributes: dict[str, Attribute] = { - "lower_bound": AffineMapAttr.from_constant(0), - "upper_bound": AffineMapAttr.from_constant(5), + "lower_bound": AffineMapAttr.constant_map(0), + "upper_bound": AffineMapAttr.constant_map(5), "step": IntegerAttr.from_index_int_value(1), } f = For.create( @@ -31,8 +31,8 @@ def test_for_mismatch_operands_results_counts(): def test_for_mismatch_operands_results_types(): attributes: dict[str, Attribute] = { - "lower_bound": AffineMapAttr.from_constant(0), - "upper_bound": AffineMapAttr.from_constant(5), + "lower_bound": AffineMapAttr.constant_map(0), + "upper_bound": AffineMapAttr.constant_map(5), "step": IntegerAttr.from_index_int_value(1), } b = Block(arg_types=(IntegerType(32),)) @@ -53,8 +53,8 @@ def test_for_mismatch_operands_results_types(): def test_for_mismatch_blockargs(): attributes: dict[str, Attribute] = { - "lower_bound": AffineMapAttr.from_constant(0), - "upper_bound": AffineMapAttr.from_constant(5), + "lower_bound": AffineMapAttr.constant_map(0), + "upper_bound": AffineMapAttr.constant_map(5), "step": IntegerAttr.from_index_int_value(1), } b = Block(arg_types=(IndexType(),)) diff --git a/xdsl/dialects/builtin.py b/xdsl/dialects/builtin.py index f624fbace0..cf835b77d9 100644 --- a/xdsl/dialects/builtin.py +++ b/xdsl/dialects/builtin.py @@ -1069,8 +1069,8 @@ def print_parameter(self, printer: Printer) -> None: printer.print_string(f"{self.data}") @staticmethod - def from_constant(value: int) -> AffineMapAttr: - return AffineMapAttr(AffineMap.from_constant(value)) + def constant_map(value: int) -> AffineMapAttr: + return AffineMapAttr(AffineMap.constant_map(value)) @irdl_op_definition diff --git a/xdsl/ir/affine/affine_map.py b/xdsl/ir/affine/affine_map.py index 8c2ee7d5b7..3c1488252b 100644 --- a/xdsl/ir/affine/affine_map.py +++ b/xdsl/ir/affine/affine_map.py @@ -16,7 +16,7 @@ class AffineMap: results: list[AffineExpr] @staticmethod - def from_constant(value: int) -> AffineMap: + def constant_map(value: int) -> AffineMap: return AffineMap(0, 0, [AffineExpr.constant(value)]) @staticmethod