|
1 | 1 | import json |
2 | 2 | import triton.profiler as proton |
3 | 3 | import pathlib |
4 | | -<<<<<<< HEAD |
5 | | -======= |
6 | | -from triton.profiler.hooks.hook import HookManager |
7 | | -from triton.profiler.hooks.launch import LaunchHook |
8 | | -from triton.profiler.hooks.instrumentation import InstrumentationHook |
9 | | ->>>>>>> 450dabd3ba374103167c3bbb68e590b21b3c2c90 |
10 | 4 |
|
11 | 5 |
|
12 | 6 | def test_profile_single_session(tmp_path: pathlib.Path): |
@@ -110,34 +104,6 @@ def test_hook(tmp_path: pathlib.Path): |
110 | 104 | assert temp_file.exists() |
111 | 105 |
|
112 | 106 |
|
113 | | -def test_hook_manager(tmp_path: pathlib.Path): |
114 | | - # Launch hook is a singleton |
115 | | - HookManager.register(LaunchHook(), 0) |
116 | | - HookManager.register(LaunchHook(), 0) |
117 | | - assert len(HookManager.active_hooks) == 1 |
118 | | - assert isinstance(HookManager.active_hooks[0], LaunchHook) |
119 | | - assert HookManager.session_hooks[0][HookManager.active_hooks[0]] is True |
120 | | - |
121 | | - # Only unregister one session |
122 | | - HookManager.register(LaunchHook(), 1) |
123 | | - HookManager.unregister(0) |
124 | | - assert len(HookManager.active_hooks) == 1 |
125 | | - HookManager.unregister(1) |
126 | | - assert len(HookManager.active_hooks) == 0 |
127 | | - |
128 | | - # Heterogenous hooks |
129 | | - HookManager.register(InstrumentationHook(""), 2) |
130 | | - HookManager.register(LaunchHook(), 2) |
131 | | - assert len(HookManager.active_hooks) == 2 |
132 | | - # Launch hook has a higher priority |
133 | | - assert isinstance(HookManager.active_hooks[0], LaunchHook) |
134 | | - assert isinstance(HookManager.active_hooks[1], InstrumentationHook) |
135 | | - assert HookManager.session_hooks[2][HookManager.active_hooks[0]] is True |
136 | | - assert HookManager.session_hooks[2][HookManager.active_hooks[1]] is True |
137 | | - HookManager.unregister() |
138 | | - assert len(HookManager.active_hooks) == 0 |
139 | | - |
140 | | - |
141 | 107 | def test_scope_metrics(tmp_path: pathlib.Path): |
142 | 108 | temp_file = tmp_path / "test_scope_metrics.hatchet" |
143 | 109 | session_id = proton.start(str(temp_file.with_suffix(""))) |
|
0 commit comments