You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ifis_speculativeanduse_tp: # and ("cuda" in device):
308
+
ifis_speculativeanduse_tpand ("cuda"indevice):
306
309
torch._inductor.config.triton.cudagraph_trees=False# Bug with cudagraph trees in this case
307
310
308
311
ifis_speculative:
@@ -353,8 +356,15 @@ def callback(x):
353
356
if (i!=num_samples-1ornotprofile) or (use_tpandrank!=0):
354
357
prof=contextlib.nullcontext()
355
358
else:
356
-
torch.profiler._utils._init_for_cuda_graphs()
357
-
prof=torch.profiler.profile()
359
+
if"cuda"indevice:
360
+
torch.profiler._utils._init_for_cuda_graphs()
361
+
prof=torch.profiler.profile()
362
+
elif"xpu"indevice:
363
+
prof=torch.profiler.profile(
364
+
activities=[
365
+
torch.profiler.ProfilerActivity.CPU,
366
+
torch.profiler.ProfilerActivity.XPU],
367
+
)
358
368
withprof:
359
369
y, metrics=generate(
360
370
model,
@@ -418,6 +428,11 @@ def callback(x):
418
428
parser.add_argument('--device', type=str, default=default_device, help='Device to use')
419
429
420
430
args=parser.parse_args()
431
+
if"xpu"inargs.device:
432
+
try:
433
+
importintel_extension_for_pytorchasipex
434
+
except:
435
+
raiseModuleNotFoundError(f"Intel Extension for PyTorch (intel_extension_for_pytorch) is required to run PyTorch code on Intel GPU (XPU). Please check https://github.com/intel/intel-extension-for-pytorch for details.")
if (i!=num_samples-1ornotprofile) or (use_tpandrank!=0):
249
253
prof=contextlib.nullcontext()
250
254
else:
251
-
torch.profiler._utils._init_for_cuda_graphs()
252
-
prof=torch.profiler.profile()
255
+
if"cuda"indevice:
256
+
torch.profiler._utils._init_for_cuda_graphs()
257
+
prof=torch.profiler.profile()
258
+
elif"xpu"indevice:
259
+
prof=torch.profiler.profile(
260
+
activities=[
261
+
torch.profiler.ProfilerActivity.CPU,
262
+
torch.profiler.ProfilerActivity.XPU],
263
+
)
253
264
withprof:
254
265
y=generate(
255
266
model,
@@ -302,6 +313,11 @@ def callback(x):
302
313
parser.add_argument('--device', type=str, default="cuda", help='device to use')
303
314
304
315
args=parser.parse_args()
316
+
if"xpu"inargs.device:
317
+
try:
318
+
importintel_extension_for_pytorchasipex
319
+
except:
320
+
raiseModuleNotFoundError(f"Intel Extension for PyTorch (intel_extension_for_pytorch) is required to run PyTorch code on Intel GPU (XPU). Please check https://github.com/intel/intel-extension-for-pytorch for details.")
raiseModuleNotFoundError(f"OneCCL bindings for PyTorch (oneccl_bindings_for_pytorch) is required to run tensor parallel on Intel GPU (XPU). Please check https://github.com/intel/torch-ccl for details.")
raiseModuleNotFoundError(f"OneCCL bindings for PyTorch (oneccl_bindings_for_pytorch) is required to run tensor parallel on Intel GPU (XPU). Please check https://github.com/intel/torch-ccl for details.")
0 commit comments