From 27593d78b34de046e4d8ebcf0c242343742bfc95 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Fri, 27 Jun 2025 14:44:29 -0700 Subject: [PATCH] update gitcommit to 2.8-rc3 Signed-off-by: Tom Rix --- pyproject.toml | 184 +++++++++++++++++++++++++++++++++++++++------- python-torch.spec | 35 ++++++--- 2 files changed, 181 insertions(+), 38 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9508ad0..ccf9c2a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,41 @@ +[project] +name = "torch" +requires-python = ">=3.9" +license = {text = "BSD-3-Clause"} +dynamic = [ + "authors", + "classifiers", + "entry-points", + "dependencies", + "description", + "keywords", + "optional-dependencies", + "readme", + "scripts", + "version", +] + +[project.urls] +Homepage = "https://pytorch.org/" +Documentation = "https://pytorch.org/docs/" +Source = "https://github.com/pytorch/pytorch" +Forum = "https://discuss.pytorch.org/" + + [build-system] requires = [ - "setuptools", + # After 75.8.2 dropped dep disttools API. Please fix + # API temporarily restored and shim used. Please fix + # Setuptools will drop support for setup.py past 80 + # min version for recursive glob package data support + "setuptools>=62.3.0,<80.0", "wheel", "astunparse", "numpy", "ninja", "pyyaml", "cmake", - "typing-extensions", + "typing-extensions>=4.10.0", "requests", ] # Use legacy backend to import local packages in setup.py @@ -15,32 +43,68 @@ build-backend = "setuptools.build_meta:__legacy__" [tool.black] -# Uncomment if pyproject.toml worked fine to ensure consistency with flake8 -# line-length = 120 -target-version = ["py38", "py39", "py310", "py311"] +line-length = 88 + +[tool.isort] +src_paths = ["caffe2", "torch", "torchgen", "functorch", "test"] +extra_standard_library = ["typing_extensions"] +skip_gitignore = true +skip_glob = ["third_party/*"] +atomic = true +profile = "black" +indent = 4 +line_length = 88 +lines_after_imports = 2 +multi_line_output = 3 +include_trailing_comma = true +combine_as_imports = true + + +[tool.usort.known] +first_party = ["caffe2", "torch", "torchgen", "functorch", "test"] +standard_library = ["typing_extensions"] [tool.ruff] -target-version = "py38" +line-length = 88 +src = ["caffe2", "torch", "torchgen", "functorch", "test"] +[tool.ruff.format] +docstring-code-format = true +quote-style = "double" + +[tool.ruff.lint] # NOTE: Synchoronize the ignores with .flake8 +external = [ + "B001", + "B902", + "B950", + "E121", + "E122", + "E128", + "E131", + "E704", + "E723", + "F723", + "F812", + "P201", + "P204", + "T484", + "TOR901", +] ignore = [ # these ignores are from flake8-bugbear; please fix! "B007", "B008", "B017", "B018", # Useless expression - "B019", "B023", "B028", # No explicit `stacklevel` keyword argument found - "B904", "E402", "C408", # C408 ignored because we like the dict keyword argument syntax "E501", # E501 is not flexible enough, we're using B950 instead "E721", - "E731", # Assign lambda expression "E741", "EXE001", "F405", - "F841", # these ignores are from flake8-logging-format; please fix! "G101", # these ignores are from ruff NPY; please fix! @@ -48,39 +112,41 @@ ignore = [ # these ignores are from ruff PERF; please fix! "PERF203", "PERF401", - "PERF403", # these ignores are from PYI; please fix! - "PYI019", "PYI024", "PYI036", "PYI041", "PYI056", "SIM102", "SIM103", "SIM112", # flake8-simplify code styles "SIM105", # these ignores are from flake8-simplify. please fix or ignore with commented reason - "SIM108", + "SIM108", # SIM108 ignored because we prefer if-else-block instead of ternary expression "SIM110", "SIM114", # Combine `if` branches using logical `or` operator "SIM115", "SIM116", # Disable Use a dictionary instead of consecutive `if` statements "SIM117", "SIM118", - "UP006", # keep-runtime-typing "UP007", # keep-runtime-typing + "TC006", ] -line-length = 120 select = [ "B", + "B904", # Re-raised error without specifying the cause via the from keyword "C4", "G", "E", "EXE", "F", "SIM1", + "SIM911", "W", # Not included in flake8 + "FURB", + "LOG", "NPY", "PERF", "PGH004", + "PIE790", "PIE794", "PIE800", "PIE804", @@ -89,40 +155,92 @@ select = [ "PLC0131", # type bivariance "PLC0132", # type param mismatch "PLC0205", # string as __slots__ + "PLC3002", # unnecessary-direct-lambda-call "PLE", "PLR0133", # constant comparison "PLR0206", # property with params "PLR1722", # use sys exit + "PLR1736", # unnecessary list index "PLW0129", # assert on string literal + "PLW0131", # named expr without context + "PLW0133", # useless exception statement + "PLW0245", # super without brackets "PLW0406", # import self "PLW0711", # binary op exception + "PLW1501", # bad open mode + "PLW1507", # shallow copy os.environ "PLW1509", # preexec_fn not safe with threads + "PLW2101", # useless lock statement "PLW3301", # nested min max "PT006", # TODO: enable more PT rules + "PT014", # duplicate parameterize case "PT022", "PT023", "PT024", "PT025", "PT026", "PYI", + "Q003", # avoidable escaped quote + "Q004", # unnecessary escaped quote + "RSE", "RUF008", # mutable dataclass default + "RUF013", # ban implicit optional "RUF015", # access first ele in constant time "RUF016", # type error non-integer index "RUF017", - "TRY200", - "TRY302", + "RUF018", # no assignment in assert + "RUF019", # unnecessary-key-check + "RUF020", # never union + "RUF024", # from keys mutable + "RUF026", # default factory kwarg + "RUF030", # No print statement in assert + "RUF033", # default values __post_init__ dataclass + "RUF041", # simplify nested Literal + "RUF048", # properly parse `__version__` + "RUF200", # validate pyproject.toml + "S324", # for hashlib FIPS compliance + "SLOT", + "TC", + "TRY002", # ban vanilla raise (todo fix NOQAs) + "TRY203", + "TRY401", # verbose-log-message "UP", + "YTT", ] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "__init__.py" = [ "F401", ] +"*.pyi" = [ + "PYI011", # typed-argument-default-in-stub + "PYI021", # docstring-in-stub + "PYI053", # string-or-bytes-too-long +] +"functorch/notebooks/**" = [ + "F401", +] +"test/export/**" = [ + "PGH004" +] +"test/typing/**" = [ + "PGH004" +] "test/typing/reveal/**" = [ "F821", ] "test/torch_np/numpy_tests/**" = [ "F821", + "NPY201", +] +"test/dynamo/test_bytecode_utils.py" = [ + "F821", +] +"test/dynamo/test_debug_utils.py" = [ + "UP037", +] +"test/dynamo/test_misc.py" = [ + "PGH004", ] "test/jit/**" = [ "PLR0133", # tests require this for JIT @@ -136,19 +254,33 @@ select = [ "RUF015", "UP", # We don't want to modify the jit test as they test specify syntax ] - -"torch/onnx/**" = [ - "UP037", # ONNX does runtime type checking +"test/inductor/s429861_repro.py" = [ + "PGH004", +] +"test/inductor/test_torchinductor.py" = [ + "UP037", +] +# autogenerated #TODO figure out why file level noqa is ignored +"torch/_appdirs.py" = ["PGH004"] +"torch/jit/_shape_functions.py" = ["PGH004"] +"torch/_inductor/fx_passes/serialized_patterns/**" = ["F401", "F501"] +"torch/_inductor/autoheuristic/artifacts/**" = ["F401", "F501"] +"torch/_inductor/codegen/**" = [ + "PGH004" ] - "torchgen/api/types/__init__.py" = [ "F401", "F403", ] -"torchgen/executorch/api/types/__init__.py" = [ - "F401", - "F403", -] "torch/utils/collect_env.py" = [ "UP", # collect_env.py needs to work with older versions of Python ] +"torch/_vendor/**" = [ + "UP", # No need to mess with _vendor +] +"tools/linter/**" = [ + "LOG015" # please fix +] + +[tool.codespell] +ignore-words = "tools/linter/dictionary.txt" diff --git a/python-torch.spec b/python-torch.spec index ab500c5..90c908c 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -6,12 +6,12 @@ # So pre releases can be tried %bcond_with gitcommit %if %{with gitcommit} -# v2.7.0-rc10 -%global commit0 134179474539648ba7dee1317959529fbd0e7f89 +# v2.8.0-rc3 +%global commit0 3d53a53e504089a52a149791fd33d7fc898bd055 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) -%global date0 20250415 -%global pypi_version 2.7.0 -%global flatbuffers_version 23.3.3 +%global date0 20250625 +%global pypi_version 2.8.0 +%global flatbuffers_version 24.12.23 %global miniz_version 3.0.2 %global pybind11_version 2.13.6 %else @@ -92,19 +92,16 @@ Source70: https://github.com/yhirose/cpp-httplib/archive/%{hl_commit}/cpp- %endif %if %{without kineto} +%if %{with gitcommit} +%global ki_commit 5e7501833f1021ce6f618572d3baf657b6319658 +%else %global ki_commit be1317644c68b4bfc4646024a6b221066e430031 +%endif %global ki_scommit %(c=%{ki_commit}; echo ${c:0:7}) Source80: https://github.com/pytorch/kineto/archive/%{ki_commit}/kineto-%{ki_scommit}.tar.gz %endif %if %{without gitcommit} -# Patch11: 0001-Improve-finding-and-using-the-rocm_version.h.patch - -# ROCm patches -# Patches need to be refactored for ToT -# These are ROCm packages -# Patch101: 0001-cuda-hip-signatures.patch - # https://github.com/pytorch/pytorch/issues/150187 # The hack job # Patch11: 0001-python-torch-disable-ck.patch @@ -112,6 +109,7 @@ Source80: https://github.com/pytorch/kineto/archive/%{ki_commit}/kineto-%{ Patch11: 0001-Add-cmake-varaible-USE_ROCM_CK.patch %else +Patch11: 0001-Add-cmake-variable-USE_ROCM_CK.patch %endif ExclusiveArch: x86_64 aarch64 @@ -190,6 +188,9 @@ BuildRequires: rocm-core-devel BuildRequires: rocm-hip-devel BuildRequires: rocm-runtime-devel BuildRequires: rocm-rpm-macros +%if %{with gitcommit} +BuildRequires: rocsolver-devel +%endif BuildRequires: rocthrust-devel BuildRequires: roctracer-devel @@ -356,9 +357,11 @@ sed -i -e 's@list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only)@#list(APPE sed -i -e 's@if(NOT TARGET fxdiv)@if(MSVC AND USE_XNNPACK)@' caffe2/CMakeLists.txt sed -i -e 's@TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv)@#TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv)@' caffe2/CMakeLists.txt +%if %{without gitcommit} # https://github.com/pytorch/pytorch/issues/149803 # Tries to checkout nccl sed -i -e 's@ checkout_nccl()@# checkout_nccl()@' tools/build_pytorch_libs.py +%endif # Disable the use of check_submodule's in the setup.py, we are a tarball, not a git repo sed -i -e 's@check_submodules()$@#check_submodules()@' setup.py @@ -432,6 +435,9 @@ mv googletest third_party # # Fake out pocketfft, and system header will be used mkdir third_party/pocketfft +%if %{with gitcommit} +cp /usr/include/pocketfft_hdronly.h third_party/pocketfft/ +%endif # # Use the system valgrind headers @@ -585,7 +591,12 @@ export DEVICE_LIB_PATH=${RESOURCE_DIR}/amdgcn/bitcode # pytorch uses clang, not hipcc export HIP_CLANG_PATH=%{rocmllvm_bindir} +%if %{?fedora} <= 43 +export PYTORCH_ROCM_ARCH="gfx1100;gfx1201" +%else export PYTORCH_ROCM_ARCH=%{rocm_gpu_list_default} +%endif + %py3_build %else