Skip to content

Commit 0a6ff07

Browse files
deepcharmsfc-gh-truwase
authored andcommitted
Reduce performance impact of compiler.enable decorator (deepspeedai#7498)
For some accelerators (such as HPU) running in a non-compile scenarios, the `compiler.enable` decorator can cause significant performance drops up to 8-12%. We can easily avoid the performance hit in non-compile scenarios, by detecting the ongoing compilation and returning immediately. Signed-off-by: Max Kovalenko <[email protected]> Co-authored-by: Olatunji Ruwase <[email protected]> Signed-off-by: lym <[email protected]>
1 parent 5777e6c commit 0a6ff07

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

deepspeed/runtime/compiler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def another_function():
4949
"""
5050

5151
def decorator(func):
52+
if not is_compiling():
53+
return func
5254

5355
@functools.wraps(func)
5456
def wrapper(*args, **kwargs):

0 commit comments

Comments
 (0)