We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 62fa829 commit 308903eCopy full SHA for 308903e
megatron/core/inference/unified_memory.py
@@ -26,9 +26,10 @@ class CompilationState(Enum):
26
SUCCESS = auto()
27
28
29
-# Avoid linting errors.
30
-_alloc = None
+# Compilation vars.
31
_compilation_state = CompilationState.UNATTEMPTED
+_alloc = None # must remain global until process exit.
32
+_mod = None # must remain global until process exit.
33
34
35
class UnifiedMemoryUnsupportedError(Exception):
@@ -38,7 +39,7 @@ class UnifiedMemoryUnsupportedError(Exception):
38
39
def compile_allocator():
40
"""Attempt to compile UVM allocator."""
41
- global _compilation_state
42
+ global _compilation_state, _alloc, _mod
43
44
if _compilation_state != CompilationState.UNATTEMPTED:
45
return
0 commit comments