[PATCH] D70456: [Matrix] Add first set of matrix intrinsics and initial lowering pass.

LuoYuanke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 27 19:29:52 PST 2019


LuoYuanke added a comment.



> I'm currently preparing the patches on the clang side in addition to an update to cfe-dev. Please stay tuned and we would really appreciate any feedback there.
> 
>   In the original RFC, we sketched the C/C++ support we envisioned using builtins. A simple example that loads two 4x4 matrixes, multiplies them, adds a third matrix to the result and stores the it can be found in the code below. Our initial proposal is quite stripped down and intended to be exposed to end users via something like a C++ matrix wrapper class.
>    
>    
> 
>   typedef float m4x4_t __attribute__((matrix_type(4, 4)));
>    
>    
>   void f(m4x4_t *a, m4x4_t *b, m4x4_t *c, m4x4_t *r) {
>     *r = __builtin_matrix_add(__builtin_matrix_multiply(*a, *b), *c);
>   }

Thanks for the example. I think most of time the dimension of the matrix is unknown in compile time. How do we write the below code with static dimension matrix type?

  // Let's assume  0 < m, k, n <= 4. 
  void matrix_multipy(float *a, float *b, int m, int k, int n) {
  // ???
  }

Do you plan to support dynamic matrix type like array?

  typedef float mmxk_t __attribute__((matrix_type(m, k)));
  typedef float mkxn_t __attribute__((matrix_type(k, n)));


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70456/new/

https://reviews.llvm.org/D70456





More information about the llvm-commits mailing list