Skip to content

Commit a658791

Browse files
SW publisherJenkins
authored andcommitted
deepspeed-fork content for 1.17.0
Signed-off-by: SW publisher <sw_publisher@habana-labs.com>
1 parent ce78a63 commit a658791

240 files changed

Lines changed: 13808 additions & 2605 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ repos:
3939
name: check-torchdist
4040
entry: ./scripts/check-torchdist.py
4141
language: python
42-
exclude: ^(deepspeed/comm/|docs/|benchmarks/|scripts/check-torchdist.py|deepspeed/moe/sharded_moe.py|deepspeed/runtime/comm/coalesced_collectives.py|deepspeed/elasticity/elastic_agent.py|deepspeed/launcher/launch.py|tests/unit/comm/test_dist.py)
42+
exclude: ^(deepspeed/comm/|docs/|benchmarks/|scripts/check-torchdist.py|deepspeed/moe/sharded_moe.py|deepspeed/runtime/comm/coalesced_collectives.py|deepspeed/elasticity/elastic_agent.py|deepspeed/launcher/launch.py|tests/unit/comm/test_dist.py|deepspeed/runtime/zero/utils.py|deepspeed/tools/pg_sim/ut/base.py|deepspeed/tools/pg_sim/pg.py|.ci/unit_tests/)
4343
# Specific deepspeed/ files are excluded for now until we wrap ProcessGroup in deepspeed.comm
4444

4545
- repo: local

accelerator/abstract_accelerator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def manual_seed_all(self, seed):
8080
...
8181

8282
@abc.abstractmethod
83-
def initial_seed(self, seed):
83+
def initial_seed(self):
8484
...
8585

8686
@abc.abstractmethod
@@ -280,6 +280,10 @@ def create_op_builder(self, class_name):
280280
def get_op_builder(self, class_name):
281281
...
282282

283+
@abc.abstractmethod
284+
def get_compile_backend(self):
285+
...
286+
283287
@abc.abstractmethod
284288
def build_extension(self):
285289
...

accelerator/cpu_accelerator.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ def manual_seed(self, seed):
8585
def manual_seed_all(self, seed):
8686
return torch.manual_seed(seed)
8787

88-
def initial_seed(self, seed):
89-
return torch.initial_seed(seed)
88+
def initial_seed(self):
89+
return torch.initial_seed()
9090

9191
def default_generator(self, device_index):
9292
return torch.default_generator
@@ -302,3 +302,6 @@ def build_extension(self):
302302

303303
def export_envs(self):
304304
return []
305+
306+
def get_compile_backend(self):
307+
return "inductor"

accelerator/cuda_accelerator.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ def manual_seed(self, seed):
9898
def manual_seed_all(self, seed):
9999
return torch.cuda.manual_seed_all(seed)
100100

101-
def initial_seed(self, seed):
102-
return torch.cuda.initial_seed(seed)
101+
def initial_seed(self):
102+
return torch.cuda.initial_seed()
103103

104104
def default_generator(self, device_index):
105105
return torch.cuda.default_generators[device_index]
@@ -360,3 +360,6 @@ def build_extension(self):
360360

361361
def export_envs(self):
362362
return ['NCCL']
363+
364+
def get_compile_backend(self):
365+
return "inductor"

accelerator/hpu_accelerator.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ def handles_memory_backpressure(self):
4040
return True
4141

4242
def device_name(self, device_index=None):
43-
if device_index is None:
44-
return 'hpu'
45-
return 'hpu:{}'.format(device_index)
43+
# ignoring device_index.
44+
return 'hpu'
4645

4746
def device(self, device_index=None):
4847
return torch.device(self.device_name(device_index))
@@ -73,13 +72,13 @@ def get_rng_state(self, device_index=None):
7372
return self.hpu.random.get_rng_state()
7473

7574
def manual_seed(self, seed):
76-
self.hpu.random.manual_seed(seed)
75+
return self.hpu.random.manual_seed(seed)
7776

7877
def manual_seed_all(self, seed):
7978
self.hpu.random.manual_seed_all(seed)
8079

81-
def initial_seed(self, seed):
82-
self.hpu.random.initial_seed(seed)
80+
def initial_seed(self):
81+
return self.hpu.random.initial_seed()
8382

8483
def default_generator(self, device_index):
8584
return self.hpu.random.default_generators[device_index]
@@ -288,6 +287,17 @@ def get_op_builder(self, class_name):
288287
else:
289288
return self.class_dict['NotImplementedBuilder'] if 'NotImplementedBuilder' in self.class_dict else None
290289

290+
def get_compile_backend(self):
291+
return "hpu_backend"
292+
293+
#shall be removed once moving to torch.compile
294+
def wrap_in_hpu_graph(self, module):
295+
if self.hpu.is_lazy():
296+
module = self.hpu.wrap_in_hpu_graph(module)
297+
else:
298+
print("Warning: hpu graphs in eager mode is not supported, ignoring")
299+
return module
300+
291301
def build_extension(self):
292302
from torch.utils.cpp_extension import BuildExtension
293303
return BuildExtension

accelerator/mps_accelerator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def manual_seed_all(self, seed):
7676
def seed(self):
7777
return torch.mps.seed()
7878

79-
def initial_seed(self, seed):
79+
def initial_seed(self):
8080
return
8181

8282
def default_generator(self, device_index):
@@ -258,3 +258,6 @@ def build_extension(self):
258258

259259
def export_envs(self):
260260
return []
261+
262+
def get_compile_backend(self):
263+
return "inductor"

accelerator/npu_accelerator.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ def manual_seed(self, seed):
8383
def manual_seed_all(self, seed):
8484
return torch.npu.manual_seed_all(seed)
8585

86-
def initial_seed(self, seed):
87-
return torch.npu.initial_seed(seed)
86+
def initial_seed(self):
87+
return torch.npu.initial_seed()
8888

8989
def default_generator(self, device_index):
9090
return torch.npu.default_generators[device_index]
@@ -278,3 +278,6 @@ def build_extension(self):
278278

279279
def export_envs(self):
280280
return ['ASCEND', 'HCCL', 'LD_LIBRARY', 'PATH']
281+
282+
def get_compile_backend(self):
283+
return "inductor"

accelerator/xpu_accelerator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ def manual_seed(self, seed):
7272
def manual_seed_all(self, seed):
7373
return torch.xpu.manual_seed_all(seed)
7474

75-
def initial_seed(self, seed):
76-
return torch.xpu.initial_seed(seed)
75+
def initial_seed(self):
76+
return torch.xpu.initial_seed()
7777

7878
def default_generator(self, device_index):
7979
return torch.xpu.default_generators[device_index]

build.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
+hpu.synapse.v1.17.0

0 commit comments

Comments
 (0)