-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
misc: split dialects.utils into multiple files (#3472)
It feels like a logical split, and leaves space for some upcoming shared dialects helpers.
- Loading branch information
1 parent
746db81
commit 4b08fcd
Showing
4 changed files
with
42 additions
and
41 deletions.
There are no files selected for viewing
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,4 @@ | ||
# TID 251 enforces to not import from those | ||
# We need to skip it here to allow importing from here instead. | ||
from .fast_math import * # noqa: TID251 | ||
from .format import * # noqa: TID251 |
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,29 @@ | ||
from abc import ABC | ||
from dataclasses import dataclass | ||
|
||
from xdsl.ir import BitEnumAttribute | ||
from xdsl.utils.str_enum import StrEnum | ||
|
||
|
||
class FastMathFlag(StrEnum): | ||
""" | ||
Values specifying fast math behaviour of an arithmetic operation. | ||
""" | ||
|
||
REASSOC = "reassoc" | ||
NO_NANS = "nnan" | ||
NO_INFS = "ninf" | ||
NO_SIGNED_ZEROS = "nsz" | ||
ALLOW_RECIP = "arcp" | ||
ALLOW_CONTRACT = "contract" | ||
APPROX_FUNC = "afn" | ||
|
||
|
||
@dataclass(frozen=True, init=False) | ||
class FastMathAttrBase(BitEnumAttribute[FastMathFlag], ABC): | ||
""" | ||
Base class for attributes defining fast math behavior of arithmetic operations. | ||
""" | ||
|
||
none_value = "none" | ||
all_value = "fast" |
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