Skip to content

Commit 96c90e7

Browse files
committed
Make helion.exc.TensorOperationInWrapper not fire on non-torch ops
stack-info: PR: #131, branch: jansel/stack/27
1 parent bfa1992 commit 96c90e7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

helion/_compiler/type_propagation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,9 @@ def to_proxy(arg: TypeInfo) -> object:
744744
and input_contains_tensor
745745
and output_type.contains_tensor()
746746
):
747-
if not regexp_allowed_host_ops.search(self.name):
747+
if getattr(self.value, "__module__", "").startswith(
748+
"torch"
749+
) and not regexp_allowed_host_ops.search(self.name):
748750
warning(exc.TensorOperationInWrapper(self.name))
749751
return output_type
750752
except exc.ShapeSpecializingCall:

helion/exc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ def report(self) -> str:
285285
class TensorOperationInWrapper(BaseWarning):
286286
message = (
287287
"A tensor operation outside of the `hl.tile` or `hl.grid` loop will not be fused "
288-
"in the generated kernel."
288+
"in the generated kernel.\n"
289+
"Use @helion.kernel(ignore_warnings=[helion.exc.TensorOperationInWrapper]) to suppress this warning.\n"
290+
"If this is not a tensor operation, please report this as a bug."
289291
)
290292

291293

0 commit comments

Comments
 (0)