Skip to content

Conversation

@ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Nov 10, 2025

Closes #1716

It seems like I this one is on me. I removed the else branch in 709f745 and we didn't have any test that failed.

These functions are not trivial to setup correctly. This is like the 3rd or 4th bug I remember fixing (and apparently causing) and we still have #1262

@ricardoV94 ricardoV94 added bug Something isn't working C-backend labels Nov 10, 2025
@ricardoV94 ricardoV94 requested a review from aseyboldt November 10, 2025 21:41
@ricardoV94 ricardoV94 changed the title Fix 0-sized CGemV with beta == 0 Fix 0-sized CGemV with unitialized memory Nov 10, 2025
@ricardoV94 ricardoV94 removed the request for review from aseyboldt November 10, 2025 21:46
} else
{
// Empty A matrix, just scale y by beta
if (dbeta != 1.0)
Copy link
Member

Choose a reason for hiding this comment

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

Why not if dbeta == 1?

Copy link
Member Author

@ricardoV94 ricardoV94 Nov 11, 2025

Choose a reason for hiding this comment

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

then you get the initial y. We don't create gemv with uninitialized y when dbeta!=0

That would show up in y = y * beta + A @ x * alpha. You get whatever the user y was. Multiplying by 1 wouldn't change it

Copy link
Member Author

@ricardoV94 ricardoV94 Nov 11, 2025

Choose a reason for hiding this comment

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

Or I may have missed the motivation for your question. This is an eager optimization the theano guys had, do you think it's silly?

Copy link
Member

Choose a reason for hiding this comment

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

Ah of course. 🤦
Looks good to me, except for the test failure then.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's just the unrelated torch module or did miss another?

Copy link
Member

Choose a reason for hiding this comment

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

I think it's just that

@ricardoV94 ricardoV94 merged commit ee56826 into pymc-devs:main Nov 11, 2025
54 of 56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working C-backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CGemv returns uninitialized memory with zero-length vectors

2 participants