Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Fix GetMKLDNNData for delay alloc (#16618)
Browse files Browse the repository at this point in the history
* Fix GetMKLDNNData for delay alloc

* Run CI

* Run CI

* Run CI

* Run CI

* Run CI

Change-Id: I7ac2796e0ee8439c92fd2bd7a70a23a359b76b12
  • Loading branch information
ZhennanQin authored and pengzhao-intel committed Oct 28, 2019
1 parent ffc5392 commit 11dff51
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ndarray/ndarray.cc
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ const mkldnn::memory *NDArray::GetMKLDNNData() const {
// If this is a view, we can't create a MKLDNN memory for the chunk
// because we don't have the complete data type and shape information for
// the chunk.
CheckAndAlloc();
void *off_addr = static_cast<char *>(ptr_->shandle.dptr) + byte_offset_;
// Create the primitive desc for the new mkldnn memory.
mkldnn::memory::dims dims(shape().ndim());
Expand All @@ -665,6 +666,7 @@ const mkldnn::memory *NDArray::GetMKLDNNData() const {
} else {
// If this isn't a view, we can create a MKLDNN memory and store it in the
// chunk.
CheckAndAlloc();
ptr_->SetMKLMem(shape_, dtype_);
MKLDNNStream::Get()->RegisterMem(ptr_->mkl_mem_->GetMem());
return ptr_->mkl_mem_->GetRaw();
Expand Down

0 comments on commit 11dff51

Please sign in to comment.