Question: Performance implications when using tensors [N, C, 1, 1] vs [N, C] #1703
Replies: 4 comments
-
Some details when looking at the code:
Thus we will have the two following kernels:
I don't expect a lot of performance differences for one single run but that's just a guess without data to support it. comments that explain the naming of the tensor axis (in case of it was not clear): For 4D: For 5D: |
Beta Was this translation helpful? Give feedback.
-
The reason I have my question is that MIOpen has different code paths for tensors with different number of dimensions. So I wanted to clarify whether it makes sense to create tensor descriptors for the exact number of the given dimensions or I could just generalize the logic to always use a 4D tensor. Apparently, it works from functional perspective but I'm worrying about performance. |
Beta Was this translation helpful? Give feedback.
-
For better performance I recommend using the former approach for now. AFAIU the singular dimensions (those of size 1) can be relatively easily "collapsed into nothing" so the library would automatically switch from 4D to 3D tensors, for example. But this kind of optimization has not yet been designed/implemented. Please let us know if you would like this optimization to be implemented (and indicate how urgent/important is this for you). |
Beta Was this translation helpful? Give feedback.
-
That was mostly a general question about possible approaches. Thanks for clarifying this. |
Beta Was this translation helpful? Give feedback.
-
Suppose I want to perform
miopenOpTensor
operation for a 2D tensor. What are the performance implications whenmiopenOpTensor
is used for a tensor[N, C, 1, 1]
vs[N, C]
? I found that there are different code paths for tensors with different number of dimensions, for example[N, C, 1, 1]
case will go to the code path underUSE_4D_TENSOR_GENERIC
.Beta Was this translation helpful? Give feedback.
All reactions