flame / blis

BLAS-like Library Instantiation Software Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

typo in edge case handler

moon-chilled opened this issue · comments

In bli_edge_case_defs.h:50:

	PASTEMAC(ch,ctype)           _ct[ BLIS_STACK_BUF_MAX_SIZE / sizeof( PASTEMAC(ch,type) ) ] \

I think it should be sizeof( PASTEMAC(ch,ctype) ) (note ctype, not type).

@moon-chilled I have no idea how this issue went un-addressed by one of us for this long. Please accept my apologies. I'm looking into this now.

@devinamatthews This is bad. I'm not sure if it's causing us any issues, but it's a buffer overrun waiting to happen.

The problem is that GEMM_UKR_SETUP_CT_PRE uses sizeof( PASTEMAC(ch,type) ).

Presumably, you intended this to evaluate to expressions such as sizeof( double ). But the bli_dtype macro is defined as BLIS_DOUBLE. I'm guessing sizeof() an enum value will be equivalent to sizeof( int ), which will be too small in all cases except for the s/float case.

I now realize that because the malformed expression is in the denominator, it means we're getting too many elements, not too few. Whew.

@moon-chilled I've applied your fix. Please re-open this issue if you have any further related concerns. Thanks again for your feedback.