From 0df1ef3393b2076062325d406a0e66250b15ad38 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Wed, 5 Mar 2025 18:43:45 +0100 Subject: [PATCH 1/4] Update tensorflow 2.17.0 to commit with DNNL_ENABLE_MEM_DEBUG --- tensorflow-sources.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow-sources.spec b/tensorflow-sources.spec index c5c12d8c2ec..e8fdd0b48e6 100644 --- a/tensorflow-sources.spec +++ b/tensorflow-sources.spec @@ -1,5 +1,5 @@ ### RPM external tensorflow-sources 2.17.0 -%define tag f48e52b5a63d0c54dc209bc8354c5e46afbe8889 +%define tag 231ae05e69b612421f451eb04c87e1881140e99b %define branch cms/v%{realversion} %define github_user cms-externals %define build_type opt From 119f5e4cbdc5a35a361de1e7a6a10d4dc17155ac Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Fri, 14 Mar 2025 21:57:06 +0100 Subject: [PATCH 2/4] Add -fno-omit-frame-pointer to Tensorflow OneDNN compilation --- tensorflow-sources.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow-sources.spec b/tensorflow-sources.spec index e8fdd0b48e6..e5030fb63f1 100644 --- a/tensorflow-sources.spec +++ b/tensorflow-sources.spec @@ -1,5 +1,5 @@ ### RPM external tensorflow-sources 2.17.0 -%define tag 231ae05e69b612421f451eb04c87e1881140e99b +%define tag 3fd38f7a3ee46b6fcabbce933f444f7b70731fe9 %define branch cms/v%{realversion} %define github_user cms-externals %define build_type opt From ac42767c7f85e4c08e98dc3870eef17c4b2cf832 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Tue, 18 Mar 2025 20:28:42 +0100 Subject: [PATCH 3/4] Use ZenDNN instead of OneDNN --- tensorflow-sources.file | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorflow-sources.file b/tensorflow-sources.file index f4e05e0acbc..0a3058b9f8e 100644 --- a/tensorflow-sources.file +++ b/tensorflow-sources.file @@ -55,7 +55,7 @@ BAZEL_OPTS="$BAZEL_OPTS --distinct_host_configuration=true" BAZEL_OPTS="$BAZEL_OPTS $(echo %{arch_build_flags} | tr ' ' '\n' | grep -v '^$' | sed -e 's|^|--copt=|' | tr '\n' ' ')" %endif BAZEL_OPTS="$BAZEL_OPTS --config=%{build_type} --cxxopt=-std=c++%{cms_cxx_standard} --host_cxxopt=-std=c++%{cms_cxx_standard} %{makeprocesses}" -BAZEL_OPTS="$BAZEL_OPTS --config=noaws --config=nogcp --config=nohdfs --config=nonccl" +BAZEL_OPTS="$BAZEL_OPTS --config=noaws --config=nogcp --config=nohdfs --config=nonccl --config=mkl" %if "%{enable_tf_mkldnn}" == "0" BAZEL_OPTS="$BAZEL_OPTS --define tensorflow_mkldnn_contraction_kernel=0" %endif @@ -80,7 +80,7 @@ export TF_NEED_GCP=0 export TF_ENABLE_XLA=1 export TF_NEED_OPENCL=0 export TF_NEED_VERBS=0 -export TF_NEED_MKL=0 +export TF_NEED_MKL=1 export TF_NEED_MPI=0 export TF_NEED_S3=0 export TF_NEED_GDR=0 From 11875d97e951aff29c0592e5b9270f18ce98b8ef Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Wed, 19 Mar 2025 18:26:32 +0100 Subject: [PATCH 4/4] Set tensorflow_mkldnn_contraction_kernel=0. Disable XLA which fails to build with MKL --- tensorflow-sources.file | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tensorflow-sources.file b/tensorflow-sources.file index 0a3058b9f8e..f95e80ba436 100644 --- a/tensorflow-sources.file +++ b/tensorflow-sources.file @@ -56,9 +56,9 @@ BAZEL_OPTS="$BAZEL_OPTS $(echo %{arch_build_flags} | tr ' ' '\n' | grep -v '^$' %endif BAZEL_OPTS="$BAZEL_OPTS --config=%{build_type} --cxxopt=-std=c++%{cms_cxx_standard} --host_cxxopt=-std=c++%{cms_cxx_standard} %{makeprocesses}" BAZEL_OPTS="$BAZEL_OPTS --config=noaws --config=nogcp --config=nohdfs --config=nonccl --config=mkl" -%if "%{enable_tf_mkldnn}" == "0" +#%if "%{enable_tf_mkldnn}" == "0" BAZEL_OPTS="$BAZEL_OPTS --define tensorflow_mkldnn_contraction_kernel=0" -%endif +#%endif %ifarch ppc64le BAZEL_OPTS="$BAZEL_OPTS --define tflite_with_xnnpack=false" %endif @@ -77,7 +77,7 @@ export TF_NEED_CLANG=0 export TF_NEED_JEMALLOC=0 export TF_NEED_HDFS=0 export TF_NEED_GCP=0 -export TF_ENABLE_XLA=1 +export TF_ENABLE_XLA=0 export TF_NEED_OPENCL=0 export TF_NEED_VERBS=0 export TF_NEED_MKL=1 @@ -149,11 +149,11 @@ bazel $BAZEL_OPTS //tensorflow/tools/pip_package:wheel %define bazel_dir %{_arch}-%{build_type} %endif -mkdir %{i}/lib-xla-runtime -find bazel-out/%{bazel_dir}/bin -path '*/pip_package/wheel_house/tensorflow-%{realversion}*.whl' | xargs --no-run-if-empty -i cp '{}' %{i}/ -find bazel-out/%{bazel_dir}/bin -path '*/external/ducc/libfft*.pic.a' | xargs --no-run-if-empty -i cp '{}' %{i}/lib-xla-runtime -find bazel-out/%{bazel_dir}/bin -path '*/external/local_tsl/tsl/*/libmutex.pic.a' | xargs --no-run-if-empty -i cp '{}' %{i}/lib-xla-runtime -find bazel-out/%{bazel_dir}/bin -path '*/external/nsync/libnsync_cpp.pic.a' | xargs --no-run-if-empty -i cp '{}' %{i}/lib-xla-runtime -for lib in libfft.pic.a libfft_wrapper.pic.a libmutex.pic.a libnsync_cpp.pic.a ; do - test -e %{i}/lib-xla-runtime/${lib} -done +#mkdir %{i}/lib-xla-runtime +#find bazel-out/%{bazel_dir}/bin -path '*/pip_package/wheel_house/tensorflow-%{realversion}*.whl' | xargs --no-run-if-empty -i cp '{}' %{i}/ +#find bazel-out/%{bazel_dir}/bin -path '*/external/ducc/libfft*.pic.a' | xargs --no-run-if-empty -i cp '{}' %{i}/lib-xla-runtime +#find bazel-out/%{bazel_dir}/bin -path '*/external/local_tsl/tsl/*/libmutex.pic.a' | xargs --no-run-if-empty -i cp '{}' %{i}/lib-xla-runtime +#find bazel-out/%{bazel_dir}/bin -path '*/external/nsync/libnsync_cpp.pic.a' | xargs --no-run-if-empty -i cp '{}' %{i}/lib-xla-runtime +#for lib in libfft.pic.a libfft_wrapper.pic.a libmutex.pic.a libnsync_cpp.pic.a ; do +# test -e %{i}/lib-xla-runtime/${lib} +#done