Skip to content

Conversation

CuiYifeng
Copy link
Contributor

This PR is to fix the access to exception vector in error handling. Original implementation may cause a segmentation fault due to out-of-bounds access.

@Copilot Copilot AI review requested due to automatic review settings September 18, 2025 13:12
@CuiYifeng CuiYifeng added the mkl label Sep 18, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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 fixes a critical error handling bug in the BatchLinearAlgebra operations where the original implementation could cause segmentation faults due to out-of-bounds vector access. The fix changes the loop iteration from using element references to using proper indexing.

  • Replaces range-based for loop with index-based iteration to prevent out-of-bounds access
  • Ensures safe access to the exception vector during error handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@EikanWang
Copy link
Contributor

@CuiYifeng , pls. add test cases.

@EikanWang
Copy link
Contributor

Another question is why the CI did not gate the failure.

@CuiYifeng
Copy link
Contributor Author

@EikanWang Thanks for the question. Segmentation fault won't be triggered until oneAPI is upgraded to 2025.3. Part of exception handling has just been implemented by oneMKL 2025.3. I discovered this issue while verifying oneMKL's change.

Test cases already have been activated in CI:

  • test_linalg_xpu.py::TestLinalgXPU::test_det_logdet_slogdet_batched_xpu_float64
  • test_linalg_xpu.py::TestLinalgXPU::test_det_logdet_slogdet_xpu_float64
  • test_linalg_xpu.py::TestLinalgXPU::test_linalg_lu_family_xpu_float32
  • test_linalg_xpu.py::TestLinalgXPU::test_slogdet_xpu_float32
  • test_linalg_xpu.py::TestLinalgXPU::test_slogdet_xpu_float64

@CuiYifeng CuiYifeng force-pushed the yifeng/fix_error_handle branch from 04aa912 to dd323ab Compare September 23, 2025 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants