Skip to content

Add cpu accelerator fp16 dtype support #7207

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Yejing-Lai
Copy link
Contributor

Add cpu accelerator fp16 dtype support

@loadams loadams enabled auto-merge April 8, 2025 16:04
@@ -232,7 +232,7 @@ def is_fp16_supported(self):
return False

def supported_dtypes(self):
return [torch.float, torch.bfloat16]
return [torch.float, torch.bfloat16, torch.float16]
Copy link
Collaborator

@loadams loadams Apr 8, 2025

Choose a reason for hiding this comment

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

@Yejing-Lai - perhaps this is the runner, but the default we have here does not have torch.float16 support (see unit test errors).

I think this may come back to the discussions we've had before on splitting the cpu accelerator into a cpu accelerator (generic cpu) and a xeon accelerator (PR here: #5126 )?

Copy link
Contributor

Choose a reason for hiding this comment

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

@loadams, good point.

@Yejing-Lai, are you specifically targetting xeon with this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I test this PR on xeon and it works fine. We will discuss determining the datatype list based on the CPU flags. Please pending this PR temporarily, thanks~

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is better to keep one CPU accelerator with different features. Xeon is not much different from perspective of Pytorch CPU support. Desktop or other non-Xeon CPU might also get fp16 support if they implemented proper instruction set and get supported in Pytorch. So it should be reasonable to have one CPU accelerator instead of seperate xeon accelerator.

@delock
Copy link
Collaborator

delock commented Apr 14, 2025

I think a proper way is to detect whether the CPU+PyTorch has ability to support FP16 datatype, this might be more resilient. @Yejing-Lai is there a way to detect whether PyTorch support fp16 on CPU or not, from Intel Extention for PyTorch team feedback?

auto-merge was automatically disabled April 15, 2025 03:21

Head branch was pushed to by a user without write access

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.

4 participants