repo/gentoo:master commit in: sci-ml/caffe2/, sci-ml/caffe2/files/

"Alfredo Tupone" <[email protected]> Wed, 05 Aug 2026 15:39:50 +0000 (UTC)
Newsgroups gmane.linux.gentoo.cvs
Message-ID <1785944367.86ceb0ae0ce2b1e90c783825849cb3169922fb07.tupone@gentoo>
commit:     86ceb0ae0ce2b1e90c783825849cb3169922fb07
Author:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  5 15:39:15 2026 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Wed Aug  5 15:39:27 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=86ceb0ae

sci-ml/caffe2: drop 2.11.0-r3

Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>

 sci-ml/caffe2/Manifest                             |   1 -
 sci-ml/caffe2/caffe2-2.11.0-r3.ebuild              | 420 ---------------------
 .../caffe2-2.11.0-removekineto-pr178960.patch      | 170 ---------
 .../files/caffe2-2.11.0-rocm-fix-std-cpp17.patch   |  50 ---
 .../caffe2/files/caffe2-2.7.1-aotriton-fixes.patch |  27 --
 sci-ml/caffe2/files/caffe2-2.9.0-cmake.patch       |  53 ---
 .../files/caffe2-2.9.0-rocm-distributed-link.patch |  28 --
 7 files changed, 749 deletions(-)

diff --git a/sci-ml/caffe2/Manifest b/sci-ml/caffe2/Manifest
index e69cf61f8d9a..ca20074081b7 100644
--- a/sci-ml/caffe2/Manifest
+++ b/sci-ml/caffe2/Manifest
@@ -1,4 +1,3 @@
 DIST composable_kernel-7fe50dc3.tar.gz 5380728 BLAKE2B c89c346d8e2d7a93a9cf26409e477fcdd25c43bc3f99d904c3bfe1bc282c6844ef2f2c80aceabe3bf4494db3457285384d5de5a22281aa426ba7479af82b0caf SHA512 a62f92e2dd7da944bd34bab6cf3bf624f630dc316d29c755e9fd523343c3f7648b0b7e0c9a0c8f5e9654477599ae8be9dac687d4054b0390f064ac2e40fc1cd3
 DIST flash-attention-2.7.4.gh.tar.gz 5841323 BLAKE2B 432999d763f2b3d732580ddfea5d3e01370351db0656546259a5e500a07516dd03c98828bfb55855dabe4adc651033b5d97ea4725ca46158b9970f0fbc662710 SHA512 05a4afb09e666f7404d6a3f8b5256e7bed6eba60a6f1bde2b7dbb96d318975f0b458c2521c7a38d88e97b6e4c27f29077cf787849daf82586e33f43a3d9a84b3
-DIST pytorch-2.11.0.tar.gz 63504636 BLAKE2B d7227bd2d5475acf696bb48a3ca8cd8b7b6cd75fb99e64ebc71434e23817f94dea5164f48a176dcad1acd12186c33b02452582c1b41d6265b89cf54b29630670 SHA512 a5b27efdbce0506b49808e9dc5fbf1a56a22b1651b60236570823e1fe2c7395a0de9d3d7a01a568a201d593c52e7aa402e5d7645a54cb5932d5866e374ebf945
 DIST pytorch-2.12.0.tar.gz 64740318 BLAKE2B e5e46a93422454da420563d0a8057c87d1ed4b27e0bd9b3b30e46b5e40cfbb489072144ac00267af2f085432d55e12adf750daf15ea165a1252449b00dca1ff9 SHA512 f5ab0f6933d88271f772b416f8c9b3b0d3e1ffaf8d00838b455206266b40d7c805e34003d84b01cddc7f1ad917dd72d6f79a05063b0962cbf223d9042cff3206

