Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/csrc/quadblas_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ qblas_gemv(char layout, char trans, size_t m, size_t n,
Sleef_quad *beta, Sleef_quad *y, size_t incy)
{
if (m == 0 || n == 0) {
int do_trans = (trans == 'T' || trans == 't' || trans == 'C' || trans == 'c');
size_t y_len = do_trans ? n : m;
if (y_len == 0) {
return 0;
}
if (!y || !beta) {
return -1;
}
Sleef_quad zero = Sleef_cast_from_doubleq1(0.0);
int beta_zero = Sleef_icmpeqq1(*beta, zero);
for (size_t i = 0; i < y_len; i++) {
y[i * incy] = beta_zero ? zero : Sleef_mulq1_u05(*beta, y[i * incy]);
}
return 0;
}
Comment thread
SwayamInSync marked this conversation as resolved.
if (!alpha || !A || !x || !beta || !y) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You already checked !beta above so might as well delete that here

Expand All @@ -66,7 +79,7 @@ qblas_gemm(char layout, char transa, char transb,
Sleef_quad *B, size_t ldb,
Sleef_quad *beta, Sleef_quad *C, size_t ldc)
{
if (m == 0 || n == 0 || k == 0) {
if (m == 0 || n == 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude says that no tests hit this code change. You could add a test that does np.matmul(a, b) where the contracted dimension is zero to hit this.

return 0;
}
if (!alpha || !A || !B || !beta || !C) {
Expand Down
Loading
Loading