Skip to content

Commit 308903e

Browse files
global _alloc, _mod.
1 parent 62fa829 commit 308903e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

megatron/core/inference/unified_memory.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ class CompilationState(Enum):
2626
SUCCESS = auto()
2727

2828

29-
# Avoid linting errors.
30-
_alloc = None
29+
# Compilation vars.
3130
_compilation_state = CompilationState.UNATTEMPTED
31+
_alloc = None # must remain global until process exit.
32+
_mod = None # must remain global until process exit.
3233

3334

3435
class UnifiedMemoryUnsupportedError(Exception):
@@ -38,7 +39,7 @@ class UnifiedMemoryUnsupportedError(Exception):
3839
def compile_allocator():
3940
"""Attempt to compile UVM allocator."""
4041

41-
global _compilation_state
42+
global _compilation_state, _alloc, _mod
4243

4344
if _compilation_state != CompilationState.UNATTEMPTED:
4445
return

0 commit comments

Comments
 (0)