Document issue of CLGEMMInterleave4x4Kernel
In CLGEMMInterleave4x4Kernel, it says after this operation, the matrix shape will be changed to [ height *4, width/4] (see copied code). Is this really correct? What happens to a [10(h) x 6(w)] matrix?
void CLGEMMInterleave4x4Kernel::run(const Window &window, cl::CommandQueue &queue) { ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICLKernel::window(), window);
/*
* This kernel puts the values in a 4x4 block of Matrix A on the same row (Interleaved values)
* |a00 a01 a02 a03|
* |a10 a11 a12 a13|
* |a20 a21 a22 a23| = | a00 a10 a20 a30 || a01 a11 a21 a31 || a02 a12 a22 a32 || a03 a13 a23 a33 |
* |a30 a31 a32 a33|
*
* After this operation, the output matrix will have the following shape: [ height * 4, width / 4 ]
*/
Hi @waynehong666 , It is correct, meaning the output tensor will have a different shape. Let's consider your example, a [10 x 6] matrix. In this case width = 10, height = 6
The output matrix should have the following shape [ height * 4, width / 4 ]
but as your example wants to point out 10/4 is not an integer number. In fact we are taking the ceil of that value or in formula: [ height * 4, ceil(width / 4) ]
The result of ceil(10/4) = 3 and 6*4=24 So the output tensor shape will be [ 24, 3 ]
Hope it helps Thanks Manuel
PS: From the next release CLGEMMInterleave4x4Kernel will be deprecated, so you might want to check CLGEMMReshape operators which should substitute CLGEMMInterleave4x4Kernel.
Hi Manuel, Thanks for the clarification. Still confused about these in GEMM. Let's say I have a 6x10 (row=6, col=10) matrix A, whose shape is [h=6, w=10]. After applying Interleave4x4Kernel, it has a new shape [24, 3] as you said. For a 10x6(row=10, col=6) matrix B, whose shape is [h=10, w=6]. After applying Transpose1xWKernel, it has a new shape [40, 2]. I am not sure how it is working in matrix multiplication.
Best, Wayne
In ACL we refer to the first dimension as width and second as height. In mathematics matrix notation it is the opposite. I guess the confusion comes from there.
So in ACL: A matrix 10 x 6 has width = 10 and height = 6, so col =10 and row = 6 A matrix 6 x 10 has width = 6 and height = 10, so col = 6 and row = 10
Thanks, Manuel