Compare commits

...

20 Commits

Author SHA1 Message Date
63deeebfb2 Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-14 18:01:14 -08:00
046bcb216f Update base for Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-14 18:01:14 -08:00
f03a856c1e Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-13 12:16:25 -08:00
9f168214a0 Update base for Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-13 12:16:25 -08:00
5f27a81217 Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-13 12:00:47 -08:00
43eff96e2c Update base for Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-13 12:00:47 -08:00
3bb610bc0e Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-12 17:43:39 -08:00
e04cadf9e3 Update base for Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-12 17:43:38 -08:00
b2ecd94054 Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-12 11:51:05 -08:00
68549e3b47 Update base for Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-12 11:51:05 -08:00
e3a27d15a5 Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-12 10:28:25 -08:00
bc73f8811c Update base for Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-12 10:28:25 -08:00
1547d863cf Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-11 21:56:51 -08:00
428cc494d8 Update base for Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-11 21:56:51 -08:00
5726990ffb Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-11 21:32:11 -08:00
d43e344e1a Update base for Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-11 21:32:11 -08:00
e39691df2e Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-11 15:50:26 -08:00
9e2e1750de Update base for Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-11 15:50:26 -08:00
c951f639ac Update on "[inductor] unittest for run2run determinism"
Not sure if the path are already properly setup so I can call 'benchmarks/dynamo/huggingface.py' in unit test directly. Let's tell from CI.


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela

[ghstack-poisoned]
2025-11-11 15:22:40 -08:00
763a353711 [inductor] unittest for run2run determinism
[ghstack-poisoned]
2025-11-10 13:09:40 -08:00
2 changed files with 65 additions and 1 deletions

View File

@ -2379,7 +2379,9 @@ class BenchmarkRunner:
print(
f"Load model outputs from {self.args.compare_model_outputs_with} to compare"
)
saved_result = torch.load(self.args.compare_model_outputs_with)
saved_result = torch.load(
self.args.compare_model_outputs_with, weights_only=False
)
is_bitwise_same = bitwise_same(saved_result, new_result)
if not is_bitwise_same:
print(

View File

@ -1,5 +1,9 @@
# Owner(s): ["module: inductor"]
import contextlib
import os
import subprocess
import sys
import tempfile
import unittest
import torch
@ -104,6 +108,64 @@ class DeterministicTest(TestCase):
else:
self.assertTrue(counters["inductor"]["coordesc_tuning_bench"] > 0)
@parametrize("model_name", ["GoogleFnet", "BertForMaskedLM", "DistillGPT2"])
@parametrize("training_or_inference", ["training", "inference"])
@parametrize("precision", ["float32", "bfloat16", "float16", "amp"])
def test_run2run_determinism(self, model_name, training_or_inference, precision):
"""
Test run2run determinism for a few huggingface models.
The test assumes benchmarks/dynamo/huggingface.py can be found from
the current working directory.
"""
if not os.path.exists("benchmarks/dynamo/huggingface.py"):
self.skipTest("Skip due to benchmarks/dynamo/huggingface.py not found.")
def _setup_env(env):
env["TORCHINDUCTOR_FORCE_DISABLE_CACHES"] = "1" # disable autotune cache
env["TORCHINDUCTOR_FX_GRAPH_REMOTE_CACHE"] = "0"
env["TORCHINDUCTOR_FX_GRAPH_CACHE"] = "0"
if enable_determinism:
env["TORCHINDUCTOR_DETERMINISTIC"] = "1"
# set to false if you want to check how the test fails without
# the deterministic mode
enable_determinism = True
with tempfile.TemporaryDirectory() as tmpdir:
saved_pkl = os.path.join(tmpdir, "saved.pkl")
cmd = (
f"{sys.executable} benchmarks/dynamo/huggingface.py --backend inductor"
+ f" --{precision} --accuracy --only {model_name} --{training_or_inference}"
+ f" --disable-cudagraphs --save-model-outputs-to={saved_pkl}"
)
print("Command", cmd)
env = os.environ.copy()
_setup_env(env)
out = subprocess.run(cmd.split(), capture_output=True, env=env)
# We don't check the accuracy against eager here because some
# of the combination between model and precision can not
# pass that accuracy test. But it's still valuable to make
# sure we generate bitwise equivalent result from run to run.
# self.assertTrue("pass" in out.stdout.decode())
cmd = (
f"{sys.executable} benchmarks/dynamo/huggingface.py --backend inductor"
+ f" --{precision} --accuracy --only {model_name} --{training_or_inference}"
+ f" --disable-cudagraphs --compare-model-outputs-with={saved_pkl}"
)
print("Command", cmd)
# distort benchmarking results
env["TORCHINDUCTOR_DISTORT_BENCHMARKING_RESULT"] = "inverse"
out = subprocess.run(cmd.split(), capture_output=True, env=env)
self.assertTrue(
"The result is bitwise equivalent to the previously saved result"
in out.stdout.decode(),
f"stdout: {out.stdout.decode()}, stderr: {out.stderr.decode()}",
)
if __name__ == "__main__":
if HAS_CUDA_AND_TRITON: