From 71fcc9f9a0b739fc8c61a10c341253d681a124ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20M=C3=BCller?= <mueller@kip.uni-heidelberg.de> Date: Mon, 17 Mar 2025 12:45:08 +0100 Subject: [PATCH] fix(py-tensorflow): more fixes (@2.18.0) * disable XNN's avxvnniint8 on gcc before 13 * some data structure padding issue --- packages/py-tensorflow/package.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/py-tensorflow/package.py b/packages/py-tensorflow/package.py index 6b01431b..5b858b1e 100644 --- a/packages/py-tensorflow/package.py +++ b/packages/py-tensorflow/package.py @@ -560,6 +560,14 @@ class PyTensorflow(Package, CudaPackage, ROCmPackage, PythonExtension): patch("set_jit_true.patch", when="@2.18.0-rocm-enhanced +rocm") phases = ["configure", "build", "install"] + # see https://github.com/tensorflow/tensorflow/pull/74423 + # ("Fix ResolvePadding to be consistent in the size of the small vector") + patch( + "https://github.com/tensorflow/tensorflow/commit/64b7390208319b239d0fedb146b2969fbdbf0ee6.patch?full_index=1", + sha256="2eac2f361ee71c26d129e281990e6a84114c3898dda6178f4510e715e9dbcc95", + when="@2.18.0 %gcc", + ) + def flag_handler(self, name, flags): spec = self.spec # ubuntu gcc has this workaround turned on by default in aarch64 @@ -915,6 +923,11 @@ class PyTensorflow(Package, CudaPackage, ROCmPackage, PythonExtension): filter_file("build:opt --copt=-march=native", "", ".tf_configure.bazelrc") filter_file("build:opt --host_copt=-march=native", "", ".tf_configure.bazelrc") + # option -mavxvnniint8 (via @2.18's xnnpack) only supported from gcc@13: + if spec.satisfies("@2.18.0: %gcc@:12"): + with open(".bazelrc", mode="a") as f: + f.write("build --define=xnn_enable_avxvnniint8=false\n") + def build(self, spec, prefix): # Bazel needs the directory to exist on install mkdirp(python_platlib) -- GitLab