Skip to content

Commit cf4ea40

Browse files
generatedunixname499836121meta-codesync[bot]
authored andcommitted
Enable more Inductor UT for XPU (#171773)
Summary: X-link: pytorch/pytorch#171773 Approved by: https://github.com/zou3519 Reviewed By: atalman, jeanschmidt Differential Revision: D90412033 fbshipit-source-id: 252c794818e7006bf51d9e991258554b4e8f966b
1 parent b5fe2b7 commit cf4ea40

File tree

1 file changed

+4
-0
lines changed
  • userbenchmark/dynamo/dynamobench/_dynamo

1 file changed

+4
-0
lines changed

userbenchmark/dynamo/dynamobench/_dynamo/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,13 +2335,17 @@ def preserve_rng_state() -> Generator[None, None, None]:
23352335
skip_frame_if_in_functorch_mode(rng_state)
23362336
if torch.cuda.is_available():
23372337
cuda_rng_state = torch.clone(torch.cuda.get_rng_state())
2338+
if torch.xpu.is_available():
2339+
xpu_rng_state = torch.clone(torch.xpu.get_rng_state())
23382340
try:
23392341
yield
23402342
finally:
23412343
with torch.utils._python_dispatch._disable_current_modes():
23422344
torch.random.set_rng_state(rng_state)
23432345
if torch.cuda.is_available():
23442346
torch.cuda.set_rng_state(cuda_rng_state) # type: ignore[possibly-undefined]
2347+
if torch.xpu.is_available():
2348+
torch.xpu.set_rng_state(xpu_rng_state) # type: ignore[possibly-undefined]
23452349

23462350

23472351
def is_jit_model(

0 commit comments

Comments
 (0)