Skip to content

Commit 4dc8ef2

Browse files
authored
Improve stack trace for #457 (#489)
1 parent 948030a commit 4dc8ef2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

helion/_compiler/inductor_lowering.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,15 @@ def convert_arg(arg: Node) -> TensorBox:
161161
prior_buffers = len(graph_lowering.buffers)
162162
input_names: list[str] = []
163163
with torch._inductor.config.patch(split_reductions=False): # pyright: ignore[reportAttributeAccessIssue]
164-
result = graph_lowering.call_function(
165-
node.target, # pyright: ignore[reportArgumentType]
166-
*map_arg((node.args, node.kwargs), convert_arg), # pyright: ignore[reportArgumentType]
167-
)
164+
with node.meta["location"]:
165+
try:
166+
result = graph_lowering.call_function(
167+
node.target, # pyright: ignore[reportArgumentType]
168+
*map_arg((node.args, node.kwargs), convert_arg), # pyright: ignore[reportArgumentType]
169+
)
170+
except torch._inductor.exc.LoweringException as e: # pyright: ignore[reportAttributeAccessIssue]
171+
# Wrap in Helion exception to get location automatically
172+
raise InductorLoweringError(str(e)) from e
168173
if not isinstance(result, tuple):
169174
result = (result,)
170175
buffer_name_to_output_index = {}

0 commit comments

Comments
 (0)