From dc9f03a1c04e762e8180b2e48f0b1f4a1db79df9 Mon Sep 17 00:00:00 2001
From: Alexandre Strube <a.strube@fz-juelich.de>
Date: Wed, 15 Feb 2023 21:44:56 +0100
Subject: [PATCH] Testing 2.11

---
 Custom_EasyBlocks/tensorflow.py               |  81 +++++--
 .../TensorFlow-2.11.0-foss-2022a-CUDA-11.7.eb | 223 ++++++++++++++++++
 ...low-2.11.0_disable-avx512-extensions.patch |  19 ++
 ...sorFlow-2.11.0_fix-eigen-atan-on-PPC.patch |  38 +++
 ...sorFlow-2.11.0_fix-eigen-gemm-on-PPC.patch |  72 ++++++
 .../TensorFlow-2.11.0_fix-link-error.patch    |  39 +++
 ...11.0_remove-libclang-and-io-gcs-deps.patch |  38 +++
 .../TensorFlow-2.4.0_dont-use-var-lock.patch  |  37 +++
 ...ow-2.5.0-fix-alias-violation-in-absl.patch |  26 ++
 ...Flow-2.5.0_fix-arm-vector-intrinsics.patch |  42 ++++
 ...sorFlow-2.8.4_exclude-xnnpack-on-ppc.patch |  18 ++
 ...ensorFlow-2.8.4_resolve-gcc-symlinks.patch |  28 +++
 ...low-2.9.1_remove-duplicate-gpu-tests.patch |  55 +++++
 13 files changed, 701 insertions(+), 15 deletions(-)
 create mode 100644 Golden_Repo/t/TensorFlow/TensorFlow-2.11.0-foss-2022a-CUDA-11.7.eb
 create mode 100644 Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_disable-avx512-extensions.patch
 create mode 100644 Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_fix-eigen-atan-on-PPC.patch
 create mode 100644 Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_fix-eigen-gemm-on-PPC.patch
 create mode 100644 Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_fix-link-error.patch
 create mode 100644 Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_remove-libclang-and-io-gcs-deps.patch
 create mode 100644 Golden_Repo/t/TensorFlow/TensorFlow-2.4.0_dont-use-var-lock.patch
 create mode 100644 Golden_Repo/t/TensorFlow/TensorFlow-2.5.0-fix-alias-violation-in-absl.patch
 create mode 100644 Golden_Repo/t/TensorFlow/TensorFlow-2.5.0_fix-arm-vector-intrinsics.patch
 create mode 100644 Golden_Repo/t/TensorFlow/TensorFlow-2.8.4_exclude-xnnpack-on-ppc.patch
 create mode 100644 Golden_Repo/t/TensorFlow/TensorFlow-2.8.4_resolve-gcc-symlinks.patch
 create mode 100644 Golden_Repo/t/TensorFlow/TensorFlow-2.9.1_remove-duplicate-gpu-tests.patch

diff --git a/Custom_EasyBlocks/tensorflow.py b/Custom_EasyBlocks/tensorflow.py
index ca13dd157..239634a2c 100644
--- a/Custom_EasyBlocks/tensorflow.py
+++ b/Custom_EasyBlocks/tensorflow.py
@@ -1,5 +1,5 @@
 ##
-# Copyright 2017-2022 Ghent University
+# Copyright 2017-2023 Ghent University
 #
 # This file is part of EasyBuild,
 # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
@@ -35,14 +35,13 @@ import os
 import re
 import stat
 import tempfile
-from distutils.version import LooseVersion
 
 import easybuild.tools.environment as env
 import easybuild.tools.toolchain as toolchain
 from easybuild.easyblocks.generic.pythonpackage import PythonPackage, det_python_version
 from easybuild.easyblocks.python import EXTS_FILTER_PYTHON_PACKAGES
 from easybuild.framework.easyconfig import CUSTOM
-from easybuild.tools import run
+from easybuild.tools import run, LooseVersion
 from easybuild.tools.build_log import EasyBuildError, print_warning
 from easybuild.tools.config import build_option, IGNORE
 from easybuild.tools.filetools import adjust_permissions, apply_regex_substitutions, copy_file, mkdir, resolve_path
@@ -211,6 +210,14 @@ def get_system_libs_for_version(tf_version, as_valid_libs=False):
     return result
 
 
+def get_bazel_version():
+    """Get the Bazel version as a LooseVersion. Error if not found"""
+    version = get_software_version('Bazel')
+    if version is None:
+        raise EasyBuildError('Failed to determine Bazel version - is it listed as a (build) dependency?')
+    return LooseVersion(version)
+
+
 class EB_TensorFlow(PythonPackage):
     """Support for building/installing TensorFlow."""
 
@@ -401,6 +408,18 @@ class EB_TensorFlow(PythonPackage):
             else:
                 ignored_system_deps.append('%s (Python package %s)' % (tf_name, pkg_name))
 
+        # If we use OpenSSL (potentially as a wrapper) somewhere in the chain we must tell TF to use it too
+        openssl_root = get_software_root('OpenSSL')
+        if openssl_root:
+            if 'boringssl' not in system_libs:
+                system_libs.append('boringssl')
+            incpath = os.path.join(openssl_root, 'include')
+            if os.path.exists(incpath):
+                cpaths.append(incpath)
+            libpath = get_software_libdir(dep_name)
+            if libpath:
+                libpaths.append(os.path.join(openssl_root, libpath))
+
         if ignored_system_deps:
             print_warning('%d TensorFlow dependencies have not been resolved by EasyBuild. Check the log for details.',
                           len(ignored_system_deps))
@@ -418,10 +437,14 @@ class EB_TensorFlow(PythonPackage):
 
     def setup_build_dirs(self):
         """Setup temporary build directories"""
+        # This is either the builddir (for standalone builds) or the extension sub folder when TF is an extension
+        # Either way this folder only contains the folder with the sources and hence we can use fixed names
+        # for the subfolders
+        parent_dir = os.path.dirname(self.start_dir)
         # Path where Bazel will store its output, build artefacts etc.
-        self.output_user_root_dir = tempfile.mkdtemp(suffix='-bazel-tf', dir=self.builddir)
+        self.output_user_root_dir = os.path.join(parent_dir, 'bazel-root')
         # Folder where wrapper binaries can be placed, where required. TODO: Replace by --action_env cmds
