From a4ad760336336ee9ce7b4cda7f16f560b22c3f1a Mon Sep 17 00:00:00 2001 From: Deng Weishi Date: Sun, 23 Jun 2024 19:55:43 -0700 Subject: [PATCH] Enable deterministic support for oneDNN (#127277) Summary: This PR is a part of RFC https://github.com/pytorch/pytorch/issues/114848. For the request for Torchbenchmark models, this PR enables the deterministic attribute for the oneDNN operators for XPU backends, like convolution, deconvolution and matmult. X-link: https://github.com/pytorch/pytorch/pull/127277 Approved by: https://github.com/jgong5, https://github.com/EikanWang, https://github.com/desertfire, https://github.com/gujinghui Reviewed By: fbgheith Differential Revision: D58918395 fbshipit-source-id: 333cde99143d7e20ca838c82f5ffc0eb63f33a7c --- userbenchmark/dynamo/dynamobench/common.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/userbenchmark/dynamo/dynamobench/common.py b/userbenchmark/dynamo/dynamobench/common.py index 11913cdd6c..6bf50db763 100644 --- a/userbenchmark/dynamo/dynamobench/common.py +++ b/userbenchmark/dynamo/dynamobench/common.py @@ -3791,6 +3791,8 @@ def run(runner, args, original_dir=None): torch.backends.cudnn.benchmark = False torch.backends.cuda.matmul.allow_tf32 = False + torch.backends.mkldnn.deterministic = True + # Remove randomeness when torch manual seed is called patch_torch_manual_seed()