We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1afb25e commit a11b7a4Copy full SHA for a11b7a4
1 file changed
backends/cadence/aot/pass_utils.py
@@ -35,8 +35,8 @@ class CadencePassAttribute:
35
ALL_CADENCE_PASSES: dict[ExportPass, CadencePassAttribute] = {}
36
37
38
-def get_cadence_pass_attribute(p: ExportPass) -> CadencePassAttribute:
39
- return ALL_CADENCE_PASSES[p]
+def get_cadence_pass_attribute(p: ExportPass) -> Optional[CadencePassAttribute]:
+ return ALL_CADENCE_PASSES.get(p, None)
40
41
42
# A decorator that registers a pass.
@@ -61,7 +61,8 @@ def create_cadence_pass_filter(
61
def _filter(p: ExportPass) -> bool:
62
pass_attribute = get_cadence_pass_attribute(p)
63
return (
64
- pass_attribute.opt_level is not None
+ pass_attribute is not None
65
+ and pass_attribute.opt_level is not None
66
and pass_attribute.opt_level <= opt_level
67
and (not pass_attribute.debug_pass or debug)
68
)
0 commit comments