<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Florian (+cfe-dev for visibilty),</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I was playing a little bit with Clang matrix language extension and and wanted to check with you to see if I am not missing something about the matrix type conversion. The draft spec says:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"A value of matrix type can be converted to another matrix type if the number of rows and columns are the same and the value’s elements can be converted to the element type of the result type. "</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I have tried a different variants of this:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
    typedef char m2x8_t __attribute__((matrix_type(2, 8)));
<div>    typedef char m8x2_t __attribute__((matrix_type(8, 2)));</div>
<div>    typedef char m2x2_char_t __attribute__((matrix_type(2, 2)));</div>
<div>    typedef int  m2x2_int_t  __attribute__((matrix_type(2, 2)));</div>
<div><br>
</div>
<div>    m2x2_int_t f(m2x8_t a, m8x2_t b) {</div>
<div>      return static_cast<m2x2_int_t>(a *b);</div>
<div>    }</div>
<div><br>
</div>
<div>but am getting errors that this conversion is not allowed. Unless I am doing something very silly here, I am guessing that this because the matrix extension is work in progress?</div>
<div><br>
</div>
<div>The draft spec also says that implicit conversions don't apply, but that would perhaps be convenient? But I haven't given this any thoughts yet though if that could be problematic.</div>
<div><br>
</div>
<div>Moving on a bit to lowering this to te matrix multiply intrinsics. I think it would be convenient if the matrix multiply can accumulate in a wider type (because that's what some instructions do). While there are probably different approaches possible,
 the llvm intrinsic has the vector type for the return value and its arguments:</div>
<div>
<pre style="overflow: auto hidden; font-family: Consolas, "Deja Vu Sans Mono", "Bitstream Vera Sans Mono", monospace; font-size: 0.95em; line-height: 15.96px; padding: 0.5em; border: 1px solid rgb(204, 204, 204); background-color: rgb(248, 248, 248); text-align: left"><span class="n">vectorty</span> <span class="nd" style="color: rgb(85, 85, 85); font-weight: bold">@llvm</span><span class="o" style="color: rgb(102, 102, 102)">.</span><span class="n">matrix</span><span class="o" style="color: rgb(102, 102, 102)">.</span><span class="n">multiply</span><span class="o" style="color: rgb(102, 102, 102)">.*</span><span class="p">(</span><span class="n">vectorty</span> <span class="o" style="color: rgb(102, 102, 102)">%</span><span class="n">A</span><span class="p">,</span> <span class="n">vectorty</span> <span class="o" style="color: rgb(102, 102, 102)">%</span><span class="n">B</span><span class="p">, ...)</span></pre>
 So perhaps we can relax this?</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Sjoerd.</div>
</div>
</body>
</html>