[llvm-dev] [cfe-dev] RFC: First-class Matrix type

Adam Nemet via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 11 15:12:26 PDT 2018


> On Oct 11, 2018, at 7:56 AM, David Greene <dag at cray.com> wrote:
> 
> Adam Nemet via cfe-dev <cfe-dev at lists.llvm.org> writes:
> 
>>    %0 = load <4 x 4 x float>, <4 x 4 x float>* %a, align 16
>>    %1 = load <4 x 4 x float>, <4 x 4 x float>* %b, align 16
>>    %2 = call <4 x 4 x float>
>>    @llvm.matrix.multiply.m4_4f32.m4_4f32.m4_4f32(<4 x 4 x float> %0,
>>    <4 x 4 x float> %1)
>>    store <4 x 4 x float> %2, <4 x 4 x float>* %c, align 16
> 
> This sounds very interesting.  Would it make sense to later expand the
> idea to allow an arbitrary number of dimensions?  Maybe that doesn't
> make sense if we're restricted to statically-known dimensions.

Yes, that matches my current feeling too.  

> How would this relate to scalable vectors?

Scalable vectors would be a possible of lowering of the matrix type.  I *believe* you'd need go generate loops or at least some conditional code at run time due to the unknown scale factor.  

> Most of the time matrix dimensions are not known statically.  Would <n x m x float> be possible?

No, we only support statically-known dimensions.

> Do you have a prototype of this?

Yes.  I can make it available it there is interest.

Adam

> 
>                       -David



More information about the llvm-dev mailing list