-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This primary purpose of this PR is to annotate nodes with their access patterns based on the workgroup, tiling and MMA constraints. This is accomplished prior to expansion and propagates through expansion to the expanded nodes. Signed-off-by: Harsh Menon <harsh@nod-labs.com>
- Loading branch information
Showing
9 changed files
with
448 additions
and
28 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,9 @@ | ||
import shark_turbine.kernel.lang as tkl | ||
|
||
WORKGROUP_0 = tkl.sym.WG0 | ||
WORKGROUP_1 = tkl.sym.WG1 | ||
WORKGROUP_2 = tkl.sym.WG2 | ||
|
||
THREAD_0 = tkl.sym.T0 | ||
THREAD_1 = tkl.sym.T1 | ||
THREAD_2 = tkl.sym.T2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from dataclasses import dataclass | ||
from typing import Optional, Any | ||
from ...support.logging import get_logger | ||
from .._support.indexing import IndexExpr, IndexSymbol | ||
import sympy | ||
|
||
logger = get_logger("turbine.wave.indexing") | ||
|
||
|
||
@dataclass | ||
class IndexSequence: | ||
start: IndexExpr | int | ||
size: IndexExpr | int | ||
stride: Optional[IndexExpr | int] = 1 | ||
|
||
def __add__(self, other: Any) -> Any: | ||
if isinstance(other, IndexSequence): | ||
return IndexSequence( | ||
self.start + other.start, | ||
self.size * other.size, | ||
self.stride * other.stride, | ||
) | ||
else: | ||
raise NotImplementedError("IndexSequence addition not implemented!") | ||
|
||
def subs(self, map: dict[IndexSymbol, int]): | ||
start = self.start | ||
if isinstance(self.start, IndexExpr): | ||
start = self.start.subs(map) | ||
size = self.size | ||
if isinstance(self.size, IndexExpr): | ||
size = self.size.subs(map) | ||
stride = self.stride | ||
if isinstance(self.stride, IndexExpr): | ||
stride = self.stride.subs(map) | ||
return IndexSequence(start, size, stride) | ||
|
||
def __repr__(self): | ||
if isinstance(self.size, sympy.Integer): | ||
self.size = int(self.size) | ||
if isinstance(self.size, int) and self.size <= 1: | ||
return f"{self.start}" | ||
return f"{self.start} : {self.size} : {self.stride}" |
Oops, something went wrong.