Skip to content

[DEV] Support TRITON_INTERPRET=1 #73

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 3 commits into from
Jun 11, 2025
Merged
Changes from 1 commit
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
15 changes: 10 additions & 5 deletions triton_viz/core/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ def add_client(self, new_client: Union[Client, str]) -> None:
self.client_manager.add_clients([new_client_instance])

def __init__(self, kernel: JITFunction, client: Union[str, Client]) -> None:
assert isinstance(kernel, JITFunction), "Kernel must be a JITFunction"
self.interpreter_fn = InterpretedFunction(kernel.fn)
self.fn = kernel
if isinstance(kernel, InterpretedFunction):
self.interpreter_fn = kernel
elif isinstance(kernel, JITFunction):
self.interpreter_fn = InterpretedFunction(kernel.fn)
else:
raise TypeError(
f"Kernel must be JITFunction or InterpretedFunction, got {type(kernel)}"
)
self.arg_names = kernel.arg_names
self.client_manager = ClientManager()
self.add_client(client)
Expand Down Expand Up @@ -76,7 +82,7 @@ def decorator(kernel) -> Trace:
return kernel

# First-time wrapping
if isinstance(kernel, JITFunction):
if isinstance(kernel, (JITFunction, InterpretedFunction)):
return Trace(kernel, clients)

# If the object is already a Trace, just append the new client(s)
Expand All @@ -85,8 +91,7 @@ def decorator(kernel) -> Trace:
trace.add_client(clients)
return trace

# If the object is neither a JITFunction nor Trace, raise an error
raise TypeError(f"Expected JITFunction, got {type(kernel)}")
raise TypeError(f"Expected JITFunction, InterpretedFunction or Trace, got {type(kernel)}")

return decorator

Expand Down