Skip to content

Commit 2c71c04

Browse files
NikhilAPatelfacebook-github-bot
authored andcommitted
Call jit_post_compile_hook within Inductor Triton Kernel compile path (#83)
Summary: Pull Request resolved: #83 X-link: pytorch/pytorch#161443 Since Inductor skips JIT compilation for Triton kernels, we need to manually invoke `knobs.runtime.jit_post_compile_hook` if one exists. Here, we do this to enable Tritonparse to extract launch metadata from Inductor launched kernels. We can control whether or not Inductor will run the hook with a new `TORCHINDUCTOR_RUN_JIT_POST_COMPILE_HOOK=1 ` config variable. Reviewed By: davidberard98, FindHao Differential Revision: D80624932 fbshipit-source-id: 57cd14f3facf053fe1c02b15f04f0ea4c1b68198
1 parent 10fc49a commit 2c71c04

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tritonparse/structured_logging.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,12 +875,14 @@ def __call__(
875875
return True
876876

877877
# Get the current launch_metadata function if it exists
878-
current_launch_metadata = getattr(fn.jit_function, "launch_metadata", None)
878+
function = getattr(fn, "jit_function", fn)
879+
880+
current_launch_metadata = getattr(function, "launch_metadata", None)
879881
if current_launch_metadata is not None:
880882
log.warning(
881883
f"fn {fn} launch_metadata is not None: {current_launch_metadata}. It will be overridden by tritonparse."
882884
)
883-
fn.jit_function.launch_metadata = add_launch_metadata
885+
function.launch_metadata = add_launch_metadata
884886
return True
885887

886888

0 commit comments

Comments
 (0)