title: TensorFlow and oneDNN
body: <p>After installing <code>tensorflow==2.9.1</code> and running it for the first time I got the following message:</p>
  <pre class="lang-py prettyprint-override"><code>2022-08-19 11:51:23.381523: I tensorflow/core/platform/cpu_feature_guard.cc:193] 
  This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) 
  to use the following CPU instructions in performance-critical operations:  
  AVX2 AVX512F AVX512_VNNI FMA
  To enable them in other operations, rebuild TensorFlow with the appropriate 
  compiler flags.
  </code></pre>
  <p>This message is a bit confusing. At a first glance, it seems like a bad thing. But if you read it carefully, you realize it's actually a good thing. It's using all those nice extensions in &quot;<em>performance-critical operations</em>&quot;. But then the last sentence makes it sound not so good, because they are not enabled in &quot;<em>other operations</em>&quot; (whatever they are).</p>
  <hr />
  <p>Searching the above message on the interwebs I came across <a href="https://www.intel.com/content/www/us/en/developer/articles/guide/optimization-for-tensorflow-installation-guide.html" rel="nofollow noreferrer">Intel® Optimization for TensorFlow* Installation Guide</a> which said:</p>
  <blockquote>
  <p>If your machine has AVX512 instruction set supported please use the below packages for better performance.</p>
  <p>pip install intel-tensorflow-avx512==2.9.1 # linux only</p>
  </blockquote>
  <p>Since my box supports AVX512, I've installed <code>intel-tensorflow-avx512==2.9.1</code> and now got this message:</p>
  <pre class="lang-py prettyprint-override"><code>2022-08-19 11:43:00.187298: I tensorflow/core/platform/cpu_feature_guard.cc:193] 
  This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) 
  to use the following CPU instructions in performance-critical operations:  
  AVX512_VNNI
  To enable them in other operations, rebuild TensorFlow with the appropriate 
  compiler flags.
  </code></pre>
  <p>Hmm...</p>
  <hr />
  <p>So, my questions are:</p>
  <ol>
  <li><p>Since Intel &quot;optimized&quot; version of TensorFlow only &quot;complains&quot; of using AVX512_VNNI in &quot;<em>performance-critical sections</em>&quot;, does that mean it's using AVX2, AVX512F and FMA everywhere, including all &quot;<em>other operations</em>&quot;? Or does it mean it's not using them at all?</p>
  </li>
  <li><p>If it's not using them at all, does it mean it's &quot;inferior&quot; to the official version of TensorFlow and there is no point in using it?</p>
  </li>
  <li><p>BONUS QUESTION: Why are those cool AVX2/512F/512_VNNI and FMA instructions only enabled in &quot;<em>performance-critical sections</em>&quot; and not for all &quot;<em>other operations</em>&quot;?</p>
  </li>
  </ol>