flame / blis

BLAS-like Library Instantiation Software Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

inconsistence between documentation and code for bli_?trmm3

jip opened this issue · comments

A documentation for bli_?trmm3 declares that A must be square and C can be rectangular.

But bli_l3_check.c checks C for square:

e_val = bli_check_square_object( c );

Some tests:

Let alpha := beta := 1.0.

Test # 1: A is rectangular, C is square.

Let A be a 3x5 matrix:

2 9 1 5 0
2 2 7 3 8
3 1 3 8 5

Let B be a 5x3 matrix:

9 2 4
9 3 8
2 8 0
4 3 9
6 3 1

Let C be a 3x3 matrix:

8 2 6
8 1 2
5 9 4

Then the correct answer would be:

129   2   6
118 100   2
109  81 101

Result of gemmlnn:

129   2   6
118 100   2
109  81 101

Result of dgemmlnn:

129   2   6
118 100   2
109  81 101

Result of zgemmlnn:

129   2   6
118 100   2
109  81 101

So, it works with rectangular A, this contradicts documentation.

Test # 2: A is square, C is rectangular.

Let A be a 5x5 matrix:

0 5 0 9 9
5 9 3 7 8
6 8 4 9 1
7 7 3 7 2
7 5 7 3 6

Let B be a 5x4 matrix:

3 4 7 5
9 0 1 2
0 0 4 5
4 6 5 9
8 9 2 3

Let C be a 5x4 matrix:

4 4 3 8
2 9 7 5
0 7 8 8
8 6 6 9
0 7 9 7

Then the correct answer would be:

157   4   3   8
190 143   7   5
134  94 121   8
136  94 113 142
126 107 118 132

Result of gemmlnn:

libblis: frame/3/bli_l3_check.c (line 84):
libblis: Expected square object.
libblis: Aborting.
./jconsole.sh: line 6:  5834 Core dumped

Result of dgemmlnn:

157   4   3   8
190 143   7   5
134  94 121   8
136  94 113 142
  0   7   9   7

Result of zgemmlnn

157   4   3   8
190 143   7   5
134  94 121   8
136  94 113 142
  0   7   9   7

So, the result is incorrect.

@jip can you please send a minimal working example of the failure in test # 2? Also, what is gemmlnn? If the call goes through bli_trmm3 then it should perform checks via bli_trmm3_check which only checks that A is square, rather than bli_gemmt_check which is where your error occurs (line 84).

Also, which version of BLIS are you using (release or git commit ID)?

Yeah, I don't see where the problem would be in master.

@devinamatthews and @fgvanzee I'm sorry for the noise, you are right: I messed up bli_gemmt with bli_trmm3. gemmlnn is my wrapper for bli_gemmt on another language using lower C triangle and non-transposed A and B.

Just for the record: my libblis.so.4.0.0 has version 0.9.0-91 and was build for haswell 2023-03-20.