Skip to content

Commit

Permalink
from_constant -> constant_map
Browse files Browse the repository at this point in the history
  • Loading branch information
superlopuh committed Jul 2, 2023
1 parent 9d89b35 commit 8d74060
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions tests/dialects/test_affine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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),))
Expand All @@ -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(),))
Expand Down
4 changes: 2 additions & 2 deletions xdsl/dialects/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion xdsl/ir/affine/affine_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8d74060

Please sign in to comment.