Skip to content

WIP: Handle defective implementations of float functions. #68

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mmuetzel
Copy link
Contributor

@mmuetzel mmuetzel commented Feb 5, 2025

This is a very crude attempt to check whether BLAS functions that should return single-precision floating point values actually do that.
Some implementations (like Apple Accelerate) don't do that. See #65.

This is mainly meant for early feedback. (I didn't even check if this compiles.)

@grisuthedragon
Copy link
Member

If the check works this sounds right, but this is only half of the truth. Behaving like the accelerate framework needs to change the return type of the flexiblas function as well.

This is a very crude attempt to check whether BLAS functions that should
return single-precision floating point values actually do that.
Some implementations (like Apple Accelerate) don't do that. See mpimd-csc#65.

This is mainly meant for early feedback.
@mmuetzel
Copy link
Contributor Author

mmuetzel commented Feb 6, 2025

I fixed a couple of issues with the test for the behavior of SDOT and force pushed this PR with those changes.
Thanks @grisuthedragon for the hint in private email.

Comment on lines +223 to +230
if (intel_interface) {
#ifdef FLEXIBLAS_INTEGER8
void (*sdot)(float *, int64_t *, float *, int64_t *, float *, int64_t *);
#else
void (*sdot)(float *, int32_t *, float *, int32_t *, float *, int32_t *);
#endif

sdot(&retval, &n, x, &one, y, &one);
Copy link

Choose a reason for hiding this comment

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

if (intel_interface) this could just return 0, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know how many implementations of BLAS/LAPACK could potentially have this defect. The only one I know for sure is Apple Accelerate (that doesn't use the Intel calling convention afaict).

I figured that the safest would be to check in any case. But if you feel confident that no implementation that uses the Intel calling convention could potentially be affected, you could remove the test from that branch.

Copy link

Choose a reason for hiding this comment

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

I see. Thanks for the explanation!

@mmuetzel
Copy link
Contributor Author

mmuetzel commented Feb 6, 2025

@dasergatskov confirmed that the test as it is currently implemented in this PR would detect the defect in Apple Accelerate:
https://octave.discourse.group/t/macos-accelerate-framework-single-precision-issue/6140/30

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

Successfully merging this pull request may close these issues.

3 participants