Skip to content

Add tests for fma #953

Open
NeKon69 wants to merge 13 commits intollvm:mainfrom
NeKon69:fma-scalar-vector-matrix-tests
Open

Add tests for fma #953
NeKon69 wants to merge 13 commits intollvm:mainfrom
NeKon69:fma-scalar-vector-matrix-tests

Conversation

@NeKon69
Copy link
Copy Markdown

@NeKon69 NeKon69 commented Mar 11, 2026

This PR adds double tests for fma function. Only double is applicable to this function as per official api

Closes #916
Related to llvm/llvm-project/#185304

Assisted-by: GPT-5.4 (opencode)

@farzonl farzonl added the test-all When applied to a PR this will opt-in to additional pre-merge test configurations.. label Mar 11, 2026
@NeKon69
Copy link
Copy Markdown
Author

NeKon69 commented Mar 12, 2026

Also some of the tests seem to fail because there isn't an fma function. Don't really know what to do with that

@farzonl
Copy link
Copy Markdown
Member

farzonl commented Mar 12, 2026

Also some of the tests seem to fail because there isn't an fma function. Don't really know what to do with that

Sorry will do a review of this in the morning. But yeah xfail for clang for now

Copy link
Copy Markdown
Contributor

@kmpeng kmpeng left a comment

Choose a reason for hiding this comment

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

You should take [Matrix] out of the title since this PR is covering more than just the matrix tests.

@NeKon69 NeKon69 changed the title [Matrix] Add tests for fma Add tests for fma Mar 18, 2026
Copy link
Copy Markdown
Contributor

@kmpeng kmpeng left a comment

Choose a reason for hiding this comment

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

The structure of the tests lgtm, but I have some problems with the values being used. I'm also not very familiar with matrices, so I'll defer to other people for more feedback on those (@farzonl ?)

FYI a lot of the failing checks on this PR have been fixed recently. Could you update the branch so it's easier to see the ones this PR is affecting?

Stride: 32
Data: [ 0.25, -0.25, 10.4, -10.6,
1.5, -2.5, 0.5, -0.5,
0.0, 10.0, -10.0, 10.5 ]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you need to use more meaningful values in these tests. The purpose of fma is that it's more precise than just a*b+c - it only rounds once at the end of the operation while a*b+c rounds twice (once after multiply, once after add). Your current test values are mostly trivial (there's lots of x*1.0+0.0 identity operations) and all the values are exactly representable in fp64, so we're not testing any of the intermediate precision loss that matters with fma.

Having some simple tests is important, but I do think we need some more robust ones here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Do i need to do this for matrix too or only here is fine?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should get other people's opinions on this who are more familiar with matrices. But from my understanding, matrix tests in general are more about verifying dimensions/shapes, so they don't have to be as comprehensive as the scalar/vector ones

@NeKon69
Copy link
Copy Markdown
Author

NeKon69 commented Mar 24, 2026

Sorry was a little busy today, will get to this tomorrow

Copy link
Copy Markdown
Contributor

@kmpeng kmpeng left a comment

Choose a reason for hiding this comment

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

LGTM, but again you should probably get more feedback on the matrix test

@NeKon69
Copy link
Copy Markdown
Author

NeKon69 commented Mar 27, 2026

Could you maybe ping someone who is working with matrices then? I would be really grateful.

@kmpeng kmpeng requested a review from farzonl April 6, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test-all When applied to a PR this will opt-in to additional pre-merge test configurations..

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test for fma

6 participants