-        self.wrapper_dir = tempfile.mkdtemp(suffix='-wrapper_bin', dir=self.builddir)
+        self.wrapper_dir = os.path.join(parent_dir, 'wrapper_bin')
 
     def configure_step(self):
         """Custom configuration procedure for TensorFlow."""
@@ -430,7 +453,9 @@ class EB_TensorFlow(PythonPackage):
         # and will hang forever building the TensorFlow package.
         # So limit to something high but still reasonable while allowing ECs to overwrite it
         if self.cfg['maxparallel'] is None:
-            self.cfg['parallel'] = min(self.cfg['parallel'], 64)
+            # Seemingly Bazel around 3.x got better, so double the max there
+            bazel_max = 64 if get_bazel_version() < '3.0.0' else 128
+            self.cfg['parallel'] = min(self.cfg['parallel'], bazel_max)
 
         binutils_root = get_software_root('binutils')
         if not binutils_root:
@@ -748,6 +773,8 @@ class EB_TensorFlow(PythonPackage):
     def build_step(self):
         """Custom build procedure for TensorFlow."""
 
+        bazel_version = get_bazel_version()
+
         # pre-create target installation directory
         mkdir(os.path.join(self.installdir, self.pylibdir), parents=True)
 
@@ -759,6 +786,15 @@ class EB_TensorFlow(PythonPackage):
         self.bazel_opts = [
             '--output_user_root=%s' % self.output_user_root_dir,
         ]
+        # Increase time to wait for bazel to start, available since 4.0+
+        if bazel_version >= '4.0.0':
+            self.bazel_opts.append('--local_startup_timeout_secs=300')  # 5min
+
+        # Environment variables and values needed for Bazel actions.
+        action_env = {}
+        # A value of None is interpreted as using the invoking environments value
+        INHERIT = None  # For better readability
+
         jvm_max_memory = self.cfg['jvm_max_memory']
         if jvm_max_memory:
             jvm_startup_memory = min(512, int(jvm_max_memory))
@@ -800,21 +836,17 @@ class EB_TensorFlow(PythonPackage):
         # Make TF find our modules. LD_LIBRARY_PATH gets automatically added by configure.py
         cpaths, libpaths = self.system_libs_info[1:]
         if cpaths:
-            self.target_opts.append("--action_env=CPATH='%s'" % ':'.join(cpaths))
+            action_env['CPATH'] = ':'.join(cpaths)
         if libpaths:
-            self.target_opts.append("--action_env=LIBRARY_PATH='%s'" % ':'.join(libpaths))
-        self.target_opts.append('--action_env=PYTHONPATH')
+            action_env['LIBRARY_PATH'] = ':'.join(libpaths)
+        action_env['PYTHONPATH'] = INHERIT
         # Also export $EBPYTHONPREFIXES to handle the multi-deps python setup
         # See https://github.com/easybuilders/easybuild-easyblocks/pull/1664
         if 'EBPYTHONPREFIXES' in os.environ:
-            self.target_opts.append('--action_env=EBPYTHONPREFIXES')
+            action_env['EBPYTHONPREFIXES'] = INHERIT
 
         # Ignore user environment for Python
-        self.target_opts.append('--action_env=PYTHONNOUSERSITE=1')
-
-        # Use the same configuration (i.e. environment) for compiling and using host tools
-        # This means that our action_envs are always passed
-        self.target_opts.append('--distinct_host_configuration=false')
+        action_env['PYTHONNOUSERSITE'] = '1'
 
         # TF 2 (final) sets this in configure
         if LooseVersion(self.version) < LooseVersion('2.0'):
@@ -850,6 +882,24 @@ class EB_TensorFlow(PythonPackage):
             # and download it if needed
             self.target_opts.append('--config=mkl')
 
+        # Use the same configuration (i.e. environment) for compiling and using host tools
+        # This means that our action_envs are (almost) always passed
+        # Fully removed in Bazel 6.0 and limited effect after at least 3.7 (see --host_action_env)
+        if bazel_version < '6.0.0':
+            self.target_opts.append('--distinct_host_configuration=false')
+
+        for key, value in sorted(action_env.items()):
+            option = key
+            if value is not None:
+                option += "='%s'" % value
+
+            self.target_opts.append('--action_env=' + option)
+            if bazel_version >= '3.7.0':
+                # Since Bazel 3.7 action_env only applies to the "target" environment, not the "host" environment
+                # As we are not cross-compiling we need both be the same -> Duplicate the setting to host_action_env
+                # See https://github.com/bazelbuild/bazel/commit/a463d9095386b22c121d20957222dbb44caef7d4
+                self.target_opts.append('--host_action_env=' + option)
+
         # Compose final command
         cmd = (
             [self.cfg['prebuildopts']]
@@ -1016,6 +1066,7 @@ class EB_TensorFlow(PythonPackage):
                         self.log.warning('Test %s failed with output\n%s', test_name,
                                          read_file(log_path, log_error=False))
                 if failed_tests:
+                    failed_tests = sorted(set(failed_tests))  # Make unique to not count retries
                     fail_msg = 'At least %s %s tests failed:\n%s' % (
                         len(failed_tests), device, ', '.join(failed_tests))
                 self.report_test_failure(fail_msg)
diff --git a/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0-foss-2022a-CUDA-11.7.eb b/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0-foss-2022a-CUDA-11.7.eb
new file mode 100644
index 000000000..07a4ba1f3
--- /dev/null
+++ b/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0-foss-2022a-CUDA-11.7.eb
@@ -0,0 +1,223 @@
+easyblock = 'PythonBundle'
+
+name = 'TensorFlow'
+version = '2.11.0'
+versionsuffix = '-CUDA-%(cudaver)s'
+
+homepage = 'https://www.tensorflow.org/'
+description = "An open-source software library for Machine Intelligence"
+
+toolchain = {'name': 'foss', 'version': '2022a'}
+toolchainopts = {'pic': True}
+
+builddependencies = [
+    ('Bazel', '5.1.1'),
+    ('protobuf', '3.19.4'),
+    # git 2.x required, see also https://github.com/tensorflow/tensorflow/issues/29053
+    ('git', '2.36.0', '-nodocs'),
+    ('pybind11', '2.9.2'),
+    ('UnZip', '6.0'),
+    ('LLVM', '14.0.3'),  # for debugging with llvm-symbolizer, to be removed
+]
+dependencies = [
+    ('CUDA', '11.7', '', SYSTEM),
+    ('cuDNN', '8.6.0.163', versionsuffix, SYSTEM),
+    ('NCCL', 'default', versionsuffix),
+    ('Python', '3.10.4'),
+    ('h5py', '3.7.0'),
+    ('cURL', '7.83.0'),
+    ('dill', '0.3.6'),
+    ('double-conversion', '3.2.0'),
+    ('flatbuffers', '2.0.0'),
+    ('giflib', '5.2.1'),
+    ('hwloc', '2.7.1'),
+    ('ICU', '71.1'),
+    ('JsonCpp', '1.9.5'),
+    ('libjpeg-turbo', '2.1.3'),
+    ('LMDB', '0.9.29'),
+    ('NASM', '2.15.05'),
+    ('nsync', '1.25.0'),
+    ('SQLite', '3.38.3'),
+    ('protobuf-python', '3.19.4'),
+    ('libpng', '1.6.37'),
+    ('snappy', '1.1.9'),
+    ('zlib', '1.2.12'),
+    ('networkx', '2.8.4', '', ('gcccoremkl', '11.3.0-2022.1.0')),  # required for pythran
+]
+
+use_pip = True
+sanity_pip_check = True
+
+# Dependencies created and updated using findPythonDeps.sh:
+# https://gist.github.com/Flamefire/49426e502cd8983757bd01a08a10ae0d
+exts_list = [
+    ('wrapt', '1.14.1', {
+        'checksums': ['380a85cf89e0e69b7cfbe2ea9f765f004ff419f34194018a6827ac0e3edfed4d'],
+    }),
+    ('termcolor', '1.1.0', {
+        'checksums': ['1d6d69ce66211143803fbc56652b41d73b4a400a2891d7bf7a1cdf4c02de613b'],
+    }),
+    ('tensorflow-estimator', version, {
+        'source_tmpl': 'tensorflow_estimator-%(version)s-py2.py3-none-any.whl',
+        'checksums': ['ea3b64acfff3d9a244f06178c9bdedcbdd3f125b67d0888dba8229498d06468b'],
+    }),
+    ('Werkzeug', '2.2.2', {
+        'checksums': ['7ea2d48322cc7c0f8b3a215ed73eabd7b5d75d0b50e31ab006286ccff9e00b8f'],
+    }),
+    ('tensorboard-plugin-wit', '1.8.1', {
+        'source_tmpl': 'tensorboard_plugin_wit-%(version)s-py3-none-any.whl',
+        'checksums': ['ff26bdd583d155aa951ee3b152b3d0cffae8005dc697f72b44a8e8c2a77a8cbe'],
+    }),
+    ('tensorboard-data-server', '0.6.1', {
+        'source_tmpl': 'tensorboard_data_server-%(version)s-py3-none-any.whl',
+        'checksums': ['809fe9887682d35c1f7d1f54f0f40f98bb1f771b14265b453ca051e2ce58fca7'],
+    }),
+    ('Markdown', '3.4.1', {
+        'checksums': ['3b809086bb6efad416156e00a0da66fe47618a5d6918dd688f53f40c8e4cfeff'],
+    }),
+    ('grpcio', '1.51.1', {
+        'modulename': 'grpc',
+        'preinstallopts': "export GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS=%(parallel)s && ",
+        'checksums': ['e6dfc2b6567b1c261739b43d9c59d201c1b89e017afd9e684d85aa7a186c9f7a'],
+    }),
+    ('oauthlib', '3.2.2', {
+        'checksums': ['9859c40929662bec5d64f34d01c99e093149682a3f38915dc0655d5a633dd918'],
+    }),
+    ('requests-oauthlib', '1.3.1', {
+        'checksums': ['75beac4a47881eeb94d5ea5d6ad31ef88856affe2332b9aafb52c6452ccf0d7a'],
+    }),
+    ('rsa', '4.9', {
+        'checksums': ['e38464a49c6c85d7f1351b0126661487a7e0a14a50f1675ec50eb34d4f20ef21'],
+    }),
+    ('pyasn1-modules', '0.2.8', {
+        'checksums': ['905f84c712230b2c592c19470d3ca8d552de726050d1d1716282a1f6146be65e'],
+    }),
+    ('cachetools', '5.2.1', {
+        'checksums': ['5991bc0e08a1319bb618d3195ca5b6bc76646a49c21d55962977197b301cc1fe'],
+    }),
+    ('google-auth', '2.16.0', {
+        'modulename': 'google.auth',
+        'checksums': ['ed7057a101af1146f0554a769930ac9de506aeca4fd5af6543ebe791851a9fbd'],
+    }),
+    ('google-auth-oauthlib', '0.4.6', {
+        'checksums': ['a90a072f6993f2c327067bf65270046384cda5a8ecb20b94ea9a687f1f233a7a'],
+    }),
+    ('absl-py', '1.4.0', {
+        'modulename': 'absl',
+        'checksums': ['d2c244d01048ba476e7c080bd2c6df5e141d211de80223460d5b3b8a2a58433d'],
+    }),
+    ('tensorboard', '2.11.1', {
+        'source_tmpl': '%(name)s-%(version)s-py3-none-any.whl',
+        'checksums': ['0c7529f3f43691e8cc2ece8e564c2e103c51ade317c6af626d415239b5088018'],
+    }),
+    ('opt-einsum', '3.3.0', {
+        'source_tmpl': 'opt_einsum-%(version)s.tar.gz',
+        'checksums': ['59f6475f77bbc37dcf7cd748519c0ec60722e91e63ca114e68821c0c54a46549'],
+    }),
+    ('keras', version, {
+        'source_tmpl': '%(name)s-%(version)s-py2.py3-none-any.whl',
+        'checksums': ['38c6fff0ea9a8b06a2717736565c92a73c8cd9b1c239e7125ccb188b7848f65e'],
+    }),
+    ('google-pasta', '0.2.0', {
+        'modulename': 'pasta',
+        'checksums': ['c9f2c8dfc8f96d0d5808299920721be30c9eec37f2389f28904f454565c8a16e'],
+    }),
+    ('astunparse', '1.6.3', {
+        'checksums': ['5ad93a8456f0d084c3456d059fd9a92cce667963232cbf763eac3bc5b7940872'],
+    }),
+    ('gast', '0.4.0', {
+        'checksums': ['40feb7b8b8434785585ab224d1568b857edb18297e5a3047f1ba012bc83b42c1'],
+    }),
+    ('beniget', '0.3.0', {
+        'checksums': ['062c893be9cdf87c3144fb15041cce4d81c67107c1591952cd45fdce789a0ff1'],
+    }),
+    ('pythran', '0.9.11', {
+        'checksums': ['a317f91e2aade9f6550dc3bf40b5caeb45b7e012daf27e2b3e4ad928edb01667'],
+    }),
+    ('portpicker', '1.5.2', {
+        'checksums': ['c55683ad725f5c00a41bc7db0225223e8be024b1fa564d039ed3390e4fd48fb3'],
+    }),
+    ('tblib', '1.7.0', {
+        'checksums': ['059bd77306ea7b419d4f76016aef6d7027cc8a0785579b5aad198803435f882c'],
+    }),
+    ('astor', '0.8.1', {
+        'checksums': ['6a6effda93f4e1ce9f618779b2dd1d9d84f1e32812c23a29b3fff6fd7f63fa5e'],
+    }),
+    ('gviz-api', '1.10.0', {
+        'source_tmpl': 'gviz_api-%(version)s.tar.gz',
+        'checksums': ['846692dd8cc73224fc31b18e41589bd934e1cc05090c6576af4b4b26c2e71b90'],
+    }),
+    ('tensorboard-plugin-profile', '2.11.1', {
+        'source_tmpl': 'tensorboard_plugin_profile-%(version)s.tar.gz',
+        'checksums': ['7a97c02d502fde98a0336aadcab15b37169744d5bf6966af7d576c7a3f0a89f4'],
+    }),
+    (name, version, {
+        'patches': [
+            '%(name)s-2.4.0_dont-use-var-lock.patch',
+            '%(name)s-2.5.0-fix-alias-violation-in-absl.patch',
+            '%(name)s-2.5.0_fix-crash-on-shutdown.patch',
+            '%(name)s-2.8.4_exclude-xnnpack-on-ppc.patch',
+            '%(name)s-2.8.4_resolve-gcc-symlinks.patch',
+            '%(name)s-2.9.1_remove-duplicate-gpu-tests.patch',
+            '%(name)s-%(version)s_disable-avx512-extensions.patch',
+            '%(name)s-%(version)s_fix-eigen-atan-on-PPC.patch',
+            '%(name)s-%(version)s_fix-eigen-gemm-on-PPC.patch',
+            '%(name)s-%(version)s_fix-link-error.patch',
+            '%(name)s-%(version)s_remove-libclang-and-io-gcs-deps.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/core/example:example_protos_closure',
+            '//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/common_runtime:mkl_layout_pass_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_timeout=3600 --test_size_filters=small",
+        'testopts_gpu': "--test_timeout=3600 --test_size_filters=small --run_under=//tensorflow/tools/ci_build/gpu_build:parallel_gpu_execute",
+        'with_xla': True,
+        'checksums': [
+            {'v2.11.0.tar.gz': '99c732b92b1b37fc243a559e02f9aef5671771e272758aa4aec7f34dc92dac48'},
+            {'TensorFlow-2.4.0_dont-use-var-lock.patch':
+             'b14f2493fd2edf79abd1c4f2dde6c98a3e7d5cb9c25ab9386df874d5f072d6b5'},
+            {'TensorFlow-2.5.0-fix-alias-violation-in-absl.patch':
+             '12454fda3330fb45cd380377e283f04488b40e0b8ae7378e786ddf731a581f75'},
+            {'TensorFlow-2.5.0_fix-crash-on-shutdown.patch':
+             '578c7493221ebd3dc25ca43d63a72cbb28fdf4112b1e2baa7390f25781bd78fd'},
+            {'TensorFlow-2.8.4_exclude-xnnpack-on-ppc.patch':
+             'ebd404ac56cc4ca662483f1f591e62e11749361be57a7ba5f4b2f0d03e829884'},
+            {'TensorFlow-2.8.4_resolve-gcc-symlinks.patch':
+             '43ce9acc6bffff68a31d2263d0064d272999b2e0a2c6546690287cd1c9c90f04'},
+            {'TensorFlow-2.9.1_remove-duplicate-gpu-tests.patch':
+             '6fe50faab28387c622c68dc3fc0cbfb2a51000cd750c1a82f8420b54fcd2509f'},
+            {'TensorFlow-2.11.0_disable-avx512-extensions.patch':
+             'fb8e7694b5d2377cc44e6674ff85a7c50dc725f2f507cbcfda65f129f534b1cc'},
+            {'TensorFlow-2.11.0_fix-eigen-atan-on-PPC.patch':
+             'd9f4779f72ffd2c5f9c5da0a7735328dd25756515edccf603087dba2bf4d1612'},
+            {'TensorFlow-2.11.0_fix-eigen-gemm-on-PPC.patch':
+             '4f18ff0563b0ef8556904db1bb4974f8068bf0d2ee1effb24e0c779eb32517e3'},
+            {'TensorFlow-2.11.0_fix-link-error.patch':
+             '0a2f5c9c5be425f305bdc08f5a5ffce210e66f6ad4120d94ea0209246fc0449f'},
+            {'TensorFlow-2.11.0_remove-libclang-and-io-gcs-deps.patch':
+             '21d5723ab4e9a3be349cf3d57bb55cbe43e28785a8c8b19c52cee9dcc4dcf0de'},
+        ],
+    }),
+]
+
+moduleclass = 'lib'
diff --git a/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_disable-avx512-extensions.patch b/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_disable-avx512-extensions.patch
new file mode 100644
index 000000000..491872e54
--- /dev/null
+++ b/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_disable-avx512-extensions.patch
@@ -0,0 +1,19 @@
+(Some of the) AVX512 extensions to Eigen introduced by TensorFlow are broken and return wrong values.
+So disable them for now to keep AVX512 in the other code parts working.
+See https://github.com/tensorflow/tensorflow/issues/49944
+
+Author: Alexander Grund (TU Dresden)
+
+diff --git a/tensorflow/tsl/framework/fixedpoint/FixedPoint.h b/tensorflow/tsl/framework/fixedpoint/FixedPoint.h
+index bb3def15189..85affe89c54 100644
+--- a/tensorflow/tsl/framework/fixedpoint/FixedPoint.h
++++ b/tensorflow/tsl/framework/fixedpoint/FixedPoint.h
+@@ -20,7 +20,7 @@ limitations under the License.
+ #include "tensorflow/tsl/framework/fixedpoint_types.h"
+ 
+ // Use optimized implementations whenever available
+-#if defined(EIGEN_VECTORIZE_AVX512DQ) || defined(EIGEN_VECTORIZE_AVX512BW)
++#if 0
+ #include "tensorflow/tsl/framework/fixedpoint/PacketMathAVX512.h"
+ #include "tensorflow/tsl/framework/fixedpoint/TypeCastingAVX512.h"
+ 
diff --git a/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_fix-eigen-atan-on-PPC.patch b/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_fix-eigen-atan-on-PPC.patch
new file mode 100644
index 000000000..3d57bed62
--- /dev/null
+++ b/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_fix-eigen-atan-on-PPC.patch
@@ -0,0 +1,38 @@
+Fix compilation failure on PowerPC:
+external/eigen_archive/unsupported/Eigen/CXX11/../../../Eigen/src/Core/GenericPacketMath.h:862:67: error: no matching function for call to 'atan(const __vector(2) double&)'
+
+Add the upstream commit https://gitlab.com/libeigen/eigen/-/commit/886aad136111eeeb7604e1d17f62efcc4d824568
+
+Author: Alexander Grund (TU Dresden)
+
+diff --git a/third_party/eigen3/disable-atan-on-ppc.patch b/third_party/eigen3/disable-atan-on-ppc.patch
+new file mode 100644
+index 00000000000..4614799b66a
+--- /dev/null
++++ b/third_party/eigen3/disable-atan-on-ppc.patch
+@@ -0,0 +1,13 @@
++diff --git a/Eigen/src/Core/arch/AltiVec/PacketMath.h b/Eigen/src/Core/arch/AltiVec/PacketMath.h
++index 37398de15..d9ddb5e35 100644
++--- a/Eigen/src/Core/arch/AltiVec/PacketMath.h
+++++ b/Eigen/src/Core/arch/AltiVec/PacketMath.h
++@@ -2708,7 +2708,7 @@ template<> struct packet_traits<double> : default_packet_traits
++     HasAbs  = 1,
++     HasSin  = 0,
++     HasCos  = 0,
++-    HasATan = 1,
+++    HasATan = 0,
++     HasLog  = 0,
++     HasExp  = 1,
++     HasSqrt = 1,
+diff --git a/third_party/eigen3/workspace.bzl b/third_party/eigen3/workspace.bzl
+index 91f471c3def..9fa96a38310 100644
+--- a/third_party/eigen3/workspace.bzl
++++ b/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:disable-atan-on-ppc.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/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_fix-eigen-gemm-on-PPC.patch b/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_fix-eigen-gemm-on-PPC.patch
new file mode 100644
index 000000000..1cbf1a35a
--- /dev/null
+++ b/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_fix-eigen-gemm-on-PPC.patch
@@ -0,0 +1,72 @@
+Fix a SIGSEGV in e.g. //tensorflow/core/grappler/optimizers:arithmetic_optimizer_test_cpu
+See https://gitlab.com/libeigen/eigen/-/issues/2608
+
+fix-ppc-gemm.patch based on https://gitlab.com/libeigen/eigen/-/merge_requests/1208
+
+Author: Alexander Grund (TU Dresden)
+
+diff --git a/third_party/eigen3/fix-ppc-gemm.patch b/third_party/eigen3/fix-ppc-gemm.patch
+new file mode 100644
+index 00000000000..c674c4b590e
+--- /dev/null
++++ b/third_party/eigen3/fix-ppc-gemm.patch
+@@ -0,0 +1,46 @@
++diff --git a/Eigen/src/Core/arch/AltiVec/MatrixProduct.h b/Eigen/src/Core/arch/AltiVec/MatrixProduct.h
++index 3b3b558..44f9e16 100644
++--- a/Eigen/src/Core/arch/AltiVec/MatrixProduct.h
+++++ b/Eigen/src/Core/arch/AltiVec/MatrixProduct.h
++@@ -1760,7 +1760,7 @@ EIGEN_ALWAYS_INLINE void gemm_cols(
++   gemm_cols<Scalar, Packet, DataMapper, N, accCols>(res, blockA, blockB, depth, strideA, offsetA, strideB, offsetB, col, rows, remaining_rows, pAlpha, pMask);
++ 
++ template<typename Scalar, typename Packet, typename DataMapper, const Index accCols>
++-EIGEN_STRONG_INLINE void gemm_extra_cols(
+++EIGEN_ALWAYS_INLINE void gemm_extra_cols(
++   const DataMapper& res,
++   const Scalar* blockA,
++   const Scalar* blockB,
++@@ -2194,7 +2194,7 @@ EIGEN_ALWAYS_INLINE void gemm_complex_cols(
++   gemm_complex_cols<Scalar, Packet, Packetc, DataMapper, N, accCols, ConjugateLhs, ConjugateRhs, LhsIsReal, RhsIsReal>(res, blockA, blockB, depth, strideA, offsetA, strideB, offsetB, col, rows, remaining_rows, pAlphaReal, pAlphaImag, pMask);
++ 
++ template<typename Scalar, typename Packet, typename Packetc, typename DataMapper, const Index accCols, bool ConjugateLhs, bool ConjugateRhs, bool LhsIsReal, bool RhsIsReal>
++-EIGEN_STRONG_INLINE void gemm_complex_extra_cols(
+++EIGEN_ALWAYS_INLINE void gemm_complex_extra_cols(
++   const DataMapper& res,
++   const Scalar* blockA,
++   const Scalar* blockB,
++diff --git a/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h b/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h
++index 28868ca..1ac6629 100644
++--- a/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h
+++++ b/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h
++@@ -30,8 +30,8 @@ EIGEN_ALWAYS_INLINE void gemm_extra_row(
++   const Packet& pAlpha,
++   const Packet& pMask);
++ 
++-template<typename Scalar, typename Packet, typename DataMapper, const Index accCols, bool ConjugateLhs, bool ConjugateRhs, bool LhsIsReal, bool RhsIsReal>
++-EIGEN_STRONG_INLINE void gemm_extra_cols(
+++template<typename Scalar, typename Packet, typename DataMapper, const Index accCols>
+++EIGEN_ALWAYS_INLINE void gemm_extra_cols(
++   const DataMapper& res,
++   const Scalar* blockA,
++   const Scalar* blockB,
++@@ -67,7 +67,7 @@ EIGEN_ALWAYS_INLINE void gemm_complex_extra_row(
++   const Packet& pMask);
++ 
++ template<typename Scalar, typename Packet, typename Packetc, typename DataMapper, const Index accCols, bool ConjugateLhs, bool ConjugateRhs, bool LhsIsReal, bool RhsIsReal>
++-EIGEN_STRONG_INLINE void gemm_complex_extra_cols(
+++EIGEN_ALWAYS_INLINE void gemm_complex_extra_cols(
++   const DataMapper& res,
++   const Scalar* blockA,
++   const Scalar* blockB,
+diff --git a/third_party/eigen3/workspace.bzl b/third_party/eigen3/workspace.bzl
+index 6c8744aeec4..2a2a7b474c9 100644
+--- a/third_party/eigen3/workspace.bzl
++++ b/third_party/eigen3/workspace.bzl
+@@ -14,7 +14,7 @@ def repo():
+     tf_http_archive(
+         name = "eigen_archive",
+         build_file = "//third_party/eigen3:eigen_archive.BUILD",
+-        patch_file = ["//third_party/eigen3:disable-atan-on-ppc.patch"],
++        patch_file = ["//third_party/eigen3:disable-atan-on-ppc.patch", "//third_party/eigen3:fix-ppc-gemm.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/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_fix-link-error.patch b/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_fix-link-error.patch
new file mode 100644
index 000000000..a49289770
--- /dev/null
+++ b/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_fix-link-error.patch
@@ -0,0 +1,39 @@
+Fix errors during build such as
+Traceback (most recent call last):
+  File "/bazel-root/21e00dc5c04b924b70ed7bedd0c3533e/execroot/org_tensorflow/bazel-out/ppc-opt/bin/tensorflow/create_tensorflow.python_api_tf_python_api_gen_v2.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow.py", line 62, in <module>
+    from tensorflow.python._pywrap_tensorflow_internal import *
+ImportError: /bazel-root/21e00dc5c04b924b70ed7bedd0c3533e/execroot/org_tensorflow/bazel-out/ppc-opt/bin/tensorflow/create_tensorflow.python_api_tf_python_api_gen_v2.runfiles/org_tensorflow/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: LLVMInitializePowerPCAsmParser
+
+See https://github.com/tensorflow/tensorflow/pull/59326
+
+Author: Alexander Grund (TU Dresden)
+
+diff --git a/tensorflow/compiler/xla/mlir/transforms/runtime/BUILD b/tensorflow/compiler/xla/mlir/transforms/runtime/BUILD
+index 587d4b184c0..5ff10743cf8 100644
+--- a/tensorflow/compiler/xla/mlir/transforms/runtime/BUILD
++++ b/tensorflow/compiler/xla/mlir/transforms/runtime/BUILD
+@@ -250,7 +250,23 @@ cc_library(
+         "@llvm-project//mlir:Parser",
+         "@llvm-project//mlir:Pass",
+         "@llvm-project//mlir:ToLLVMIRTranslation",
+-    ],
++    ] + select({
++        "//tensorflow:arm_any": [
++            "@llvm-project//llvm:AArch64AsmParser",
++        ],
++        "//tensorflow:linux_ppc64le": [
++            "@llvm-project//llvm:PowerPCAsmParser",
++        ],
++        "//tensorflow:macos_arm64": [
++            "@llvm-project//llvm:AArch64AsmParser",
++        ],
++        "//tensorflow:linux_s390x": [
++            "@llvm-project//llvm:SystemZAsmParser",
++        ],
++        "//conditions:default": [
++            "@llvm-project//llvm:X86AsmParser",
++        ],
++    }),
+ )
+ 
+ cc_library(
diff --git a/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_remove-libclang-and-io-gcs-deps.patch b/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_remove-libclang-and-io-gcs-deps.patch
new file mode 100644
index 000000000..77b9f5249
--- /dev/null
+++ b/Golden_Repo/t/TensorFlow/TensorFlow-2.11.0_remove-libclang-and-io-gcs-deps.patch
@@ -0,0 +1,38 @@
+This combines two patches from TensorFlow 2.7.1.
+
+tensorflow-io-gcs-filesystem is not available as a binary for all architectures and
+building it requires TensorFlow to be installed, i.e. there is a cyclic dependency.
+As it is not actually required (but optional) remove it from `REQUIRED_PACKAGES`.
+See https://github.com/tensorflow/tensorflow/issues/56636
+
+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.
+
+Patch added by Simon Branford (University of Birmingham)
+Updated by Alexander Grund (TU Dresden)
+
+diff --git a/tensorflow/tools/pip_package/setup.py b/tensorflow/tools/pip_package/setup.py
+index 74a1962c334..e8f6eabe4a6 100644
+--- a/tensorflow/tools/pip_package/setup.py
++++ b/tensorflow/tools/pip_package/setup.py
+@@ -88,7 +88,6 @@ REQUIRED_PACKAGES = [
+     'gast >= 0.2.1, <= 0.4.0',
+     'google_pasta >= 0.1.1',
+     'h5py >= 2.9.0',
+-    'libclang >= 13.0.0',
+     'numpy >= 1.20',
+     'opt_einsum >= 2.3.2',
+     'packaging',
+@@ -105,8 +104,6 @@ REQUIRED_PACKAGES = [
+     'termcolor >= 1.1.0',
+     'typing_extensions >= 3.6.6',
+     'wrapt >= 1.11.0',
+-    'tensorflow-io-gcs-filesystem >= 0.23.1;platform_machine!="arm64" or ' +
+-    'platform_system!="Darwin"',
+     # grpcio does not build correctly on big-endian machines due to lack of
+     # BoringSSL support.
+     # See https://github.com/tensorflow/tensorflow/issues/17882.
diff --git a/Golden_Repo/t/TensorFlow/TensorFlow-2.4.0_dont-use-var-lock.patch b/Golden_Repo/t/TensorFlow/TensorFlow-2.4.0_dont-use-var-lock.patch
new file mode 100644
index 000000000..e33d0028a
--- /dev/null
+++ b/Golden_Repo/t/TensorFlow/TensorFlow-2.4.0_dont-use-var-lock.patch
@@ -0,0 +1,37 @@
+diff --git a/tensorflow/tools/ci_build/gpu_build/parallel_gpu_execute.sh b/tensorflow/tools/ci_build/gpu_build/parallel_gpu_execute.sh
+index ee70f2f608b..ab5cbe7d7b5 100755
+--- a/tensorflow/tools/ci_build/gpu_build/parallel_gpu_execute.sh
++++ b/tensorflow/tools/ci_build/gpu_build/parallel_gpu_execute.sh
+@@ -53,7 +53,7 @@ TEST_BINARY="$(rlocation $TEST_WORKSPACE/${1#./})"
+ shift
+ # *******************************************************************
+ 
+-mkdir -p /var/lock
++mkdir -p /tmp/tf-test-lock
+ # Try to acquire any of the TF_GPU_COUNT * TF_TESTS_PER_GPU
+ # slots to run a test at.
+ #
+@@ -61,7 +61,7 @@ mkdir -p /var/lock
+ # So, we iterate over TF_TESTS_PER_GPU first.
+ for j in `seq 0 $((TF_TESTS_PER_GPU-1))`; do
+   for i in `seq 0 $((TF_GPU_COUNT-1))`; do
+-    exec {lock_fd}>/var/lock/gpulock${i}_${j} || exit 1
++    exec {lock_fd}>/tmp/tf-test-lock/gpulock${i}_${j} || exit 1
+     if flock -n "$lock_fd";
+     then
+       (
+@@ -70,6 +70,7 @@ for j in `seq 0 $((TF_TESTS_PER_GPU-1))`; do
+         export CUDA_VISIBLE_DEVICES=$i
+         export HIP_VISIBLE_DEVICES=$i
+         echo "Running test $TEST_BINARY $* on GPU $CUDA_VISIBLE_DEVICES"
++        set +e
+         "$TEST_BINARY" $@
+       )
+       return_code=$?
+@@ -79,5 +80,5 @@ for j in `seq 0 $((TF_TESTS_PER_GPU-1))`; do
+   done
+ done
+ 
+-echo "Cannot find a free GPU to run the test $* on, exiting with failure..."
++echo "Cannot find a free GPU to run the test $TEST_BINARY $* on, exiting with failure..."
+ exit 1
diff --git a/Golden_Repo/t/TensorFlow/TensorFlow-2.5.0-fix-alias-violation-in-absl.patch b/Golden_Repo/t/TensorFlow/TensorFlow-2.5.0-fix-alias-violation-in-absl.patch
new file mode 100644
index 000000000..427f7555e
--- /dev/null
+++ b/Golden_Repo/t/TensorFlow/TensorFlow-2.5.0-fix-alias-violation-in-absl.patch
@@ -0,0 +1,26 @@
+The behavior relied on by Abseil is unsupported by GCC and leads to misoptimizations.
+See https://github.com/tensorflow/tensorflow/issues/47179
+
+Author: Alexander Grund
+
+diff --git a/third_party/absl/com_google_absl_fix_mac_and_nvcc_build.patch b/third_party/absl/com_google_absl_fix_mac_and_nvcc_build.patch
+index 6301119ab2c..0b8b4838726 100644
+--- a/third_party/absl/com_google_absl_fix_mac_and_nvcc_build.patch
++++ b/third_party/absl/com_google_absl_fix_mac_and_nvcc_build.patch
+@@ -1,3 +1,16 @@
++diff --git a/absl/container/internal/container_memory.h b/absl/container/internal/container_memory.h
++index d24b0f8..f8847b5 100644
++--- a/absl/container/internal/container_memory.h
+++++ b/absl/container/internal/container_memory.h
++@@ -338,7 +338,7 @@ struct map_slot_policy {
++   // If pair<const K, V> and pair<K, V> are layout-compatible, we can accept one
++   // or the other via slot_type. We are also free to access the key via
++   // slot_type::key in this case.
++-  using kMutableKeys = memory_internal::IsLayoutCompatible<K, V>;
+++  using kMutableKeys = std::false_type;
++
++  public:
++   static value_type& element(slot_type* slot) { return slot->value; }
+ diff --git a/absl/container/internal/compressed_tuple.h b/absl/container/internal/compressed_tuple.h
+ index 4bfe92f..01db713 100644
+ --- a/absl/container/internal/compressed_tuple.h
diff --git a/Golden_Repo/t/TensorFlow/TensorFlow-2.5.0_fix-arm-vector-intrinsics.patch b/Golden_Repo/t/TensorFlow/TensorFlow-2.5.0_fix-arm-vector-intrinsics.patch
new file mode 100644
index 000000000..eaed0decf
--- /dev/null
+++ b/Golden_Repo/t/TensorFlow/TensorFlow-2.5.0_fix-arm-vector-intrinsics.patch
@@ -0,0 +1,42 @@
+Fix compile error on ARM:
+> ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_3x3_filter_common.h:132:58: error: cannot convert 'int32x2_t' to 'int8x8_t'
+
+From https://github.com/tensorflow/tensorflow/pull/53782
+
+From 4463f25d1622d162f870ff685da20f2c6df5bc6a Mon Sep 17 00:00:00 2001
+From: Stephan Hartmann <stha09@googlemail.com>
+Date: Sat, 15 Jan 2022 21:06:27 +0100
+Subject: [PATCH] Fix casting in vdotq_four_lane_s32() in TFLite
+
+When building with GCC and dotprod ARM extension enabled,
+vreinterpret_s32_s8() casts int8x8_t to int32x2_t. However, third
+argument of vdotq_lane_s32() expects parameter of type int8x8_t.
+---
+ .../optimized/depthwiseconv_3x3_filter_common.h        | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/tensorflow/lite/kernels/internal/optimized/depthwiseconv_3x3_filter_common.h b/tensorflow/lite/kernels/internal/optimized/depthwiseconv_3x3_filter_common.h
+index 916edd561ff32..c519a81bc864d 100644
+--- a/tensorflow/lite/kernels/internal/optimized/depthwiseconv_3x3_filter_common.h
++++ b/tensorflow/lite/kernels/internal/optimized/depthwiseconv_3x3_filter_common.h
+@@ -129,16 +129,14 @@ inline int32x4_t vdotq_four_lane_s32(int32x4_t acc, int8x16_t lhs,
+                                      int8x16_t rhs, const int lane) {
+   switch (lane) {
+     case 0:
+-      return vdotq_lane_s32(acc, lhs, vreinterpret_s32_s8(vget_low_s8(rhs)), 0);
++      return vdotq_lane_s32(acc, lhs, vget_low_s8(rhs), 0);
+     case 1:
+-      return vdotq_lane_s32(acc, lhs, vreinterpret_s32_s8(vget_low_s8(rhs)), 1);
++      return vdotq_lane_s32(acc, lhs, vget_low_s8(rhs), 1);
+     case 2:
+-      return vdotq_lane_s32(acc, lhs, vreinterpret_s32_s8(vget_high_s8(rhs)),
+-                            0);
++      return vdotq_lane_s32(acc, lhs, vget_high_s8(rhs), 0);
+     case 3:
+     default:
+-      return vdotq_lane_s32(acc, lhs, vreinterpret_s32_s8(vget_high_s8(rhs)),
+-                            1);
++      return vdotq_lane_s32(acc, lhs, vget_high_s8(rhs), 1);
+   }
+ }
+ 
diff --git a/Golden_Repo/t/TensorFlow/TensorFlow-2.8.4_exclude-xnnpack-on-ppc.patch b/Golden_Repo/t/TensorFlow/TensorFlow-2.8.4_exclude-xnnpack-on-ppc.patch
new file mode 100644
index 000000000..1a0938252
--- /dev/null
+++ b/Golden_Repo/t/TensorFlow/TensorFlow-2.8.4_exclude-xnnpack-on-ppc.patch
@@ -0,0 +1,18 @@
+XNNPACK is not supported on PowerPC so disable it by default.
+See https://github.com/tensorflow/tensorflow/issues/58768
+
+Author: Alexander Grund (TU Dresden)
+
+diff --git a/tensorflow/lite/BUILD b/tensorflow/lite/BUILD
+index 198f949b341..d15dcf9a80d 100644
+--- a/tensorflow/lite/BUILD
++++ b/tensorflow/lite/BUILD
+@@ -709,6 +709,8 @@ cc_library(
+     deps = select({
+         "//tensorflow:macos": [],
+         "//tensorflow:fuchsia": [],
++        # XNNPACK is not supported on PPC
++        "//tensorflow:linux_ppc64le": [],
+         "//conditions:default": [":tflite_with_xnnpack_enabled"],
+     }),
+ )
diff --git a/Golden_Repo/t/TensorFlow/TensorFlow-2.8.4_resolve-gcc-symlinks.patch b/Golden_Repo/t/TensorFlow/TensorFlow-2.8.4_resolve-gcc-symlinks.patch
new file mode 100644
index 000000000..42cdce7c9
--- /dev/null
+++ b/Golden_Repo/t/TensorFlow/TensorFlow-2.8.4_resolve-gcc-symlinks.patch
@@ -0,0 +1,28 @@
+Fix for "undeclared inclusion(s) in rule" errors when the installation directory
+for GCC is hosted in a path that is a symlink to another path.
+
+From https://github.com/tensorflow/tensorflow/pull/56360
+
+From b3a8fdbcb79e723f8d62f86bddcfdfb73fe76291 Mon Sep 17 00:00:00 2001
+From: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
+Date: Sat, 4 Jun 2022 19:06:58 -0400
+Subject: [PATCH] resolve gcc_host_compiler_path in a symlink directory
+
+Resolves a missing dependency declarations error, when gcc_host_compiler_path is in a symlink directory resolving to other directories.
+---
+ configure.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.py b/configure.py
+index bf338bdda2297..77af09a22a05d 100644
+--- a/configure.py
++++ b/configure.py
+@@ -619,7 +619,7 @@ def prompt_loop_or_load_from_env(environ_cp,
+                          'Assuming to be a scripting mistake.' %
+                          (var_name, n_ask_attempts))
+ 
+-  if resolve_symlinks and os.path.islink(val):
++  if resolve_symlinks:
+     val = os.path.realpath(val)
+   environ_cp[var_name] = val
+   return val
diff --git a/Golden_Repo/t/TensorFlow/TensorFlow-2.9.1_remove-duplicate-gpu-tests.patch b/Golden_Repo/t/TensorFlow/TensorFlow-2.9.1_remove-duplicate-gpu-tests.patch
new file mode 100644
index 000000000..7701d85e6
--- /dev/null
+++ b/Golden_Repo/t/TensorFlow/TensorFlow-2.9.1_remove-duplicate-gpu-tests.patch
@@ -0,0 +1,55 @@
+TensorFlow adds some GPU tests twice increasing the runtime of the test suite.
+This filters out the test part meant for CPU.
+
+See https://github.com/tensorflow/tensorflow/issues/47081
+From https://github.com/tensorflow/tensorflow/pull/59129
+
+Author: Alexander Grund (TU Dresden)
+---
+ tensorflow/tensorflow.bzl | 33 +++++++++++++++++----------------
+ 1 file changed, 17 insertions(+), 16 deletions(-)
+
+diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl
+index 649c8e22dcc95..d3fc0e3221497 100644
+--- a/tensorflow/tensorflow.bzl
++++ b/tensorflow/tensorflow.bzl
+@@ -1461,22 +1461,23 @@ def tf_gpu_cc_test(
+         linkopts = [],
+         **kwargs):
+     targets = []
+-    tf_cc_test(
+-        name = name,
+-        size = size,
+-        srcs = srcs,
+-        args = args,
+-        data = data,
+-        extra_copts = extra_copts + if_cuda(["-DNV_CUDNN_DISABLE_EXCEPTION"]),
+-        kernels = kernels,
+-        linkopts = linkopts,
+-        linkstatic = linkstatic,
+-        suffix = "_cpu",
+-        tags = tags,
+-        deps = deps,
+-        **kwargs
+-    )
+-    targets.append(name + "_cpu")
++    if 'gpu' not in tags:
++        tf_cc_test(
++            name = name,
++            size = size,
++            srcs = srcs,
++            args = args,
++            data = data,
++            extra_copts = extra_copts + if_cuda(["-DNV_CUDNN_DISABLE_EXCEPTION"]),
++            kernels = kernels,
++            linkopts = linkopts,
++            linkstatic = linkstatic,
++            suffix = "_cpu",
++            tags = tags,
++            deps = deps,
++            **kwargs
++        )
++        targets.append(name + "_cpu")
+     tf_cc_test(
+         name = name,
+         size = size,
-- 
GitLab