From 14a9d711181acb231c1fae9504780e21c08b131d Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Thu, 23 Jan 2025 12:11:47 -0800 Subject: [PATCH] triage build break gcc 15 libstdc++ change broke things. Signed-off-by: Tom Rix --- 0001-torch-paper-over-c-assert.patch | 88 ++++++++++++++++++++++++++++ python-torch.spec | 10 ++++ 2 files changed, 98 insertions(+) create mode 100644 0001-torch-paper-over-c-assert.patch diff --git a/0001-torch-paper-over-c-assert.patch b/0001-torch-paper-over-c-assert.patch new file mode 100644 index 0000000..b7e55ce --- /dev/null +++ b/0001-torch-paper-over-c-assert.patch @@ -0,0 +1,88 @@ +From f646e0f04ae591c8f2d8a0cd24b035725c57659b Mon Sep 17 00:00:00 2001 +From: Tom Rix +Date: Thu, 23 Jan 2025 08:24:22 -0800 +Subject: [PATCH] torch: paper over c++ assert + +--- + aten/src/ATen/native/sparse/FlattenIndicesCommon.h | 2 ++ + .../ATen/native/sparse/SparseBinaryOpIntersectionCommon.h | 5 +++++ + .../src/ATen/native/sparse/ValidateCompressedIndicesCommon.h | 2 ++ + 3 files changed, 9 insertions(+) + +diff --git a/aten/src/ATen/native/sparse/FlattenIndicesCommon.h b/aten/src/ATen/native/sparse/FlattenIndicesCommon.h +index 0e79ed809ae6..a3cec8aaf78b 100644 +--- a/aten/src/ATen/native/sparse/FlattenIndicesCommon.h ++++ b/aten/src/ATen/native/sparse/FlattenIndicesCommon.h +@@ -69,11 +69,13 @@ Tensor _flatten_indices_impl(const Tensor& indices, IntArrayRef size) { + [=] FUNCAPI (int64_t nnz_idx) -> int64_t { + const auto* RESTRICT ptr_indices_dim = ptr_indices + nnz_idx * indices_nnz_stride; + auto hash = static_cast(0); ++#if 0 + for (int64_t dim = 0; dim < sparse_dim; ++dim) { + const auto dim_hash_coeff = hash_coeffs[dim]; + const auto dim_index = ptr_indices_dim[dim * indices_dim_stride]; + hash += dim_index * dim_hash_coeff; + } ++#endif + return hash; + }); + } +diff --git a/aten/src/ATen/native/sparse/SparseBinaryOpIntersectionCommon.h b/aten/src/ATen/native/sparse/SparseBinaryOpIntersectionCommon.h +index c0b94bf39d54..8de4900b7a01 100644 +--- a/aten/src/ATen/native/sparse/SparseBinaryOpIntersectionCommon.h ++++ b/aten/src/ATen/native/sparse/SparseBinaryOpIntersectionCommon.h +@@ -279,12 +279,15 @@ void _sparse_binary_op_intersection_kernel_impl( + if (!ptr_indices) { + return hash; + } ++#if 0 ++// /usr/lib/gcc/x86_64-redhat-linux/15/../../../../include/c++/15/array:219:2: error: reference to __host__ function '__glibcxx_assert_fail' in __host__ __device__ function + const auto* RESTRICT ptr_indices_dim = ptr_indices + nnz_idx * indices_nnz_stride; + for (int64_t dim = 0; dim < sparse_dim; ++dim) { + const auto dim_hash_coeff = hash_coeffs[dim]; + const auto dim_index = ptr_indices_dim[dim * indices_dim_stride]; + hash += dim_index * dim_hash_coeff; + } ++#endif + return hash; + }); + } +@@ -364,6 +367,7 @@ void _sparse_binary_op_intersection_kernel_impl( + if (hash_ptr) { + hash = hash_ptr[nnz_idx]; + } else if (sparse_dim) { ++#if 0 + // Compute hash value + const auto* RESTRICT ptr_indices_dim = ptr_indices + nnz_idx * indices_nnz_stride; + for (int64_t dim = 0; dim < sparse_dim; ++dim) { +@@ -371,6 +375,7 @@ void _sparse_binary_op_intersection_kernel_impl( + const auto dim_index = ptr_indices_dim[dim * indices_dim_stride]; + hash += dim_index * dim_hash_coeff; + } ++#endif + } + + // Perform hash values intersection +diff --git a/aten/src/ATen/native/sparse/ValidateCompressedIndicesCommon.h b/aten/src/ATen/native/sparse/ValidateCompressedIndicesCommon.h +index ec4c084a39cc..9bc9655b0afa 100644 +--- a/aten/src/ATen/native/sparse/ValidateCompressedIndicesCommon.h ++++ b/aten/src/ATen/native/sparse/ValidateCompressedIndicesCommon.h +@@ -341,6 +341,7 @@ void _validate_compressed_sparse_indices_kernel( + // assuming idx contiguity per batch: + int64_t tmp = batch_idx * nnz; + // `nnz == idx_sizes[idx_ndims - 1]` is checked above as `nnz == idx.size(-1)` ++#if 0 + for (int i = idx_ndims - 1; + i >= 0 && nnz > 0; // break early when nnz==0 + i--) { +@@ -348,6 +349,7 @@ void _validate_compressed_sparse_indices_kernel( + idx_offset += (tmp - div * idx_sizes[i]) * idx_strides[i]; + tmp = div; + } ++#endif + const auto* RESTRICT ptr_idx_batch = ptr_idx + idx_offset; + _check_idx_sorted_distinct_vals_slices_with_cidx< + cdim_name, +-- +2.48.1 + diff --git a/python-torch.spec b/python-torch.spec index 2261c9e..267cbb3 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -100,6 +100,7 @@ Patch11: 0001-Improve-finding-and-using-the-rocm_version.h.patch # Patches need to be refactored for ToT # These are ROCm packages Patch101: 0001-cuda-hip-signatures.patch +Patch102: 0001-torch-paper-over-c-assert.patch ExclusiveArch: x86_64 aarch64 %global toolchain gcc @@ -285,6 +286,10 @@ cp -r libuv-*/* third_party/tensorpipe/third_party/libuv/ tar xf %{SOURCE22} rm -rf third_party/tensorpipe/third_party/libnop/* cp -r libnop-*/* third_party/tensorpipe/third_party/libnop/ + +# gcc 15 include cstdint +sed -i '/#include ' third_party/tensorpipe/tensorpipe/common/allocator.h +sed -i '/#include ' third_party/tensorpipe/tensorpipe/common/memory.h %endif %if %{without opentelemtry} @@ -324,6 +329,11 @@ sed -i -e 's@sympy==1.13.1@sympy>=1.13.1@' setup.py sed -i -e '/aotriton.cmake/d' cmake/Dependencies.cmake # Compress hip sed -i -e 's@HIP_CLANG_FLAGS -fno-gpu-rdc@HIP_CLANG_FLAGS -fno-gpu-rdc --offload-compress@' cmake/Dependencies.cmake +# Silence noisy warning +sed -i -e 's@HIP_CLANG_FLAGS -fno-gpu-rdc@HIP_CLANG_FLAGS -fno-gpu-rdc -Wno-pass-failed@' cmake/Dependencies.cmake +sed -i -e 's@HIP_CLANG_FLAGS -fno-gpu-rdc@HIP_CLANG_FLAGS -fno-gpu-rdc -Wno-unused-command-line-argument@' cmake/Dependencies.cmake +sed -i -e 's@HIP_CLANG_FLAGS -fno-gpu-rdc@HIP_CLANG_FLAGS -fno-gpu-rdc -Wno-unused-result@' cmake/Dependencies.cmake +sed -i -e 's@HIP_CLANG_FLAGS -fno-gpu-rdc@HIP_CLANG_FLAGS -fno-gpu-rdc -Wno-deprecated-declarations@' cmake/Dependencies.cmake # No third_party fmt, use system sed -i -e 's@fmt::fmt-header-only@fmt@' CMakeLists.txt