oneDNN icon indicating copy to clipboard operation
oneDNN copied to clipboard

`dnnl::memory::desc::get_size()` returns 0 for submemory with non-zero offset

Open StrongerXi opened this issue 3 years ago • 2 comments

The root cause seems to be this commit.

Is there any reason why this is the behavior? It came as a surprise to me because it wasn't specified in the public API.

cc: @jacobkahn

StrongerXi avatar Jul 27 '22 22:07 StrongerXi

Hi @StrongerXi, the reason is that submemory_desc in general case doesn't provide full information on how much memory to provide for the end user. Thus, it provides nothing. Thank you.

dzarukin avatar Jul 27 '22 22:07 dzarukin

I see. Would you mind providing a quick example of such submemory_desc?

I can easily simulate get_size on my end, but I'm also using submemory_desc for tensor indexing (and eventually, in reorder primitive during indexed assignments) so I just want to make sure it's actually safe.

StrongerXi avatar Jul 27 '22 22:07 StrongerXi