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

Add data type reorder for DNNL OP #1

Merged
merged 3 commits into from
May 11, 2020
Merged

Conversation

EikanWang
Copy link
Contributor

No description provided.

@EikanWang
Copy link
Contributor Author

@pinzhenx @jiayisunx , @hongzhen1, could you help review on the reorder code for BF16?

/**
* Reorder the input tensor to the specified scalar type. It is an optimized version for
* DNNL OP. It means that if DNNL supports current OP, you should call this API. Otherwise, you
* should call @sa @ref reorderTensorToScalaraType
Copy link
Contributor

Choose a reason for hiding this comment

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

@sa @ref ??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doxygen semantic. "sa" means "see", "ref" means a link.


void reorderTensorToScalarTypeForDNNL(const at::Tensor& ipexTensor, at::ScalarType dstScalarType) {
if (ipexTensor.device().type() == at::DeviceType::CPU) {
return reorderTensorToScalaraType(ipexTensor, dstScalarType);
Copy link
Contributor

Choose a reason for hiding this comment

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

this branch handles the conversion before OP returns?
if so, can use last branch (w/o shade) to handle this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The API is used before the dispatch to DNNL op. reorderTensorToScalarTypeForDNNL => Dispatch to DNNL.

Copy link
Contributor

Choose a reason for hiding this comment

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

if this API is called at the beginning of OPs, Is there any chance the device will be CPU?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. "to" should be the case. CPU tensor converts to IPEX tensor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, misunderstood your comment point. I will fix it.

return;

if (check_data_is_part_of_storage(ipexTensor))
if (!check_tensor_own_whole_storage(ipexTensor))
Copy link
Contributor

Choose a reason for hiding this comment

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

where is the gatekeeper for this branch?

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 will refine it. I intend not to support the case if the tensor data is just a part of its storage.

@EikanWang EikanWang merged commit de92da8 into intel:master May 11, 2020
zhuhaozhe added a commit to zhuhaozhe/intel-extension-for-pytorch that referenced this pull request Apr 23, 2021
enable automix bf16 interaction, emb fw
@liangan1 liangan1 mentioned this pull request Mar 28, 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.

2 participants