diff --git a/sci-ml/caffe2/caffe2-2.11.0-r3.ebuild b/sci-ml/caffe2/caffe2-2.11.0-r3.ebuild
deleted file mode 100644
index 01eed14d2d28..000000000000
--- a/sci-ml/caffe2/caffe2-2.11.0-r3.ebuild
+++ /dev/null
@@ -1,420 +0,0 @@
-# Copyright 2022-2026 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{11..14} )
-ROCM_VERSION=6.1
-inherit python-single-r1 cmake cuda flag-o-matic prefix rocm toolchain-funcs
-
-MYPN=pytorch
-MYP=${MYPN}-${PV}
-
-# caffe2-2.9.0 depends on future version of composable kernel
-# TODO: replace it with DEPEND in the future
-CK_COMMIT=7fe50dc3da2069d6645d9deb8c017a876472a977
-CK_P=composable_kernel-${CK_COMMIT:0:8}
-
-FLASH_PV=2.7.4
-FLASH_PN=flash-attention
-FLASH_P=${FLASH_PN}-${FLASH_PV}
-FLASH_ATT_URI="https://github.com/Dao-AILab/${FLASH_PN}/archive/refs/tags/v${FLASH_PV}.tar.gz -> ${FLASH_P}.gh.tar.gz"
-
-AOTRITON_PV=0.9.2b
-AOTRITON_PN=aotriton
-AOTRITON_P=${AOTRITON_PN}-${AOTRITON_PV}
-AOTRITON_tar=${AOTRITON_P}-manylinux_2_28_x86_64-rocm6.3-shared.tar.gz
-
-DESCRIPTION="A deep learning framework"
-HOMEPAGE="https://pytorch.org/"
-SRC_URI="
-	https://github.com/pytorch/${MYPN}/archive/refs/tags/v${PV}.tar.gz -> ${MYP}.tar.gz
-	rocm? (
-		https://github.com/ROCm/composable_kernel/archive/${CK_COMMIT}.tar.gz
-		-> ${CK_P}.tar.gz
-	)
-	cuda? (
-		flash? ( ${FLASH_ATT_URI} )
-		memefficient? ( ${FLASH_ATT_URI} )
-	)
-"
-
-S="${WORKDIR}"/${MYP}
-
-LICENSE="BSD"
-SLOT="0"
-KEYWORDS="~amd64 ~arm64"
-IUSE="cuda cusparselt distributed fbgemm flash gloo kineto memefficient
-	mimalloc mkl mpi nccl nnpack +numpy onednn openblas opencl openmp qnnpack
-	rocm xnnpack"
-RESTRICT="test"
-REQUIRED_USE="
-	${PYTHON_REQUIRED_USE}
-	mpi? ( distributed )
-	gloo? ( distributed )
-	?? ( cuda rocm )
-	rocm? (
-		|| ( ${ROCM_REQUIRED_USE} )
-		memefficient? ( flash )
-	)
-	cusparselt? ( || ( cuda rocm ) )
-	flash? ( || ( cuda rocm ) )
-	memefficient? ( || ( cuda rocm ) )
-	nccl? ( rocm )
-"
-
-RDEPEND="
-	${PYTHON_DEPS}
-	dev-cpp/abseil-cpp:=
-	dev-cpp/gflags:=
-	>=dev-cpp/glog-0.5.0:=
-	>=dev-libs/cpuinfo-2025.11.14
-	dev-libs/libfmt:=
-	dev-libs/protobuf:=
-	dev-libs/sleef
-	sci-ml/onnx
-	virtual/lapack
-	cuda? (
-		dev-libs/cudnn
-		>=sci-ml/cudnn-frontend-1.12.0:=
-		>=dev-util/nvidia-cuda-toolkit-12.9:=[profiler]
-		cusparselt? ( dev-libs/cusparselt )
-	)
-	fbgemm? ( >=sci-ml/FBGEMM-1.4 )
-	gloo? ( >=sci-ml/gloo-2025.06.04[cuda?,rocm?] )
-	kineto? ( ~sci-ml/kineto-0.4.0_p20260323 )
-	mimalloc? ( dev-libs/mimalloc )
-	mpi? ( virtual/mpi )
-	nnpack? (
-		sci-ml/NNPACK
-		dev-libs/pthreadpool
-	)
-	numpy? ( $(python_gen_cond_dep '
-		dev-python/numpy[${PYTHON_USEDEP}]
-	') )
-	onednn? ( sci-ml/oneDNN )
-	opencl? ( virtual/opencl )
-	qnnpack? (
-		!sci-libs/QNNPACK
-		sci-ml/gemmlowp
-		dev-libs/pthreadpool
-	)
-	rocm? (
-		nccl? ( >=dev-libs/rccl-6.3:= <dev-libs/rccl-7.3:= )
-		>=dev-util/hip-6.3:=       <dev-util/hip-7.3:=
-		>=dev-util/roctracer-6.3:= <dev-util/roctracer-7.3:=
-		>=sci-libs/hipBLAS-6.3:=   <sci-libs/hipBLAS-7.3:=[rocsolver(+)]
-		>=sci-libs/hipBLASLt-6.3:= <sci-libs/hipBLASLt-7.3:=
-		>=sci-libs/hipFFT-6.3:=    <sci-libs/hipFFT-7.3:=
-		>=sci-libs/hipRAND-6.3:=   <sci-libs/hipRAND-7.3:=
-		>=sci-libs/hipSOLVER-6.3:= <sci-libs/hipSOLVER-7.3:=
-		>=sci-libs/hipSPARSE-6.3:= <sci-libs/hipSPARSE-7.3:=
-		>=sci-libs/miopen-6.3:=    <sci-libs/miopen-7.3:=
-		>=sci-libs/rocBLAS-6.3:=   <sci-libs/rocBLAS-7.3:=
-		>=sci-libs/rocRAND-6.3:=   <sci-libs/rocRAND-7.3:=
-		>=sci-libs/rocSOLVER-6.3:= <sci-libs/rocSOLVER-7.3:=
-		memefficient? ( =sci-libs/aotriton-bin-0.11*:= )
-		distributed? ( >=dev-util/rocm-smi-6.3:= <dev-util/rocm-smi-7.3:= )
-		cusparselt? ( >=sci-libs/hipsparselt-6.3:= <sci-libs/hipsparselt-7.3:= )
-	)
-	distributed? (
-		!rocm? ( sci-ml/tensorpipe[cuda?] )
-		dev-cpp/cpp-httplib:=
-	)
-	xnnpack? (
-		>=sci-ml/XNNPACK-2024.11
-		dev-libs/pthreadpool
-	)
-	mkl? ( sci-libs/mkl )
-	openblas? ( sci-libs/openblas )
-"
-
-DEPEND="
-	${RDEPEND}
-	dev-cpp/nlohmann_json
-	dev-libs/flatbuffers
-	dev-libs/FXdiv
-	dev-libs/pocketfft
-	dev-libs/psimd
-	sci-ml/FP16
-	$(python_gen_cond_dep '
-		<dev-python/pybind11-3.0.2[${PYTHON_USEDEP}]
-		dev-python/pyyaml[${PYTHON_USEDEP}]
-		dev-python/typing-extensions[${PYTHON_USEDEP}]
-	')
-	cuda? ( >=dev-libs/cutlass-3.9.2[tools(+)] )
-	onednn? ( sci-ml/ideep )
-	rocm? (
-		>=sci-libs/hipCUB-6.3:=    <sci-libs/hipCUB-7.3:=
-		>=sci-libs/rocPRIM-6.3:=   <sci-libs/rocPRIM-7.3:=
-		>=sci-libs/rocThrust-6.3:= <sci-libs/rocThrust-7.3:=
-	)
-	qnnpack? ( dev-libs/clog )
-"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-2.5.1-unbundle_fmt.patch
-	"${FILESDIR}"/${PN}-2.5.1-unbundle_kineto.patch
-	"${FILESDIR}"/${PN}-2.8.0-unbundle_pocketfft.patch
-	"${FILESDIR}"/${PN}-2.5.1-cudnn_include_fix.patch
-	"${FILESDIR}"/${PN}-2.4.0-cpp-httplib.patch
-	"${FILESDIR}"/${PN}-2.5.1-glog-0.6.0.patch
-	"${FILESDIR}"/${P}-rocm-fix-std-cpp17.patch
-	"${FILESDIR}"/${PN}-2.7.0-glog-0.7.1.patch
-	"${FILESDIR}"/${PN}-2.7.1-aotriton-fixes.patch
-	"${FILESDIR}"/${PN}-2.8.0-rocm-minus-flash.patch
-	"${FILESDIR}"/${PN}-2.9.0-cmake.patch
-	"${FILESDIR}"/${PN}-2.9.0-rocm-distributed-link.patch
-	"${FILESDIR}"/${PN}-2.9.1-torch_cpu.patch
-	"${FILESDIR}"/${PN}-2.10.0-gentoo.patch
-	"${FILESDIR}"/${P}-mimalloc.patch
-	"${FILESDIR}"/${P}-removekineto-pr178960.patch
-)
-
-src_prepare() {
-	if use cuda && ( use flash || use memefficient ); then
-		mv "${WORKDIR}"/${FLASH_P}/* third_party/${FLASH_PN}/ || die
-	fi
-	filter-lto #bug 862672
-
-	# Unbundle fmt
-	sed -i \
-		-e 's|::fmt-header-only||' \
-		c10/CMakeLists.txt \
-		cmake/Dependencies.cmake \
-		torch/CMakeLists.txt \
-		|| die
-
-	# tensorpipe is in system, not a build target of caffe2
-	sed -e '/target_compile_options_if_supported(tensorpipe/d' -i cmake/Dependencies.cmake || die
-
-	# Drop third_party from CMake tree
-	sed -i \
-		-e '/add_subdirectory.*third_party/d' \
-		CMakeLists.txt \
-		cmake/Dependencies.cmake \
-		cmake/ProtoBuf.cmake \
-		aten/src/ATen/CMakeLists.txt \
-		|| die
-	# Change libc10* path
-	sed -i \
-		-e "/EXPORT/s|DESTINATION lib)|DESTINATION $(get_libdir))|" \
-		c10/cuda/CMakeLists.txt \
-		c10/CMakeLists.txt \
-		c10/hip/CMakeLists.txt \
-		|| die
-
-	# Change libaotriton path
-	sed -i \
-		-e "s|}/lib|}/\${CMAKE_INSTALL_LIBDIR}|g" \
-		-e "/set(__AOTRITON_LIB/s|lib/|\${CMAKE_INSTALL_LIBDIR}/|g" \
-		cmake/External/aotriton.cmake \
-		|| die
-
-	# Noisy warnings from Logging.h
-	sed -i 's/-Wextra-semi//' cmake/public/utils.cmake || die
-
-	cmake_src_prepare
-	pushd torch/csrc/jit/serialization > /dev/null || die
-	flatc --cpp --gen-mutable --scoped-enums mobile_bytecode.fbs || die
-	popd > /dev/null || die
-
-	# prefixify the hardcoded paths, after all patches are applied
-	hprefixify \
-		aten/CMakeLists.txt \
-		caffe2/CMakeLists.txt \
-		cmake/Metal.cmake \
-		cmake/Modules/*.cmake \
-		cmake/Modules_CUDA_fix/FindCUDNN.cmake \
-		cmake/Modules_CUDA_fix/upstream/FindCUDA/make2cmake.cmake \
-		cmake/Modules_CUDA_fix/upstream/FindPackageHandleStandardArgs.cmake \
-		cmake/public/LoadHIP.cmake \
-		cmake/public/cuda.cmake \
-		cmake/Dependencies.cmake \
-		torch/CMakeLists.txt \
-		CMakeLists.txt
-
-	if use rocm; then
-		sed -e "s:/opt/rocm:/usr:" \
-			-e "s:lib/cmake:$(get_libdir)/cmake:g" \
-			-i cmake/public/LoadHIP.cmake || die
-
-		# TODO: delete, when caffe2 depends on systemwide composable_kernel
-		sed -e "s:third_party/composable_kernel:../composable_kernel-${CK_COMMIT}:g" \
-			-i aten/src/ATen/CMakeLists.txt || die
-
-		# Bug 959808: fix for gfx101x targets
-		pushd "${WORKDIR}/composable_kernel-${CK_COMMIT}" > /dev/null || die
-		eapply "${FILESDIR}"/composable-kernel-7fe50dc-expand-isa.patch
-		popd > /dev/null || die
-
-		if tc-is-clang; then
-			# Systemwide gcc (for absl and at::TensorBase) + hipcc (llvm>=18) need abi-compat=17.
-			# But systemwide clang>=18 + hipcc (>=llvm-18) need opposite!
-			# See also: https://github.com/llvm/llvm-project/issues/102443#issuecomment-2329726287
-			sed -e '/-fclang-abi-compat=17/d' -i cmake/Dependencies.cmake || die
-		fi
-
-		# Workaround for libc++ issue https://github.com/llvm/llvm-project/issues/100802
-		sed -e 's/std::memcpy/memcpy/g' -i torch/headeronly/util/Half.h || die
-
-		ebegin "HIPifying cuda sources"
-		FBCODE_BUILD_TOOL="buck" ${EPYTHON} tools/amd_build/build_amd.py || die
-		eend $?
-	fi
-}
-
-src_configure() {
-	if use cuda && [[ -z ${TORCH_CUDA_ARCH_LIST} ]]; then
-		ewarn "WARNING: caffe2 is being built with its default CUDA compute capabilities: 3.5 and 7.0."
-		ewarn "These may not be optimal for your GPU."
-		ewarn ""
-		ewarn "To configure caffe2 with the CUDA compute capability that is optimal for your GPU,"
-		ewarn "set TORCH_CUDA_ARCH_LIST in your make.conf, and re-emerge caffe2."
-		ewarn "For example, to use CUDA capability 7.5 & 3.5, add: TORCH_CUDA_ARCH_LIST=7.5 3.5"
-		ewarn "For a Maxwell model GPU, an example value would be: TORCH_CUDA_ARCH_LIST=Maxwell"
-		ewarn ""
-		ewarn "You can look up your GPU's CUDA compute capability at https://developer.nvidia.com/cuda-gpus"
-		ewarn "or by running /opt/cuda/extras/demo_suite/deviceQuery | grep 'CUDA Capability'"
-	fi
-
-	local mycmakeargs=(
-		-DBUILD_CUSTOM_PROTOBUF=OFF
-		-DBUILD_TEST=OFF
-		-DLIBSHM_INSTALL_LIB_SUBDIR="${EPREFIX}"/usr/$(get_libdir)
-		-DPython_EXECUTABLE="${PYTHON}"
-		-DTORCH_INSTALL_LIB_DIR="${EPREFIX}"/usr/$(get_libdir)
-		-DUSE_CCACHE=OFF
-		-DUSE_CUDA=$(usex cuda)
-		-DUSE_DISTRIBUTED=$(usex distributed)
-		-DUSE_FBGEMM=$(usex fbgemm)
-		-DUSE_FLASH_ATTENTION=$(usex flash)
-		-DUSE_GFLAGS=ON
-		-DUSE_GLOG=ON
-		-DUSE_GLOO=$(usex gloo)
-		-DUSE_ITT=OFF
-		-DUSE_KINETO=$(usex kineto)
-		-DUSE_KLEIDIAI=OFF # TODO
-		-DUSE_MAGMA=OFF # TODO: In GURU as sci-libs/magma
-		-DUSE_MEM_EFF_ATTENTION=$(usex memefficient)
-		-DUSE_MIMALLOC=$(usex mimalloc)
-		-DUSE_MKLDNN=$(usex onednn)
-		-DUSE_MPI=$(usex mpi)
-		-DUSE_NCCL=OFF
-		-DUSE_NNPACK=$(usex nnpack)
-		-DUSE_NUMA=OFF
-		-DUSE_NUMPY=$(usex numpy)
-		-DUSE_OPENCL=$(usex opencl)
-		-DUSE_OPENMP=$(usex openmp)
-		-DUSE_PYTORCH_QNNPACK=$(usex qnnpack)
-		-DUSE_PYTORCH_METAL=OFF
-		-DUSE_ROCM=$(usex rocm)
-		-DUSE_SYSTEM_CPUINFO=ON
-		-DUSE_SYSTEM_EIGEN_INSTALL=ON
-		-DUSE_SYSTEM_FP16=ON
-		-DUSE_SYSTEM_FXDIV=ON
-		-DUSE_SYSTEM_GLOO=ON
-		-DUSE_SYSTEM_NVTX=ON
-		-DUSE_SYSTEM_ONNX=ON
-		-DUSE_SYSTEM_PSIMD=ON
-		-DUSE_SYSTEM_PTHREADPOOL=ON
-		-DUSE_SYSTEM_PYBIND11=ON
-		-DUSE_SYSTEM_SLEEF=ON
-		-DUSE_SYSTEM_XNNPACK=$(usex xnnpack)
-		-DUSE_TENSORPIPE=$(usex distributed $(usex !rocm))
-		-DUSE_UCC=OFF
-		-DUSE_VALGRIND=OFF
-		-DUSE_XNNPACK=$(usex xnnpack)
-		-DUSE_XPU=OFF
-		-Wno-dev
-	)
-
-	if use mkl; then
-		mycmakeargs+=(-DBLAS=MKL)
-	elif use openblas; then
-		mycmakeargs+=(-DBLAS=OpenBLAS)
-	else
-		mycmakeargs+=(-DBLAS=Generic -DBLAS_LIBRARIES=)
-	fi
-
-	if use cuda; then
-		# bug 867706 926116
-		cuda_add_sandbox
-		addpredict "/dev/char/"
-
-		mycmakeargs+=(
-			-DUSE_CUDNN=ON
-			-DTORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST:-3.5 7.0}"
-			-DUSE_NCCL=OFF # TODO: NVIDIA Collective Communication Library
-			-DCMAKE_CUDA_FLAGS="$(cuda_gccdir -f | tr -d \")"
-			-DUSE_CUSPARSELT=$(usex cusparselt)
-		)
-
-		[[ -v CUDACXX ]] && export PYTORCH_NVCC="${CUDACXX}"
-
-		if use flash; then
-			export FLASH_ATTENTION_FORCE_BUILD="TRUE"
-			export FLASH_ATTN_CUDA_ARCHS="${CUDAARCHS:-${TORCH_CUDA_ARCH_LIST:-3.5 7.0}}"
-		fi
-
-	elif use rocm; then
-		export PYTORCH_ROCM_ARCH="$(get_amdgpu_flags)"
-
-		if use memefficient; then
-			export AOTRITON_INSTALLED_PREFIX="${ESYSROOT}/usr"
-		fi
-
-		mycmakeargs+=(
-			-DUSE_NCCL=$(usex nccl)
-			-DUSE_SYSTEM_NCCL=ON
-			-DCMAKE_REQUIRE_FIND_PACKAGE_HIP=ON
-			-DCMAKE_DISABLE_FIND_PACKAGE_hipsparselt=$(usex !cusparselt) # disable automagic
-			-DUSE_ROCM_CK_SDPA=OFF # requires flash + aiter, works only on gfx90a/gfx942/gfx950
-		)
-
-		# ROCm libraries produce too much warnings
-		append-cxxflags -Wno-deprecated-declarations -Wno-unused-result -Wno-unused-value
-	fi
-
-	if use onednn; then
-		mycmakeargs+=(
-			-DMKLDNN_FOUND=ON
-			-DMKLDNN_LIBRARIES=dnnl
-			-DMKLDNN_INCLUDE_DIR="${ESYSROOT}/usr/include/oneapi/dnnl"
-		)
-	fi
-
-	cmake_src_configure
-}
-
-src_compile() {
-	PYTORCH_BUILD_VERSION=${PV} \
-	PYTORCH_BUILD_NUMBER=0 \
-	cmake_src_compile
-}
-
-python_install() {
-	python_domodule python/torch
-	mkdir "${D}"$(python_get_sitedir)/torch/bin || die
-	mkdir "${D}"$(python_get_sitedir)/torch/lib || die
-	mkdir "${D}"$(python_get_sitedir)/torch/include || die
-	ln -s ../../../../../include/torch \
-		"${D}$(python_get_sitedir)"/torch/include/torch || die # bug 923269
-	ln -s ../../../../../bin/torch_shm_manager \
-		"${D}"/$(python_get_sitedir)/torch/bin/torch_shm_manager || die
-	ln -s ../../../../../$(get_libdir)/libtorch_global_deps.so \
-		"${D}"/$(python_get_sitedir)/torch/lib/libtorch_global_deps.so || die
-}
-
-src_install() {
-	cmake_src_install
-
-	# Used by pytorch ebuild
-	insinto "/var/lib/${PN}"
-	doins "${BUILD_DIR}"/CMakeCache.txt
-
-	rm -rf python
-	mkdir -p python/torch || die
-	cp torch/version.py python/torch/ || die
-	python_install
-}

diff --git a/sci-ml/caffe2/files/caffe2-2.11.0-removekineto-pr178960.patch b/sci-ml/caffe2/files/caffe2-2.11.0-removekineto-pr178960.patch
deleted file mode 100644
index a762097e0fc0..000000000000
--- a/sci-ml/caffe2/files/caffe2-2.11.0-removekineto-pr178960.patch
+++ /dev/null
@@ -1,170 +0,0 @@
-diff --git a/torch/csrc/autograd/init.cpp b/torch/csrc/autograd/init.cpp
-index 28c1a43..70d8f7b 100644
---- a/torch/csrc/autograd/init.cpp
-+++ b/torch/csrc/autograd/init.cpp
-@@ -301,12 +301,7 @@ PyObject* THPAutograd_initExtension(PyObject* _unused, PyObject* unused) {
-       .def("privateuse1_elapsed_us", &KinetoEvent::privateuse1ElapsedUs)
-       .def(
-           "is_user_annotation",
--          [](const KinetoEvent& e) {
--            return e.activityType() ==
--                (uint8_t)libkineto::ActivityType::USER_ANNOTATION ||
--                e.activityType() ==
--                (uint8_t)libkineto::ActivityType::GPU_USER_ANNOTATION;
--          })
-+          [](const KinetoEvent& e) { return e.isUserAnnotation(); })
-       .def("nbytes", [](const KinetoEvent& e) { return e.nBytes(); })
-       // whether the event is hidden
-       .def(
-diff --git a/torch/csrc/autograd/profiler_kineto.cpp b/torch/csrc/autograd/profiler_kineto.cpp
-index dd4598669827e..85de1c3af923f 100644
---- a/torch/csrc/autograd/profiler_kineto.cpp
-+++ b/torch/csrc/autograd/profiler_kineto.cpp
-@@ -1081,6 +1081,13 @@ int64_t KinetoEvent::privateuse1ElapsedUs() const {
-   return -1;
- }
- 
-+bool KinetoEvent::isUserAnnotation() const {
-+  constexpr uint8_t kUserAnnotation = 1;
-+  constexpr uint8_t kGpuUserAnnotation = 2;
-+  const auto type = activityType();
-+  return type == kUserAnnotation || type == kGpuUserAnnotation;
-+}
-+
- void KinetoEvent::getPerfEventCounters(std::vector<uint64_t>& in) const {
-   return result_->visit(c10::overloaded(
-       [&in](const ExtraFields<EventType::TorchOp>& e) -> void {
-diff --git a/torch/csrc/autograd/profiler_kineto.h b/torch/csrc/autograd/profiler_kineto.h
-index 777b8a5851ed5..c3135c61245d4 100644
---- a/torch/csrc/autograd/profiler_kineto.h
-+++ b/torch/csrc/autograd/profiler_kineto.h
-@@ -67,6 +67,7 @@ struct TORCH_API KinetoEvent {
-   bool isPythonFunction() const;
-   int64_t cudaElapsedUs() const;
-   int64_t privateuse1ElapsedUs() const;
-+  bool isUserAnnotation() const;
-   void getPerfEventCounters(torch::profiler::perf_counters_t& /*in*/) const;
-   extra_meta_t extraMeta() const;
-   std::string metadataJson() const;
-diff --git a/torch/csrc/profiler/collection.cpp b/torch/csrc/profiler/collection.cpp
-index eb29cb7382127..8ee3a9e7707a8 100644
---- a/torch/csrc/profiler/collection.cpp
-+++ b/torch/csrc/profiler/collection.cpp
-@@ -572,11 +572,13 @@ std::string toString(const ExtraFields<EventType::PyCall>& e) {
-       e.callsite_.funcname_.str());
- }
- 
-+#ifdef USE_KINETO
- auto scopeToType(at::RecordScope scope) {
-   return scope == at::RecordScope::USER_SCOPE
-       ? libkineto::ActivityType::USER_ANNOTATION
-       : libkineto::ActivityType::CPU_OP;
- }
-+#endif
- 
- int64_t torchOpEndNS(
-     const ExtraFields<EventType::TorchOp>& e,
-@@ -625,6 +627,7 @@ std::string Result::overload_name() const {
-       [](const auto& e) -> std::string { return ""; }));
- }
- 
-+#ifdef USE_KINETO
- libkineto::ActivityType Result::kinetoType() const {
-   return visit(c10::overloaded(
-       ATTRIBUTE(TorchOp, scopeToType(e.scope_)),
-@@ -637,6 +640,11 @@ libkineto::ActivityType Result::kinetoType() const {
-       ATTRIBUTE(PythonGC, libkineto::ActivityType::PYTHON_FUNCTION),
-       ATTRIBUTE(Kineto, e.activity_type_)));
- }
-+#else
-+libkineto::ActivityType Result::kinetoType() const {
-+  return libkineto::ActivityType::NONE;
-+}
-+#endif
- 
- uint64_t Result::correlationID() const {
-   return visit(c10::overloaded(
-diff --git a/torch/csrc/profiler/kineto_shim.cpp b/torch/csrc/profiler/kineto_shim.cpp
-index fa232e1a01016..0ddf62997a07e 100644
---- a/torch/csrc/profiler/kineto_shim.cpp
-+++ b/torch/csrc/profiler/kineto_shim.cpp
-@@ -138,6 +138,7 @@ TraceWrapper::TraceWrapper(const int64_t start_time, const std::string& name)
- }
- #endif // USE_KINETO
- 
-+#ifdef USE_KINETO
- activity_t* TraceWrapper::addCPUActivity(
-     const std::string& name,
-     const libkineto::ActivityType type,
-@@ -145,7 +146,6 @@ activity_t* TraceWrapper::addCPUActivity(
-     const uint64_t correlation_id,
-     const int64_t start_time,
-     const int64_t end_time) {
--#ifdef USE_KINETO
-   TORCH_CHECK((bool)(*this), "Cannot add event to non-existent trace.");
-   cpu_trace_->emplace_activity(cpu_trace_->span, type, name);
-   auto& act = libkineto::CpuTraceBuffer::toRef(cpu_trace_->activities.back());
-@@ -157,10 +157,18 @@ activity_t* TraceWrapper::addCPUActivity(
-     act.endTime = end_time;
-   }
-   return cpu_trace_->activities.back().get();
-+}
- #else
-+activity_t* TraceWrapper::addCPUActivity(
-+    const std::string& name,
-+    const libkineto::ActivityType type,
-+    const DeviceAndResource device_and_resource,
-+    const uint64_t correlation_id,
-+    const int64_t start_time,
-+    const int64_t end_time) {
-   return nullptr;
--#endif // USE_KINETO
- }
-+#endif // USE_KINETO
- 
- void TraceWrapper::transferCpuTrace(int64_t end_time) {
- #ifdef USE_KINETO
-@@ -473,6 +481,7 @@ void logInvariantViolation(
- 
- namespace autograd::profiler {
- c10::DeviceType deviceTypeFromActivity(libkineto::ActivityType activity_type) {
-+#ifdef USE_KINETO
-   // PrivateUse1 kineto backend reuse some ActivityTypes,
-   // If PrivateUse1 backend is enabled, this should return
-   // c10::DeviceType::PrivateUse1.
-@@ -524,6 +533,9 @@ c10::DeviceType deviceTypeFromActivity(libkineto::ActivityType activity_type) {
-       return c10::DeviceType::CPU;
-     }
-   }
-+#else
-+  return c10::DeviceType::CPU;
-+#endif // USE_KINETO
- }
- 
- void addMetadataJson(const std::string& key, const std::string& value) {
-diff --git a/torch/csrc/profiler/kineto_shim.h b/torch/csrc/profiler/kineto_shim.h
-index 4f9bdc6770507..ddc00c03fa9cc 100644
---- a/torch/csrc/profiler/kineto_shim.h
-+++ b/torch/csrc/profiler/kineto_shim.h
-@@ -12,7 +12,21 @@
- #undef USE_KINETO
- #endif
- 
-+#ifdef USE_KINETO
- #include <ActivityType.h>
-+#else
-+namespace libkineto {
-+enum class ActivityType : uint8_t {
-+  CPU_OP = 0,
-+  USER_ANNOTATION,
-+  GPU_USER_ANNOTATION,
-+  NONE = CPU_OP,
-+};
-+inline const char* toString(ActivityType) {
-+  return "CPU_OP";
-+}
-+} // namespace libkineto
-+#endif
- 
- #include <torch/csrc/Export.h>
- #include <torch/csrc/profiler/api.h>

diff --git a/sci-ml/caffe2/files/caffe2-2.11.0-rocm-fix-std-cpp17.patch b/sci-ml/caffe2/files/caffe2-2.11.0-rocm-fix-std-cpp17.patch
deleted file mode 100644
index 054d83d78eee..000000000000
--- a/sci-ml/caffe2/files/caffe2-2.11.0-rocm-fix-std-cpp17.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-Fix for CXX=clang USE=rocm error: invalid argument '-std=c++17' not allowed with 'C'
-https://github.com/pytorch/pytorch/issues/103222
---- a/c10/hip/CMakeLists.txt
-+++ b/c10/hip/CMakeLists.txt
-@@ -37,6 +37,7 @@ if(NOT BUILD_LIBTORCHLESS)
- 
-   # Propagate HIP_CXX_FLAGS that were set from Dependencies.cmake
-   target_compile_options(c10_hip PRIVATE ${HIP_CXX_FLAGS})
-+  set_target_properties(c10_hip PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF)
- 
-   # caffe2_hip adds a bunch of dependencies like rocsparse, but c10/hip is supposed to be
-   # minimal.  I'm not sure if we need hip_hcc or not; for now leave it out
---- a/caffe2/CMakeLists.txt
-+++ b/caffe2/CMakeLists.txt
-@@ -1774,6 +1774,7 @@ if(USE_ROCM)
- 
-   # Since PyTorch files contain HIP headers, these flags are required for the necessary definitions to be added.
-   target_compile_options(torch_hip PUBLIC ${HIP_CXX_FLAGS})  # experiment
-+  set_target_properties(torch_hip PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF)
- 
-   target_link_libraries(torch_hip PUBLIC c10_hip)
- 
-@@ -2003,6 +2004,7 @@ if(BUILD_TEST)
-       target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>)
-       target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE} ${Caffe2_HIP_INCLUDE})
-       target_compile_options(${test_name} PRIVATE ${HIP_CXX_FLAGS})
-+      set_target_properties(${test_name} PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF)
-       add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>)
-       if(INSTALL_TEST)
-         set_target_properties(${test_name} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${_rpath_portable_origin}/../lib")
---- a/cmake/Dependencies.cmake
-+++ b/cmake/Dependencies.cmake
-@@ -1014,7 +1014,6 @@
-       list(APPEND HIP_CXX_FLAGS -DUSE_ROCM_CK_GEMM)
-     endif()
-     list(APPEND HIP_HIPCC_FLAGS --offload-compress)
--    list(APPEND HIP_HIPCC_FLAGS -std=c++17)
-     # Pass device library path for theRock nightly builds
-     if(DEFINED ENV{HIP_DEVICE_LIB_PATH})
-       file(TO_CMAKE_PATH "$ENV{HIP_DEVICE_LIB_PATH}" _hip_device_lib_path)
---- a/cmake/public/utils.cmake
-+++ b/cmake/public/utils.cmake
-@@ -254,6 +254,7 @@ function(caffe2_hip_binary_target target_name_or_src)
-   caffe2_binary_target(${target_name_or_src})
- 
-   target_compile_options(${__target} PRIVATE ${HIP_CXX_FLAGS})
-+  set_target_properties(${__target} PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF)
-   target_include_directories(${__target} PRIVATE ${Caffe2_HIP_INCLUDE})
- endfunction()
- 

diff --git a/sci-ml/caffe2/files/caffe2-2.7.1-aotriton-fixes.patch b/sci-ml/caffe2/files/caffe2-2.7.1-aotriton-fixes.patch
deleted file mode 100644
index c648f3a39ed0..000000000000
--- a/sci-ml/caffe2/files/caffe2-2.7.1-aotriton-fixes.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-Fix installation with aotriton
-
-Upstream bug: https://github.com/pytorch/pytorch/issues/158109
---- a/cmake/External/aotriton.cmake
-+++ b/cmake/External/aotriton.cmake
-@@ -43,10 +43,6 @@ if(NOT __AOTRITON_INCLUDED)
- 
-   # Note it is INSTALL"ED"
-   if(DEFINED ENV{AOTRITON_INSTALLED_PREFIX})
--    install(DIRECTORY
--            $ENV{AOTRITON_INSTALLED_PREFIX}/${CMAKE_INSTALL_LIBDIR}
--            $ENV{AOTRITON_INSTALLED_PREFIX}/include
--            DESTINATION ${__AOTRITON_INSTALL_DIR})
-     set(__AOTRITON_INSTALL_DIR "$ENV{AOTRITON_INSTALLED_PREFIX}")
-     message(STATUS "Using Preinstalled AOTriton at ${__AOTRITON_INSTALL_DIR}")
-   elseif(DEFINED ENV{AOTRITON_INSTALL_FROM_SOURCE})
---- a/caffe2/CMakeLists.txt
-+++ b/caffe2/CMakeLists.txt
-@@ -921,7 +921,7 @@ if(USE_ROCM)
-   set(CUDA_LINK_LIBRARIES_KEYWORD PRIVATE)
-   list(APPEND Caffe2_HIP_SRCS ${GENERATED_CXX_TORCH_CUDA})
-   hip_add_library(torch_hip ${Caffe2_HIP_SRCS})
--  if(USE_FLASH_ATTENTION)
-+  if(USE_FLASH_ATTENTION OR USE_MEM_EFF_ATTENTION)
-     target_link_libraries(torch_hip PRIVATE __caffe2_aotriton)
-   endif()
-   set(CUDA_LINK_LIBRARIES_KEYWORD)

diff --git a/sci-ml/caffe2/files/caffe2-2.9.0-cmake.patch b/sci-ml/caffe2/files/caffe2-2.9.0-cmake.patch
deleted file mode 100644
index 3c2bb13a3cc0..000000000000
--- a/sci-ml/caffe2/files/caffe2-2.9.0-cmake.patch
+++ /dev/null
@@ -1,53 +0,0 @@
---- a/.ci/pytorch/test_example_code/CMakeLists.txt	2025-10-24 18:25:10.584717735 +0200
-+++ b/.ci/pytorch/test_example_code/CMakeLists.txt	2025-10-24 18:25:17.195639297 +0200
-@@ -1,4 +1,4 @@
--cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
-+cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
- project(simple-torch-test)
- 
- find_package(Torch REQUIRED)
---- a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt	2025-10-24 18:26:46.165583599 +0200
-+++ b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt	2025-10-24 18:27:00.085418425 +0200
-@@ -4,7 +4,7 @@
- # This source code is licensed under the BSD-style license found in the
- # LICENSE file in the root directory of this source tree.
- 
--cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
-+cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
- 
- include(GNUInstallDirs)
- 
---- a/aten/src/ATen/test/test_install/CMakeLists.txt	2025-10-24 18:27:36.180990366 +0200
-+++ b/aten/src/ATen/test/test_install/CMakeLists.txt	2025-10-24 18:27:46.812864333 +0200
-@@ -1,4 +1,4 @@
--cmake_minimum_required(VERSION 3.5)
-+cmake_minimum_required(VERSION 3.10)
- find_package(ATen REQUIRED)
- include_directories(${ATEN_INCLUDE_DIR})
- 
---- a/aten/src/ATen/nnapi/CMakeLists.txt	2025-10-24 18:28:58.948009238 +0200
-+++ b/aten/src/ATen/nnapi/CMakeLists.txt	2025-10-24 18:29:11.040865888 +0200
-@@ -1,6 +1,6 @@
- # Define this to build the NNAPI binding out of tree.
- if(PYTORCH_NNAPI_STANDALONE)
--  cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
-+  cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
-   project(pytorch_nnapi)
- 
-   set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard whose features are requested to build this target.")
---- a/android/pytorch_android_torchvision/CMakeLists.txt	2025-10-24 18:29:31.653621543 +0200
-+++ b/android/pytorch_android_torchvision/CMakeLists.txt	2025-10-24 18:29:41.668502824 +0200
-@@ -1,4 +1,4 @@
--cmake_minimum_required(VERSION 3.5)
-+cmake_minimum_required(VERSION 3.10)
- project(pytorch_vision_jni CXX)
- set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard whose features are requested to build this target.")
- #_cmake_modify_IGNORE set(CMAKE_VERBOSE_MAKEFILE ON)
---- a/android/pytorch_android/CMakeLists.txt	2025-10-24 18:29:54.079355700 +0200
-+++ b/android/pytorch_android/CMakeLists.txt	2025-10-24 18:30:39.793813797 +0200
-@@ -1,4 +1,4 @@
--cmake_minimum_required(VERSION 3.5)
-+cmake_minimum_required(VERSION 3.10)
- option(BUILD_LITE_INTERPRETER "Master flag to build pytorch_jni_lite" ON)
- message(
-   STATUS

diff --git a/sci-ml/caffe2/files/caffe2-2.9.0-rocm-distributed-link.patch b/sci-ml/caffe2/files/caffe2-2.9.0-rocm-distributed-link.patch
deleted file mode 100644
index 56c11bc84301..000000000000
--- a/sci-ml/caffe2/files/caffe2-2.9.0-rocm-distributed-link.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-USE_ROCM=ON USE_DISTRIBUTED=ON: fix *runtime* error: undefined symbol: rsmi_init
-
-Upstream bug: https://github.com/pytorch/pytorch/issues/158725
---- a/cmake/Dependencies.cmake
-+++ b/cmake/Dependencies.cmake
-@@ -1058,6 +1058,12 @@ if(USE_ROCM)
-       )
-     endif()
- 
-+    if(USE_DISTRIBUTED)
-+      list(APPEND Caffe2_PUBLIC_HIP_DEPENDENCY_LIBS
-+        rocm_smi64
-+      )
-+    endif()
-+
-     # ---[ Kernel asserts
-     # Kernel asserts is disabled for ROCm by default.
-     # It can be turned on by turning on the env USE_ROCM_KERNEL_ASSERT to the build system.
---- a/cmake/public/LoadHIP.cmake
-+++ b/cmake/public/LoadHIP.cmake
-@@ -170,6 +170,7 @@ if(HIP_FOUND)
-   find_package_and_print_version(rocthrust REQUIRED)
-   find_package_and_print_version(hipsolver REQUIRED)
-   find_package_and_print_version(rocsolver REQUIRED)
-+  find_package_and_print_version(rocm_smi REQUIRED)
-   # workaround cmake 4 build issue
-   if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.0.0")
-     message(WARNING "Work around hiprtc cmake failure for cmake >= 4")