pytorch/benchmarks/dynamo/microbenchmarks
Aaron Orenstein 07669ed960 PEP585 update - benchmarks tools torchgen (#145101)
This is one of a series of PRs to update us to PEP585 (changing Dict -> dict, List -> list, etc).  Most of the PRs were completely automated with RUFF as follows:

Since RUFF UP006 is considered an "unsafe" fix first we need to enable unsafe fixes:

```
--- a/tools/linter/adapters/ruff_linter.py
+++ b/tools/linter/adapters/ruff_linter.py
@@ -313,6 +313,7 @@
                     "ruff",
                     "check",
                     "--fix-only",
+                    "--unsafe-fixes",
                     "--exit-zero",
                     *([f"--config={config}"] if config else []),
                     "--stdin-filename",
```

Then we need to tell RUFF to allow UP006 (as a final PR once all of these have landed this will be made permanent):

```
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -40,7 +40,7 @@

 [tool.ruff]
-target-version = "py38"
+target-version = "py39"
 line-length = 88
 src = ["caffe2", "torch", "torchgen", "functorch", "test"]

@@ -87,7 +87,6 @@
     "SIM116", # Disable Use a dictionary instead of consecutive `if` statements
     "SIM117",
     "SIM118",
-    "UP006", # keep-runtime-typing
     "UP007", # keep-runtime-typing
 ]
 select = [
```

Finally running `lintrunner -a --take RUFF` will fix up the deprecated uses.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/145101
Approved by: https://github.com/bobrenjc93
2025-01-18 05:05:07 +00:00
..
operator_inp_logs
__init__.py
analyze_templates.py [BE] Format .ci/ / .github/ / benchmarks/ / functorch/ / tools/ / torchgen/ with ruff format (#132577) 2024-10-11 18:30:26 +00:00
bench_mm_fusion.py [BC breaking] move benchmarking + prefer inductor path (#132827) 2024-08-08 00:47:45 +00:00
benchmark_helper.py
cache_debug_microbenchmarks.py [BE] fix ruff rule E226: add missing whitespace around operator in f-strings (#144415) 2025-01-08 21:55:00 +00:00
cache_hit_microbenchmarks.py Add a microbechmark for cache read path (#137607) 2024-10-10 16:36:18 +00:00
dynamo_guard_eval.py Rename cache limit to recompile limit in configs (#143709) 2024-12-22 10:03:57 +00:00
dynamo_microbenchmarks.py
fx_microbenchmarks.py [BE] fix ruff rule E226: add missing whitespace around operator in f-strings (#144415) 2025-01-08 21:55:00 +00:00
inductor_bmm.py [BE][Easy][3/19] enforce style for empty lines in import segments in benchmarks/ (#129754) 2024-07-17 14:34:42 +00:00
inductor_cpu_atomic.py
inductor_mm.py [BC breaking] move benchmarking + prefer inductor path (#132827) 2024-08-08 00:47:45 +00:00
matmul_relu.py [BE][Easy][3/19] enforce style for empty lines in import segments in benchmarks/ (#129754) 2024-07-17 14:34:42 +00:00
microbench.py [BE][Easy][3/19] enforce style for empty lines in import segments in benchmarks/ (#129754) 2024-07-17 14:34:42 +00:00
model.py
operator_inp_utils.py PEP585 update - benchmarks tools torchgen (#145101) 2025-01-18 05:05:07 +00:00
operatorbench.py [inductor] Benchmark Halide in operatorbench.py (#136809) 2024-09-28 19:26:04 +00:00
overheads.py [BE] fix ruff rule E226: add missing whitespace around operator in f-strings (#144415) 2025-01-08 21:55:00 +00:00
tensor_layout_mini_benchmark.py [BC breaking] move benchmarking + prefer inductor path (#132827) 2024-08-08 00:47:45 +00:00
utils.py