Skip to content

Make helion.exc.TensorOperationInWrapper not fire on non-torch ops #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion helion/_compiler/type_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,9 @@ def to_proxy(arg: TypeInfo) -> object:
and input_contains_tensor
and output_type.contains_tensor()
):
if not regexp_allowed_host_ops.search(self.name):
if getattr(self.value, "__module__", "").startswith(
"torch"
) and not regexp_allowed_host_ops.search(self.name):
warning(exc.TensorOperationInWrapper(self.name))
return output_type
except exc.ShapeSpecializingCall:
Expand Down
4 changes: 3 additions & 1 deletion helion/exc.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ def report(self) -> str:
class TensorOperationInWrapper(BaseWarning):
message = (
"A tensor operation outside of the `hl.tile` or `hl.grid` loop will not be fused "
"in the generated kernel."
"in the generated kernel.\n"
"Use @helion.kernel(ignore_warnings=[helion.exc.TensorOperationInWrapper]) to suppress this warning.\n"
"If this is not a tensor operation, please report this as a bug."
)


Expand Down
Loading