Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we use Panama Vector API for quantizing vectors? #13922

Open
benwtrent opened this issue Oct 16, 2024 · 0 comments
Open

Can we use Panama Vector API for quantizing vectors? #13922

benwtrent opened this issue Oct 16, 2024 · 0 comments

Comments

@benwtrent
Copy link
Member

Description

It would take a bit of refactoring, but:

    float dx = v - minQuantile;
    float dxc = Math.max(minQuantile, Math.min(maxQuantile, v)) - minQuantile;
    float dxs = scale * dxc;
    float dxq = Math.round(dxs) * alpha;
    if (dest != null) {
      dest[destIndex] = (byte) Math.round(dxs);
    }
    return minQuantile * (v - minQuantile / 2.0F) + (dx - dxq) * dxq;

All these actions seem like they could be done lane-wise. Though, I expect the transformation from FloatVector to byte[] array to be the most expensive part and consequently, might make vectorizing this effectively impossible.

of course, much of the stuff here written for value reuse would have to be adjusted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant