MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / no_sync_profiling

Function no_sync_profiling

lightx2v/utils/profiler.py:30–46  ·  view source on GitHub ↗

Scope where ProfilingContext* skip cuda.synchronize on enter/exit. Use around AR segment loops with async VAE so nested profilers (step_pre, infer_main, segment end2end, AR segments total) do not insert GPU barriers that flatten DiT/VAE overlap. The region must end with explicit sync

(enabled: bool = True)

Source from the content-addressed store, hash-verified

28
29
30def _get_memory_profile_stack():
31 if not hasattr(_memory_profile_local, "stack"):
32 _memory_profile_local.stack = []
33 return _memory_profile_local.stack
34
35
36@contextmanager
37def no_sync_profiling(enabled: bool = True):
38 """Scope where ProfilingContext* skip cuda.synchronize on enter/exit.
39
40 Use around AR segment loops with async VAE so nested profilers (step_pre,
41 infer_main, segment end2end, AR segments total) do not insert GPU barriers
42 that flatten DiT/VAE overlap. The region must end with explicit sync
43 (e.g. async_vae_decoder.finish()).
44 """
45 if not enabled:
46 yield
47 return
48 prev = getattr(_no_sync_local, "active", False)
49 _no_sync_local.active = True

Callers 3

run_mainMethod · 0.85
run_mainMethod · 0.85
run_mainMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected