Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ optional-dependencies.dev = [
"nbconvert>=7.7.2,<8",
"nbval<0.12",
"prek~=0.4.0",
"pyright==1.1.410",
"pyright==1.1.411",
"pytest<9.2",
"pytest-asyncio",
"pytest-cov",
Expand Down
10 changes: 5 additions & 5 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions xdsl/backend/csl/print_csl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from collections.abc import Iterable
from contextlib import contextmanager
from dataclasses import dataclass, field
from typing import IO, Literal, cast
from typing import IO, Literal

from xdsl.context import Context
from xdsl.dialects import arith, csl, memref, scf
Expand Down Expand Up @@ -394,9 +394,9 @@ def mlir_type_to_csl_type(self, type_attr: Attribute) -> str:
case IntegerType(
signedness=SignednessAttr(data=Signedness.UNSIGNED),
):
return f"u{cast(IntegerType, type_attr).width.data}"
return f"u{type_attr.width.data}"
case IntegerType():
return f"i{cast(IntegerType, type_attr).width.data}"
return f"i{type_attr.width.data}"
case MemRefType(element_type=Attribute() as elem_t, shape=shape):
if any(dim.data == DYNAMIC_INDEX for dim in shape):
raise ValueError(
Expand Down Expand Up @@ -441,7 +441,7 @@ def attribute_value_to_str(self, attr: Attribute) -> str:
"""
match attr:
case IntAttr():
return str(cast(IntAttr[int], attr).data)
return str(attr.data)
case IntegerAttr(value=val, type=IntegerType(width=IntAttr(data=1))):
return str(bool(val.data)).lower()
case IntegerAttr(value=val):
Expand Down
2 changes: 1 addition & 1 deletion xdsl/transforms/constant_fold_interp.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def match_and_rewrite(self, op: Operation, rewriter: PatternRewriter, /):
def convert_to_attr(self, value: Any, value_type: Attribute) -> Attribute | None:
match (value, value_type):
case int(), IntegerType():
return IntegerAttr(value, cast(IntegerType, value_type))
return IntegerAttr(value, value_type)
case _:
return None

Expand Down
6 changes: 2 additions & 4 deletions xdsl/utils/dialect_stub.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from dataclasses import dataclass, field
from importlib import import_module
from types import ModuleType
from typing import Any, cast
from typing import Any

import xdsl.ir
import xdsl.irdl
Expand Down Expand Up @@ -105,9 +105,7 @@ def _generate_constraint_type(self, constraint: AttrConstraint) -> str:
self._import(xdsl.ir, Attribute)
return "Attribute"
case ParamAttrConstraint():
base_type = cast(
ParamAttrConstraint[ParametrizedAttribute], constraint
).base_attr
base_type = constraint.base_attr
return base_type.__name__

case _:
Expand Down
3 changes: 2 additions & 1 deletion xdsl/utils/hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def isa(arg: Any, hint: "TypeForm[_T]") -> TypeGuard[_T]:
from xdsl.irdl import GenericData, irdl_to_attr_constraint

if (origin is not None) and issubclass(origin, GenericData | ParametrizedAttribute):
constraint = irdl_to_attr_constraint(hint)
hint_type = cast(type[GenericData[Any] | ParametrizedAttribute], hint)
constraint = irdl_to_attr_constraint(hint_type)
try:
constraint.verify(arg, ConstraintContext())
return True
Expand Down
Loading