Skip to content

[INTEL MKL] Enable back MKL auto_mixed_precision - #48286

Merged
copybara-service[bot] merged 2 commits into
tensorflow:masterfrom
Intel-tensorflow:mabuzain/enable-mkl-auto-mixed-precision
Apr 6, 2021
Merged

copybara-service[bot] merged 2 commits into
tensorflow:masterfrom
Intel-tensorflow:mabuzain/enable-mkl-auto-mixed-precision

Conversation

@mahmoud-abuzaina

Copy link
Copy Markdown
Contributor

This PR fixes an issue in the auto_mixed_precision_test and enables back MKL auto_mixed_precision in the single binary build.

@google-ml-butler google-ml-butler Bot added the size:S CL Change Size: Small label Apr 3, 2021
@google-cla google-cla Bot added the cla: yes label Apr 3, 2021
@gbaned gbaned self-assigned this Apr 5, 2021
@gbaned gbaned added the comp:grappler Grappler related issues label Apr 5, 2021
@gbaned
gbaned requested a review from ezhulenev April 5, 2021 07:10

@penpornk penpornk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix!

@google-ml-butler google-ml-butler Bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Apr 5, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Apr 5, 2021

@penpornk penpornk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please help fix the MacOS CPU Python3 failures? Thank you!

ImportError: Traceback (most recent call last):
  File "/Volumes/BuildData/tmpfs/tmp/bazel/execroot/org_tensorflow/bazel-out/darwin-opt/bin/tensorflow/lite/python/convert_test.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: dlopen(/Volumes/BuildData/tmpfs/tmp/bazel/execroot/org_tensorflow/bazel-out/darwin-opt/bin/tensorflow/lite/python/convert_test.runfiles/org_tensorflow/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: __ZN10tensorflow12IsMKLEnabledEv
  Referenced from: /Volumes/BuildData/tmpfs/tmp/bazel/execroot/org_tensorflow/bazel-out/darwin-opt/bin/tensorflow/python/../libtensorflow_framework.2.dylib
  Expected in: flat namespace
 in /Volumes/BuildData/tmpfs/tmp/bazel/execroot/org_tensorflow/bazel-out/darwin-opt/bin/tensorflow/python/../libtensorflow_framework.2.dylib

@google-ml-butler google-ml-butler Bot removed the ready to pull PR ready for merge process label Apr 6, 2021

@penpornk penpornk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the quick fix!

@google-ml-butler google-ml-butler Bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Apr 6, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Apr 6, 2021
@google-ml-butler google-ml-butler Bot added the kokoro:force-run Tests on submitted change label Apr 6, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Apr 6, 2021
@mahmoud-abuzaina

Copy link
Copy Markdown
Contributor Author

Thank you both for reviewing/approving the PR. This time the MacOS CPU Python3 error seems to be unrelated to the changes. Please let me know if I need to take a look.

@copybara-service
copybara-service Bot merged commit b2647cb into tensorflow:master Apr 6, 2021
copybara-service Bot pushed a commit that referenced this pull request Sep 18, 2026
…te-stride span

Imported from GitHub PR openxla/xla#48513

#ai-generated

I found this while reviewing the recently landed #46604 byte-stride overflow fix and verified the remaining accumulation wrap against the current XLA tree with an in-tree Bazel regression test.

`FromZerothElementPointer` already rejects a `stride * (dim - 1)` product that overflows `int64`. Adding those products into a `uint64_t` without an overflow check still wraps:

```text
shape   = [2, 2, 2]
strides = [INT64_MAX, INT64_MAX, 2]
dtype   = u8
accepted region size = 1
```

A second case, `strides = [INT64_MAX, INT64_MAX, 1]`, accumulates to `UINT64_MAX` and only overflows on the final `+ dtype-size` add.

This change checks `__builtin_add_overflow` on the running sum and on the final add. Tests: `ByteStrideAccumOverflowUint64`, `ByteStrideFinalSizeOverflowUint64`, plus compact `u8` `[2,2,2]` success cases. Compact-layout `byte_size * shape.num_elements()` is not changed (#48286).

```text
bazel test //xla/python/ifrt_proxy/common:array_util_test
```

**PASSED**, 42/42, including `ByteStrideAccumOverflowUint64` and `ByteStrideFinalSizeOverflowUint64`.

Copybara import of the project:

--
4116a8f9c0eda07ba8b6d1ffe36ba22bc9541045 by roopd3v <[email protected]>:

Fix uint64 accumulation overflow in IFRT ArrayMemRegion byte-stride span.

The per-term stride*(dim-1) multiply is already checked. Adding those
products into a uint64_t without an overflow check still wraps, so a
client-supplied stride vector such as [INT64_MAX, INT64_MAX, 2] with
shape [2, 2, 2] is accepted as a 1-byte region. Check the running sum
and the final + dtype-size add. Tests cover both the accumulation wrap
and the final add (INT64_MAX + INT64_MAX + 1 == UINT64_MAX).

Merging this change closes #48513

PiperOrigin-RevId: 983915659
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes comp:grappler Grappler related issues ready to pull PR ready for merge process size:S CL Change Size: Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants