I know that vertex attribute locations are always 4-component, but i am not entirely sure that it applies to mat2(and other mat2 types) as well.
I know that vertex attribute locations are always 4-component, but i am not entirely sure that it applies to mat2(and other mat2 types) as well.
It depends on what you mean by "without any problems".
Yes, mat2 is a valid type for a vertex attribute. However, when used as attributes, all matrix types are treated as arrays of the columns of the matrix. And arrays are treated such that each array element is a separate attribute.
So a mat2 counts as two attributes, not one (specifically the first two components of each attribute). If that's not a problem for you, then you may do that.
If you want to stuff a mat2 into one attribute, then you have to do it manually:
layout(location = X) in vec4 matrix_attrib;
...
void main()
{
mat4 mAttrib(matrix_attrib.xy, matrix_attrib.zw);
}