diff --git a/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0-foss-2025b.eb b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0-foss-2025b.eb new file mode 100644 index 000000000000..6a0ea4c39bb3 --- /dev/null +++ b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0-foss-2025b.eb @@ -0,0 +1,157 @@ +easyblock = 'PythonBundle' + +name = 'TensorFlow' +version = '2.21.0' + +homepage = 'https://www.tensorflow.org/' +description = "An open-source software library for Machine Intelligence" + +toolchain = {'name': 'foss', 'version': '2025b'} +toolchainopts = {'pic': True} + +builddependencies = [ + ('hatchling', '1.27.0'), + ('Bazel', '7.7.0', '-Java-21'), + # git 2.x required, see also https://github.com/tensorflow/tensorflow/issues/29053 + ('git', '2.50.1'), + ('UnZip', '6.0'), + ('NASM', '2.16.03'), + # Required to build some of the extensions + ('poetry', '2.1.3'), + ('Cython', '3.2.4'), +] + +dependencies = [ + ('Python', '3.13.5'), + ('Python-bundle-PyPI', '2025.07'), + ('SciPy-bundle', '2025.07'), + ('h5py', '3.14.0'), + ('dill', '0.4.1'), + ('flatbuffers-python', '25.2.10'), + ('ml_dtypes', '0.5.3'), + ('patchelf', '0.18.0'), + ('protobuf-python', '6.31.1'), + ('grpcio', '1.81.0'), + ('wrapt', '1.17.3'), + ('Markdown', '3.8.2'), + ('absl-py', '2.3.1'), + ('tensorboard', '2.20.0'), + ('opt-einsum', '3.4.0'), + ('optree', '0.18.0'), + ('typing-extensions', '4.14.1'), + ('cURL', '8.14.1'), +] + +exts_list = [ + ('astor', '0.8.1', { + 'checksums': ['6a6effda93f4e1ce9f618779b2dd1d9d84f1e32812c23a29b3fff6fd7f63fa5e'], + }), + ('termcolor', '2.5.0', { + 'checksums': ['998d8d27da6d48442e8e1f016119076b690d962507531df4890fcd2db2ef8a6f'], + }), + ('Werkzeug', '3.1.3', { + 'source_tmpl': '%(namelower)s-%(version)s.tar.gz', + 'checksums': ['60723ce945c19328679790e3282cc758aa4a6040e4bb330f53d30fa546d44746'], + }), + ('namex', '0.0.8', { + 'checksums': ['32a50f6c565c0bb10aa76298c959507abdc0e850efe085dc38f3440fcb3aa90b'], + }), + ('keras', '3.13.2', { + 'checksums': ['62f0123488ac87c929c988617e14f293f7bc993811837d08bb37eff77adc85a9'], + }), + ('google-pasta', '0.2.0', { + 'modulename': 'pasta', + 'checksums': ['c9f2c8dfc8f96d0d5808299920721be30c9eec37f2389f28904f454565c8a16e'], + }), + ('astunparse', '1.6.3', { + 'checksums': ['5ad93a8456f0d084c3456d059fd9a92cce667963232cbf763eac3bc5b7940872'], + }), + ('tblib', '3.0.0', { + 'checksums': ['93622790a0a29e04f0346458face1e144dc4d32f493714c6c3dff82a4adb77e6'], + }), + (name, version, { + 'patches': [ + 'TensorFlow-2.4.0_dont-use-var-lock.patch', + 'TensorFlow-2.18.1_fix-xnnpack.patch', + 'TensorFlow-2.18.1_fixedpoint.patch', + 'TensorFlow-2.21.0_add-missing-namespaces.patch', + 'TensorFlow-2.21.0_disable-tf32-in-fused-matmul-tests.patch', + 'TensorFlow-2.21.0_fix-AVX512-eigen-compilation.patch', + 'TensorFlow-2.21.0_fix-GCC-compat.patch', + 'TensorFlow-2.21.0_fix-openssl-linking.patch', + 'TensorFlow-2.21.0_fix-shell-env-for-grpc.patch', + 'TensorFlow-2.21.0_fix-shell-env-for-protobuf.patch', + 'TensorFlow-2.21.0_readd-system-absl_py.patch', + 'TensorFlow-2.21.0_relax-flatbuffers-requirement.patch', + 'TensorFlow-2.21.0_remove-libclang-dep.patch', + 'TensorFlow-2.21.0_remove-llvm-flag.patch', + ], + 'source_tmpl': 'v%(version)s.tar.gz', + 'source_urls': ['https://github.com/tensorflow/tensorflow/archive/'], + 'test_script': 'TensorFlow-2.x_mnist-test.py', + 'test_tag_filters_cpu': '-gpu,-tpu,-no_cuda_on_cpu_tap,-no_pip,-no_oss,-oss_serial,-benchmark-test,-v1only', + 'test_tag_filters_gpu': ( + 'gpu,-no_gpu,-nogpu,-gpu_cupti,-no_cuda11,' + '-no_pip,-no_oss,-oss_serial,-benchmark-test,-v1only' + ), + 'test_targets': [ + '//tensorflow/core/...', + '-//tensorflow/core:example_java_proto', + '//tensorflow/cc/...', + '//tensorflow/c/...', + '//tensorflow/python/...', + '-//tensorflow/c/eager:c_api_test_gpu', + '-//tensorflow/c/eager:c_api_distributed_test', + '-//tensorflow/c/eager:c_api_distributed_test_gpu', + '-//tensorflow/c/eager:c_api_cluster_test_gpu', + '-//tensorflow/c/eager:c_api_remote_function_test_gpu', + '-//tensorflow/c/eager:c_api_remote_test_gpu', + '-//tensorflow/core/common_runtime:collective_param_resolver_local_test', + '-//tensorflow/core/kernels/mkl:mkl_fused_ops_test', + '-//tensorflow/core/kernels/mkl:mkl_fused_batch_norm_op_test', + '-//tensorflow/core/ir/importexport/tests/roundtrip/...', + ], + 'testopts': ( + '--test_size_filters=small ' + ), + 'testopts_gpu': ( + '--test_size_filters=small ' + '--run_under=//tensorflow/tools/ci_build/gpu_build:parallel_gpu_execute ' + ), + 'checksums': [ + {'v2.21.0.tar.gz': 'ef3568bb4865d6c1b2564fb5689c19b6b9a5311572cd1f2ff9198636a8520921'}, + {'TensorFlow-2.4.0_dont-use-var-lock.patch': + 'b14f2493fd2edf79abd1c4f2dde6c98a3e7d5cb9c25ab9386df874d5f072d6b5'}, + {'TensorFlow-2.18.1_fix-xnnpack.patch': 'baf81d7b2b61b5a923cf1f171d5e2400df6b8bd9073d3afa7a356e3bbe11984c'}, + {'TensorFlow-2.18.1_fixedpoint.patch': '5ea1eb3b32e7df5f9ae711a71778b4cae544b3380f18882186eea035873fb640'}, + {'TensorFlow-2.21.0_add-missing-namespaces.patch': + '0ddf31351c6f2eaee308f6ff11b0e1956e70f422f199d8c92909339fd3c822a3'}, + {'TensorFlow-2.21.0_disable-tf32-in-fused-matmul-tests.patch': + '2f605322c9694ccf6e013f06f403496320445a093ceca6625fec616343f5fd32'}, + {'TensorFlow-2.21.0_fix-AVX512-eigen-compilation.patch': + '5b40296ac4dd76f950d44497e3a81d885a48dc541544cf74e576f6851a95a2eb'}, + {'TensorFlow-2.21.0_fix-GCC-compat.patch': + '35c5c88bb07a8a5f2d72770a7c47b47f7c2e0f86f77762080c0823c382b828c1'}, + {'TensorFlow-2.21.0_fix-openssl-linking.patch': + '2b327f949f975d8f15fab30ee6c85b3218e03327fc848a5470aa51253971e475'}, + {'TensorFlow-2.21.0_fix-shell-env-for-grpc.patch': + 'be390a96472b9b91723bf27a4b59a362ab89cd24dfc873a81161ade0bbbd569e'}, + {'TensorFlow-2.21.0_fix-shell-env-for-protobuf.patch': + '9910e0df3e225976873a36aa1f7d3ed9b1e29afc5bd8505d6985b93dce8b9853'}, + {'TensorFlow-2.21.0_readd-system-absl_py.patch': + 'de3ebde1a72612875661a1b8a07251b248a1242ac0a982f3fa4cc26f6fc77c93'}, + {'TensorFlow-2.21.0_relax-flatbuffers-requirement.patch': + 'c500796a1fe1f3de8322b1a1abeefbd3714fb255e6600d65e3815e20484c45ee'}, + {'TensorFlow-2.21.0_remove-libclang-dep.patch': + '4ee3773d07991c7f75d6dd4033ccf1bb9b017de478b39b4ffb6563a6bd66b981'}, + {'TensorFlow-2.21.0_remove-llvm-flag.patch': + '5909f2ba3dc8049ce65de771068fdc96330f25d113f8c20463eea831bfefa078'}, + ], + }), +] + +postinstallcmds = [ + 'mkdir -p %(installdir)s/bin && ln -sf "$EBROOTTENSORBOARD/bin/tensorboard" %(installdir)s/bin/tensorboard', +] + +moduleclass = 'lib' diff --git a/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_add-missing-namespaces.patch b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_add-missing-namespaces.patch new file mode 100644 index 000000000000..bb2def245018 --- /dev/null +++ b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_add-missing-namespaces.patch @@ -0,0 +1,33 @@ +diff --git a/tensorflow/dtensor/mlir/spmd_expansion.cc b/tensorflow/dtensor/mlir/spmd_expansion.cc +--- a/tensorflow/dtensor/mlir/spmd_expansion.cc ++++ b/tensorflow/dtensor/mlir/spmd_expansion.cc +@@ -188,7 +188,7 @@ bool GetResourceArgIndexIfUsedInAssignmentOp( + GetForwardedDTensorLayoutInput(assign_variable_op.getResource()); + if (llvm::isa(resource)) { + *resource_argument_index_for_assign_variable = +- cast(resource).getArgNumber(); ++ mlir::cast(resource).getArgNumber(); + return true; + } + } +@@ -221,7 +221,7 @@ mlir::LogicalResult UpdateFunctionArgsUsingLayout(mlir::func::FuncOp function) { + + // If argument is a resource type update the subtype shape information + // to reflect local shape of resources. +- if (isa(arg_type)) { ++ if (mlir::isa(arg_type)) { + if (mlir::failed(UpdateResourceArgumentType(argument_index, function))) + return mlir::failure(); + continue; +diff --git a/tensorflow/dtensor/mlir/shape_utils.cc b/tensorflow/dtensor/mlir/shape_utils.cc +--- a/tensorflow/dtensor/mlir/shape_utils.cc ++++ b/tensorflow/dtensor/mlir/shape_utils.cc +@@ -73,7 +73,7 @@ StatusOr> ExtractGlobalInputShape( + return absl::InternalError("global_shape does not have static rank"); + return *global_shape; + } +- return ExtractGlobalOutputShape(cast(input_value.get())); ++ return ExtractGlobalOutputShape(mlir::cast(input_value.get())); + } + + // If we reach this point, we're working with a function argument. diff --git a/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_disable-tf32-in-fused-matmul-tests.patch b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_disable-tf32-in-fused-matmul-tests.patch new file mode 100644 index 000000000000..54ba997c9254 --- /dev/null +++ b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_disable-tf32-in-fused-matmul-tests.patch @@ -0,0 +1,44 @@ +Fixes failing FusedMatMul test on certain GPU models +--- tensorflow/core/kernels/matmul_op_test.cc.orig 2026-06-29 00:00:00.000000000 +0200 ++++ tensorflow/core/kernels/matmul_op_test.cc 2026-06-29 00:00:00.000000000 +0200 +@@ -24,7 +24,8 @@ + #include "tensorflow/core/framework/tensor.h" + #include "tensorflow/core/framework/types.h" + #include "tensorflow/core/kernels/ops_testutil.h" + #include "tensorflow/core/lib/core/status_test_util.h" ++#include "tensorflow/core/platform/tensor_float_32_utils.h" + #include "tensorflow/core/platform/test.h" + #include "tensorflow/core/platform/test_benchmark.h" + #include "tensorflow/core/protobuf/rewriter_config.pb.h" +@@ -334,6 +335,7 @@ + // -------------------------------------------------------------------------- // + + TYPED_TEST_P(FusedMatMulWithBiasOpTest, MatMul256x128x64) { ++ tensorflow::enable_tensor_float_32_execution(false); + this->VerifyMatMulWithBias(256, 128, 64, false, false); + this->VerifyMatMulWithBias(256, 128, 64, true, false); + this->VerifyMatMulWithBias(256, 128, 64, false, true); +@@ -341,6 +343,7 @@ + } + + TYPED_TEST_P(FusedMatMulWithBiasOpTest, MatMul1x256x256) { ++ tensorflow::enable_tensor_float_32_execution(false); + this->VerifyMatMulWithBias(1, 256, 256, false, false); + this->VerifyMatMulWithBias(1, 256, 256, true, false); + this->VerifyMatMulWithBias(1, 256, 256, false, true); +@@ -348,6 +351,7 @@ + } + + TYPED_TEST_P(FusedMatMulWithBiasOpTest, MatMul256x256x1) { ++ tensorflow::enable_tensor_float_32_execution(false); + this->VerifyMatMulWithBias(256, 256, 1, false, false); + this->VerifyMatMulWithBias(256, 256, 1, true, false); + this->VerifyMatMulWithBias(256, 256, 1, false, true); +@@ -371,6 +375,7 @@ + } + + TYPED_TEST_P(FusedMatMulWithBiasOpTest, MatMul256x128x64WithActivation) { ++ tensorflow::enable_tensor_float_32_execution(false); + for (const std::string& activation : GetActivations(this->kTValueType)) { + this->VerifyConv2DWithBiasAndActivation(256, 128, 64, false, false, + activation); diff --git a/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_fix-AVX512-eigen-compilation.patch b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_fix-AVX512-eigen-compilation.patch new file mode 100644 index 000000000000..639b70f43e2a --- /dev/null +++ b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_fix-AVX512-eigen-compilation.patch @@ -0,0 +1,54 @@ +Fix a compilation error for CPUs with AVX512 features where an issue in Eigen leads to +> external/eigen_archive/Eigen/src/Core/arch/AVX512/PacketMathFP16.h:740:49: error: expected initializer before '<' token +> 740 | EIGEN_STRONG_INLINE Packet16h predux_half_dowto4(const Packet32h& a) { +> | ^ + +Taken from https://gitlab.com/libeigen/eigen/-/merge_requests/2100 + +Author: Alexander Grund (TU Dresden) + +diff --git a/third_party/xla/third_party/eigen3/fix-avx512.patch b/third_party/xla/third_party/eigen3/fix-avx512.patch +new file mode 100644 +index 00000000000..0650d52a0c9 ++--- /dev/null +++++ b/third_party/xla/third_party/eigen3/fix-avx512.patch ++ Eigen/src/Core/arch/AVX512/PacketMathFP16.h | 6 +++--- ++ 1 file changed, 3 insertions(+), 3 deletions(-) ++ ++diff --git a/Eigen/src/Core/arch/AVX512/PacketMathFP16.h b/Eigen/src/Core/arch/AVX512/PacketMathFP16.h ++index e6b8d995c8..370fb83364 100644 ++--- a/Eigen/src/Core/arch/AVX512/PacketMathFP16.h +++++ b/Eigen/src/Core/arch/AVX512/PacketMathFP16.h ++@@ -735,9 +735,9 @@ EIGEN_STRONG_INLINE half predux(const Packet8h& a) { ++ return half(_mm_reduce_add_ph(a)); ++ } ++ ++-// predux_half_dowto4 +++// predux_half ++ template <> ++-EIGEN_STRONG_INLINE Packet16h predux_half_dowto4(const Packet32h& a) { +++EIGEN_STRONG_INLINE Packet16h predux_half(const Packet32h& a) { ++ const __m512i bits = _mm512_castph_si512(a); ++ Packet16h lo = _mm256_castsi256_ph(_mm512_castsi512_si256(bits)); ++ Packet16h hi = _mm256_castsi256_ph(_mm512_extracti64x4_epi64(bits, 1)); ++@@ -745,7 +745,7 @@ EIGEN_STRONG_INLINE Packet16h predux_half_dowto4(const Packet32h& a) ++ } ++ ++ template <> ++-EIGEN_STRONG_INLINE Packet8h predux_half_dowto4(const Packet16h& a) { +++EIGEN_STRONG_INLINE Packet8h predux_half(const Packet16h& a) { ++ Packet8h lo = _mm_castsi128_ph(_mm256_castsi256_si128(_mm256_castph_si256(a))); ++ Packet8h hi = _mm_castps_ph(_mm256_extractf128_ps(_mm256_castph_ps(a), 1)); ++ return padd(lo, hi); +diff --git a/third_party/xla/third_party/eigen3/workspace.bzl b/third_party/xla/third_party/eigen3/workspace.bzl +index d1d8d4ac486..da549e37432 100644 +--- a/third_party/xla/third_party/eigen3/workspace.bzl ++++ b/third_party/xla/third_party/eigen3/workspace.bzl +@@ -14,6 +14,7 @@ def repo(): + tf_http_archive( + name = "eigen_archive", + build_file = "//third_party/eigen3:eigen_archive.BUILD", ++ patch_file = ["//third_party/eigen3:fix-avx512.patch"], + sha256 = EIGEN_SHA256, + strip_prefix = "eigen-{commit}".format(commit = EIGEN_COMMIT), + urls = tf_mirror_urls("https://gitlab.com/libeigen/eigen/-/archive/{commit}/eigen-{commit}.tar.gz".format(commit = EIGEN_COMMIT)), diff --git a/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_fix-GCC-compat.patch b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_fix-GCC-compat.patch new file mode 100644 index 000000000000..53b9d30d5b2f --- /dev/null +++ b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_fix-GCC-compat.patch @@ -0,0 +1,47 @@ +Fix for +> external/xla/xla/hlo/utils/hlo_sharding_util.h:356:59: error: call of overloaded 'TileAssignment()' is ambiguous + +from https://github.com/tensorflow/tensorflow/pull/110851 +Second change is similar but for +> external/xla/xla/codegen/emitters/transforms/expand_integer_power.cc:51:66: error: conversion from '' to 'mlir::mhlo::PowOp::Adaptor' {aka 'mlir::mhlo::PowOpAdaptor'} is ambiguous + +author: Alexander Grund (TU Dresden) + +From f2c84f1bb34fa43d6a77f1e51b838cdd2fc2effd Mon Sep 17 00:00:00 2001 +From: "William S. Moses" +Date: Mon, 23 Feb 2026 10:55:56 -0800 +Subject: [PATCH] TileAssignment: Fix build with gcc + +PiperOrigin-RevId: 874157330 +--- + third_party/xla/xla/hlo/utils/hlo_sharding_util.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/third_party/xla/xla/hlo/utils/hlo_sharding_util.h b/third_party/xla/xla/hlo/utils/hlo_sharding_util.h +--- a/third_party/xla/xla/hlo/utils/hlo_sharding_util.h ++++ b/third_party/xla/xla/hlo/utils/hlo_sharding_util.h +@@ -372,7 +372,8 @@ class DeviceGroupTileAssignment : public TileAssignment { + public: + explicit DeviceGroupTileAssignment(int64_t num_groups, + int64_t num_devices_per_group) +- : TileAssignment({num_groups, num_devices_per_group}) {} ++ : TileAssignment( ++ absl::Span{num_groups, num_devices_per_group}) {} + explicit DeviceGroupTileAssignment(int64_t num_groups, + int64_t num_devices_per_group, + absl::Span reshape_dims, + + +diff --git a/third_party/xla/xla/codegen/emitters/transforms/expand_integer_power.cc b/third_party/xla/xla/codegen/emitters/transforms/expand_integer_power.cc +--- a/third_party/xla/xla/codegen/emitters/transforms/expand_integer_power.cc ++++ b/third_party/xla/xla/codegen/emitters/transforms/expand_integer_power.cc +@@ -49,7 +49,7 @@ mlir::LogicalResult ExpandIntegerPower(mlir::math::IPowIOp op, + llvm::SmallVector arg_types(op->getOperandTypes()); + mlir::Value result = + mlir::mhlo::impl::mapMhloOpToStdScalarOp( +- op.getLoc(), result_types, arg_types, {op->getOperands()}, ++ op.getLoc(), result_types, arg_types, mlir::mhlo::PowOp::Adaptor(op->getOperands()), + op->getAttrs(), &rewriter); + + rewriter.replaceOp(op, result); + diff --git a/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_fix-openssl-linking.patch b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_fix-openssl-linking.patch new file mode 100644 index 000000000000..5fb4b2dafee3 --- /dev/null +++ b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_fix-openssl-linking.patch @@ -0,0 +1,23 @@ +When linking libtensorflow_cc.so.2 fails with many undefined references originating in grpc, e.g.: + +bazel-out/k8-opt/bin/external/com_github_grpc_grpc/libtsi_ssl_credentials.pic.a(ssl_transport_security.pic.o):ssl_transport_security.cc:function populate_ssl_context(ssl_ctx_st*, tsi_ssl_pem_key_cert_pair const*, char const*): error: undefined reference to 'PEM_read_bio_PrivateKey' +bazel-out/k8-opt/bin/external/com_github_grpc_grpc/libtsi_ssl_credentials.pic.a(ssl_transport_security.pic.o):ssl_transport_security.cc:function populate_ssl_context(ssl_ctx_st*, tsi_ssl_pem_key_cert_pair const*, char const*): error: undefined reference to 'EVP_PKEY_free' + +Fix by explicitely linking the dep that gets now ignored due to a change from 2.19, enabled by default in 2.20. + +See https://github.com/tensorflow/tensorflow/pull/125250 + +Author: Alexander Grund (TU Dresden) + +diff --git a/third_party/systemlibs/boringssl.BUILD b/third_party/systemlibs/boringssl.BUILD +--- a/third_party/systemlibs/boringssl.BUILD ++++ b/third_party/systemlibs/boringssl.BUILD +@@ -13,7 +13,7 @@ cc_library( + + cc_library( + name = "ssl", +- linkopts = ["-lssl"], ++ linkopts = ["-lssl", "-lcrypto"], + visibility = ["//visibility:public"], + deps = [ + ":crypto", diff --git a/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_fix-shell-env-for-grpc.patch b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_fix-shell-env-for-grpc.patch new file mode 100644 index 000000000000..c6664a06512b --- /dev/null +++ b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_fix-shell-env-for-grpc.patch @@ -0,0 +1,33 @@ +Make sure protobuf tools use by grpc use the same environment they were built in to avoid picking up e.g. the (possibly too old) system libcxx. + +> ERROR: /dev/shm/TensorFlow/2.21.0/foss-2025b/TensorFlow/tensorflow-2.21.0/tensorflow/distribute/experimental/rpc/proto/BUILD:17:17: ProtocInvocation tensorflow/distribute/experimental/rpc/proto/tf_rpc_service_pb2_grpc.py failed: (Exit 1): protoc failed: error executing ProtocInvocation command (from target //tensorflow/distribute/experimental/rpc/proto:tf_rpc_service_proto_py_grpc_proto) + + +Author: Alexander Grund (TU Dresden) + +diff --git a/third_party/xla/third_party/grpc/grpc.patch b/third_party/xla/third_party/grpc/grpc.patch +--- a/third_party/xla/third_party/grpc/grpc.patch ++++ b/third_party/xla/third_party/grpc/grpc.patch +@@ -53,3 +53,22 @@ diff --git a/src/python/grpcio/grpc/BUILD.bazel b/src/python/grpcio/grpc/BUILD.b + imports = ["../"], + deps = [ + ":_observability", ++diff -ur a/bazel/python_rules.bzl .b/bazel/python_rules.bzl ++--- b/bazel/python_rules.bzl +++++ a/bazel/python_rules.bzl ++@@ -84,6 +84,7 @@ ++ arguments += get_proto_arguments(protos, context.genfiles_dir.path) ++ ++ context.actions.run( +++ use_default_shell_env = True, ++ inputs = protos + includes.to_list(), ++ tools = tools, ++ outputs = out_files, ++@@ -228,6 +229,7 @@ ++ arguments.append("--proto_path={}".format(context.genfiles_dir.path)) ++ arguments += get_proto_arguments(protos, context.genfiles_dir.path) ++ context.actions.run( +++ use_default_shell_env = True, ++ inputs = protos + includes, ++ tools = tools, ++ outputs = out_files, diff --git a/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_fix-shell-env-for-protobuf.patch b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_fix-shell-env-for-protobuf.patch new file mode 100644 index 000000000000..163623fbab11 --- /dev/null +++ b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_fix-shell-env-for-protobuf.patch @@ -0,0 +1,31 @@ +Make sure protobuf tools use the same environment they were built in to avoid picking up e.g. the (possibly too old) system libcxx. + +> ERROR: /dev/shm/TensorFlow/2.21.0/foss-2025b/TensorFlow/bazel-root/38526f3dacc6677801c11293634cdb7f/external/com_google_protobuf/python/BUILD.bazel:14:14: Generating edition defaults failed: (Exit 1): protoc_minimal failed: error executing Action command (from target @@com_google_protobuf//python:python_edition_defaults) + +Author: Alexander Grund (TU Dresden) +diff --git a/third_party/xla/third_party/protobuf/protobuf.patch b/third_party/xla/third_party/protobuf/protobuf.patch +--- a/third_party/xla/third_party/protobuf/protobuf.patch ++++ b/third_party/xla/third_party/protobuf/protobuf.patch +@@ -199,3 +199,22 @@ diff --git a/src/google/protobuf/thread_safe_arena.h b/src/google/protobuf/threa + // Thread local variables cannot be exposed through MSVC DLL interface but we + // can wrap them in static functions. + static ThreadCache& thread_cache(); ++diff -ur a/editions/defaults.bzl b/editions/defaults.bzl ++--- a/editions/defaults.bzl +++++ b/editions/defaults.bzl ++@@ -30,6 +30,7 @@ ++ for source in sources: ++ args.add(source) ++ ctx.actions.run( +++ use_default_shell_env = True, ++ outputs = [out_file], ++ inputs = sources, ++ executable = ctx.executable.protoc or ctx.executable._protoc_minimal, ++@@ -72,6 +73,7 @@ ++ args.add(ctx.attr.placeholder, format = "--placeholder=%s") ++ ++ ctx.actions.run( +++ use_default_shell_env = True, ++ executable = ctx.executable._escape, ++ arguments = [args], ++ outputs = [ctx.outputs.output], diff --git a/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_readd-system-absl_py.patch b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_readd-system-absl_py.patch new file mode 100644 index 000000000000..77e0e1bd6cd6 --- /dev/null +++ b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_readd-system-absl_py.patch @@ -0,0 +1,18 @@ +diff --git a/tensorflow/workspace2.bzl b/tensorflow/workspace2.bzl +index 941519960c8..0001dfcc81f 100644 +--- a/tensorflow/workspace2.bzl ++++ b/tensorflow/workspace2.bzl +@@ -401,6 +401,13 @@ def _tf_repositories(): + name = "absl_py", + sha256 = "8a3d0830e4eb4f66c4fa907c06edf6ce1c719ced811a12e26d9d3162f8471758", + strip_prefix = "abseil-py-2.1.0", ++ system_build_file = "//third_party/systemlibs:absl_py.BUILD", ++ system_link_files = { ++ "//third_party/systemlibs:absl_py.absl.BUILD": "absl/BUILD", ++ "//third_party/systemlibs:absl_py.absl.flags.BUILD": "absl/flags/BUILD", ++ "//third_party/systemlibs:absl_py.absl.testing.BUILD": "absl/testing/BUILD", ++ "//third_party/systemlibs:absl_py.absl.logging.BUILD": "absl/logging/BUILD", ++ }, + urls = tf_mirror_urls("https://github.com/abseil/abseil-py/archive/refs/tags/v2.1.0.tar.gz"), + ) + diff --git a/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_relax-flatbuffers-requirement.patch b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_relax-flatbuffers-requirement.patch new file mode 100644 index 000000000000..89db20052730 --- /dev/null +++ b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_relax-flatbuffers-requirement.patch @@ -0,0 +1,15 @@ +TensorFlow 2.21.0 only uses flatbuffers as a Python runtime dependency in this +EasyBuild configuration. Keep the wheel metadata compatible with the shared +flatbuffers-python dependency used by other 2025b recipes. + +--- tensorflow/tools/pip_package/setup.py.tpl.orig 2026-06-29 00:00:00.000000000 +0200 ++++ tensorflow/tools/pip_package/setup.py.tpl 2026-06-29 00:00:00.000000000 +0200 +@@ -97,7 +97,7 @@ + REQUIRED_PACKAGES = [ + 'absl-py >= 1.0.0', + 'astunparse >= 1.6.0', +- 'flatbuffers >= 25.9.23', ++ 'flatbuffers >= 25.2.10', + 'gast >=0.2.1,!=0.5.0,!=0.5.1,!=0.5.2', + 'google_pasta >= 0.1.1', + 'libclang >= 13.0.0', diff --git a/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_remove-libclang-dep.patch b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_remove-libclang-dep.patch new file mode 100644 index 000000000000..e5ac8082d89f --- /dev/null +++ b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_remove-libclang-dep.patch @@ -0,0 +1,17 @@ +libclang was introduced in +https://github.com/tensorflow/tensorflow/commit/c211472000ff57bac7fcec9b0465cf73b37bf135 +> This is in preparation to open-source TF's TFRT backend. +> TFRT generates code using libclang python bindings as part of the build. +Hence it is not currently used and as it is not (easily) available for all architectures +simply remove it. + +--- tensorflow/tools/pip_package/setup.py.tpl.orig 2026-06-29 00:00:00.000000000 +0200 ++++ tensorflow/tools/pip_package/setup.py.tpl 2026-06-29 00:00:00.000000000 +0200 +@@ -97,7 +97,6 @@ + 'flatbuffers >= 25.9.23', + 'gast >=0.2.1,!=0.5.0,!=0.5.1,!=0.5.2', + 'google_pasta >= 0.1.1', +- 'libclang >= 13.0.0', + 'opt_einsum >= 2.3.2', + 'packaging', + 'protobuf >= 6.31.1, < 8.0.0', diff --git a/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_remove-llvm-flag.patch b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_remove-llvm-flag.patch new file mode 100644 index 000000000000..6d4c8bec3a54 --- /dev/null +++ b/easybuild/easyconfigs/t/TensorFlow/TensorFlow-2.21.0_remove-llvm-flag.patch @@ -0,0 +1,14 @@ +The flag is not recognized by GCC, so just remove it. + +Author: Alexander Grund (TU Dresden) +diff --git a/third_party/xla/xla/codegen/intrinsic/cpp/cc_to_llvm_ir.bzl b/third_party/xla/xla/codegen/intrinsic/cpp/cc_to_llvm_ir.bzl +--- a/third_party/xla/xla/codegen/intrinsic/cpp/cc_to_llvm_ir.bzl ++++ b/third_party/xla/xla/codegen/intrinsic/cpp/cc_to_llvm_ir.bzl +@@ -106,7 +106,6 @@ def cc_ir_header(name, src, deps = [], copts = [], **kwargs): + "-fno-builtin", + "-Wno-psabi", + "-std=c++17", +- "-fno-experimental-sanitize-metadata=all", + "-fno-sanitize=all", + ] + copts +