[tests] add torch.use_deterministic_algorithms for XPU (#30774)

* add xpu check

* add marker

* add documentation

* update doc

* fix ci

* remove from global init

* fix
This commit is contained in:
Fanli Lin
2024-05-23 23:53:07 +08:00
committed by GitHub
parent 8366b57241
commit 21339a5213
6 changed files with 30 additions and 2 deletions

View File

@@ -116,6 +116,7 @@ from .utils import (
is_torch_bf16_available_on_device,
is_torch_bf16_cpu_available,
is_torch_bf16_gpu_available,
is_torch_deterministic,
is_torch_fp16_available_on_device,
is_torch_neuroncore_available,
is_torch_npu_available,
@@ -943,6 +944,15 @@ def require_torch_bf16_cpu(test_case):
)(test_case)
def require_deterministic_for_xpu(test_case):
if is_torch_xpu_available():
return unittest.skipUnless(is_torch_deterministic(), "test requires torch to use deterministic algorithms")(
test_case
)
else:
return test_case
def require_torch_tf32(test_case):
"""Decorator marking a test that requires Ampere or a newer GPU arch, cuda>=11 and torch>=1.7."""
return unittest.skipUnless(