Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat]support Mac m1 devices #214

Merged
merged 1 commit into from
Feb 12, 2022
Merged

[feat]support Mac m1 devices #214

merged 1 commit into from
Feb 12, 2022

Conversation

poinwater
Copy link
Contributor

@poinwater poinwater commented Jan 29, 2022

Description

Support Apple silicon devices:

  • Added making wheel bash script for macOS with arm64 architecture.
  • Added TODOs in CI.
  • Added a shared check_platform package to check devices' platform information.
  • Added extra method in configure.py file so that it can validate macOS arm64's Bazel version.
  • Added exception handler for value with float16 dtype.

Type of change

  • Bug fix
  • New Tutorial
  • Updated or additional documentation
  • Additional Testing
  • New Feature

Checklist:

  • I've properly formatted my code according to the guidelines
    • By running yapf
    • By running clang-format
  • This PR addresses an already submitted issue for TensorFlow Recommenders-Addons
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

How Has This Been Tested?

The script has been tested manually in a blank virtual environment. The environment is as following:
OS: macOS Monterey 12.0.1
Python: 3.9.2
Tensorflow-macos 2.5.0
Bazel: 3.7.2/ 4.1.0 / 5.0.0

  1. Complied TFRA was tested using test scripts in the kernel_test folder.
  2. configure.py was tested manually with Bazel version 3.7.2, 4.1.0, 5.0.0.
  3. float16 exception handler was tested by dynamic_embedding_variable_test.py
  4. Modified dynamic_embeding_variable_test.py was tested by running once.

There is a known issue caused by float16.
All results using value dtype float16 don't match the expected results.
Thus, the dynamic_embeding_variable_test.py file has been updated to skip the testing value with float16 dtype if the platform is macOS arm64.
The operation file dynamic_embeding_variable.py also included an exception handler to raise an error if the value is float16 and platform is macOS arm64.

configure.py Show resolved Hide resolved
if is_macos() and is_arm64():
if key_dtype == dtypes.half or value_dtype == dtypes.half:
raise TypeError("""
Key or value dtype contains float16,
Copy link
Member

Choose a reason for hiding this comment

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

'Key or' is no needed.

Copy link
Member

Choose a reason for hiding this comment

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

"""
float16 value dtype is not supported on macOS with ARM64 architecture. Please try another type.
"""

@rhdong
Copy link
Member

rhdong commented Feb 10, 2022

LGTM

@rhdong rhdong merged commit 301ad5d into tensorflow:master Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants