Skip to content

Commit eb27566

Browse files
committed
fix fuse and args
1 parent 6452a60 commit eb27566

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

pykokkos/core/fusion/fuse.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import ast
2-
import os
32
from typing import Any, Dict, List, Set, Tuple, Union
43

54
from .util import DeclarationsVisitor, VariableRenamer
@@ -47,7 +46,7 @@ def fuse_workunit_kwargs_and_params(
4746

4847
for p in current_params:
4948
current_arg = current_kwargs[p.arg]
50-
if "PK_FUSE_ARGS" in os.environ and id(current_arg) in view_ids:
49+
if id(current_arg) in view_ids:
5150
continue
5251

5352
view_ids.add(id(current_arg))
@@ -131,7 +130,7 @@ def fuse_arguments(
131130
continue
132131

133132
current_arg = current_kwargs[old_name]
134-
if "PK_FUSE_ARGS" in os.environ and id(current_arg) in fused_view_names:
133+
if id(current_arg) in fused_view_names:
135134
name_map[key] = fused_view_names[id(current_arg)]
136135
continue
137136

pykokkos/core/visitors/constructor_visitor.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ def visit_AnnAssign(
9292
if not isinstance(node.annotation, ast.Subscript):
9393
return ()
9494

95+
if (
96+
node.value is not None
97+
and isinstance(node.value, ast.Subscript)
98+
and isinstance(node.value.value, ast.Attribute)
99+
and isinstance(node.value.value.value, ast.Name)
100+
and node.value.value.value.id == "self"
101+
):
102+
return (declref, None)
103+
95104
decltype: cppast.ClassType = visitors_util.get_type(
96105
node.annotation, self.pk_import
97106
)

0 commit comments

Comments
 (0)