Skip to content
This repository was archived by the owner on Mar 30, 2026. It is now read-only.

Add data type reorder for DNNL OP#1

Merged
EikanWang merged 3 commits into
intel:masterfrom
EikanWang:master
May 11, 2020
Merged

Add data type reorder for DNNL OP#1
EikanWang merged 3 commits into
intel:masterfrom
EikanWang:master

Conversation

@EikanWang
Copy link
Copy Markdown
Contributor

No description provided.

@EikanWang
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread torch_ipex/csrc/aten_ipex_bridge.cpp Outdated

void reorderTensorToScalarTypeForDNNL(const at::Tensor& ipexTensor, at::ScalarType dstScalarType) {
if (ipexTensor.device().type() == at::DeviceType::CPU) {
return reorderTensorToScalaraType(ipexTensor, dstScalarType);
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread torch_ipex/csrc/aten_ipex_bridge.cpp Outdated
return;

if (check_data_is_part_of_storage(ipexTensor))
if (!check_tensor_own_whole_storage(ipexTensor))
Copy link
Copy Markdown
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
Copy Markdown
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants