Skip to content

Commit

Permalink
resolve pyright issues for access pattern and scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
jorendumoulin committed Jan 2, 2025
1 parent 5c448e6 commit 9124d86
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 6 additions & 6 deletions compiler/ir/stream/access_pattern.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from abc import ABC
from collections.abc import Iterable, Iterator, Sequence
from dataclasses import dataclass
from typing import Generic
from typing import Generic, cast

from typing_extensions import Self, TypeVar, deprecated, overload
from xdsl.ir.affine import AffineConstantExpr, AffineDimExpr, AffineMap
from typing_extensions import Self, TypeVar, overload
from xdsl.ir.affine import AffineConstantExpr, AffineDimExpr, AffineExpr, AffineMap

from compiler.util.canonicalize_affine import canonicalize_map

Expand Down Expand Up @@ -76,7 +76,7 @@ class SchedulePattern(AccessPattern):
bounds: tuple[int, ...]

def __init__(self, bounds: Sequence[int], pattern: AffineMap):
if any(bound is None or bound <= 0 for bound in bounds):
if any(bound <= 0 for bound in bounds):
raise ValueError(
"All bounds must be static, strictly positive integers for a schedule"
)
Expand Down Expand Up @@ -220,10 +220,10 @@ def __iter__(self) -> Iterator[P]:
def __eq__(self, other: object) -> bool:
if not isinstance(other, PatternCollection):
return False
other = cast(PatternCollection[P], other)
return self._patterns == other._patterns

@property
@deprecated("only valid in trivial cases")
def num_dims(self) -> int:
return self[0].num_dims

Expand All @@ -244,7 +244,7 @@ def clear_unused_dims(self, bounds: tuple[int] | None = None) -> Self:
else:
pattern_bounds = bounds
unused_dims = tuple(i for i, bound in enumerate(pattern_bounds) if bound == 1)
dim_substitutions = []
dim_substitutions: list[AffineExpr] = []
unused_counter = 0
for dim in range(self.num_dims):
if dim not in unused_dims:
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ typeCheckingMode = "strict"
"compiler/inference/helpers.py",
"compiler/inference/scoped_setups.py",
"compiler/inference/trace_acc_state.py",
"compiler/ir/stream/access_pattern.py",
"compiler/ir/stream/scheduler.py",
"compiler/ir/tsl/tiled_strided_layout.py",
"compiler/parser/tsl_parser.py",
"compiler/transforms/accfg_dedup.py",
Expand Down

0 comments on commit 9124d86

Please sign in to comment.