blis icon indicating copy to clipboard operation
blis copied to clipboard

*omatcopy_ct input parameter checking

Open markbmuller opened this issue 2 years ago • 9 comments

When using a downloaded AMD precompilled blis library and calling domatcopy to perform a transpose copy, I have received the following error message:

libblis: /home/amd/jenkins/workspace/AOCL_Month_Release_Package/blis/frame/compat/bla_omatcopy.c (line 536): libblis: Invalid function parameter in bli_doMatCopy_ct() .

Upon downloading and compiling BLIS commit 3aa004442781d703c46b39cb0b9c166451f55902, I get the same behavior. In bli_doMatCopy_ct, it checks the input on line 534 with:

if ( rows <= 0 || cols <= 0 || a == NULL || b == NULL || lda < rows || ldb < rows )

Since it is applying a transpose to b, it should be comparing ldb with cols, not rows. This in the routine bli_doMatCopy_ct. There is the same issue with bli_soMatCopy_ct, bli_coMatCopy_ct, and bli_zoMatCopy_ct.

markbmuller avatar Jul 07 '22 22:07 markbmuller

I think I also encountered this problem on AOCL-BLAS 4.2. Perhaps issues has been disabled by amd/blis, so posting my workaround here.

Minimal reproduction code could be

/* problem.cpp */
#include "blis.h"

int main() {
    char trans = 'T';
    double alpha = 1;
    int n = 20, lda = 20;
    int m = 10, ldb = 10;  /* m = ldb smaller than n = lda could reproduce this issue */
    double *A = (double *) malloc(sizeof(double) * m * n);
    double *B = (double *) malloc(sizeof(double) * m * n);
    domatcopy(&trans, &n, &m, &alpha, A, &lda, B, &ldb);
    free(A); free(B);
}

and simply compile by

$ g++ -o problem problem.cpp -I$HOME/aocl/4.2.0/aocc/include -L$HOME/aocl/4.2.0/aocc/lib -lblis

ajz34 avatar Feb 29 '24 15:02 ajz34

This is not an AMD support channel. Please only report bugs against the BLIS project that's in this repo. If you can reproduce AMD BLIS bugs with this repo, by all means report them. Otherwise, take your issues to AMD.

jeffhammond avatar Feb 29 '24 19:02 jeffhammond

I would have phrased it nicer but yes, the code in question is not currently in the FLAME BLIS repo. It is part of #567 which has not been merged at this point. I'm going to keep this open in case we do merge that PR.

devinamatthews avatar Feb 29 '24 20:02 devinamatthews

@markbmuller, @ajz34 - you can post the issue at https://github.com/amd/blis . Thanks for reporting, will look into this issue.

kvaragan avatar Mar 01 '24 05:03 kvaragan

Issues Tab is currently disabled in amd/blis. Regarding the issues related to AMD BLIS Repo, please write to [email protected]. Thanks.

sireeshasanga avatar Mar 01 '24 06:03 sireeshasanga

Thanks for suggestions! I've tried managed writing to [email protected].

Some chats follows. Actually, I searched this problem on search engines, and found this is (probably) the only related thread discussing this issue. Just moments ago I also tried to put this issue on AMD community, but found that posting some source code (or resubmitting draft within 10 minutes) could be difficult task. So finally chose to email.

ajz34 avatar Mar 01 '24 07:03 ajz34