-
Notifications
You must be signed in to change notification settings - Fork 70
Add NaN check to prevent false singular matrix errors #2755
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds NaN input validation to prevent false singular matrix errors in MKL linear algebra operations. When NaN values are detected in inputs, the functions now return NaN outputs with appropriate default values instead of passing invalid data to oneMKL, which could cause out-of-bounds memory access.
Changes:
- Add NaN checks in
lu_solve_mklandlu_factor_mklfunctions - Return NaN-filled outputs when NaN inputs are detected
- Include necessary headers for
isnanandarangeoperations
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Performance outliers, please check!
|
CuiYifeng
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add test cases for input with nan, thanks.
Fix issue: #2667
The issue is caused by oneMKL receiving
NaNinputs, which can lead to out-of-bounds memory access and convertNaNto0, causing thesingular checkto fail. ANaNcheck is added before oneMKL computation, andNaNoutputs are returned whenNaNinputs are detected to align with cuda results.Testing:
Output: