Skip to content

[WA] Fix the lack of exceptions vector in getrf_batch #1916

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 2 commits into
base: main
Choose a base branch
from

Conversation

CuiYifeng
Copy link
Contributor

This PR provides a work-around for the lack of exception vector within batch_error exception, otherwise segmentation fault would happen while accessing exceptions.

@Copilot Copilot AI review requested due to automatic review settings August 7, 2025 13:58
@CuiYifeng CuiYifeng added the mkl label Aug 7, 2025
@CuiYifeng
Copy link
Contributor Author

Plan to remove this WA after upgrading to oneMKL 2025.3.

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 segmentation fault issue in the MKL batch linear algebra error handling by providing a workaround for missing exception vectors in batch_error exceptions. The fix includes adding debug output when exceptions are missing and creating a CPU-based temporary tensor for info handling.

  • Adds error handling for cases where batch_error.exceptions() returns an empty vector
  • Modifies lu_factor_mkl to use a CPU-based temporary tensor for info data instead of zeroing the original tensor
  • Includes debug output to log batch error details when exceptions are unavailable

@CuiYifeng CuiYifeng force-pushed the yifeng/getrf_batch_wa branch from 15dac16 to 29605c0 Compare August 7, 2025 14:09
@CuiYifeng CuiYifeng requested a review from jianyizh August 11, 2025 14:35
info.zero_();
int32_t* infos_data = info.data_ptr<int32_t>();
Tensor info_ = at::zeros_like(info, Device(at::kCPU));
int32_t* infos_data = info_.data_ptr<int32_t>();
Copy link
Contributor

@jianyizh jianyizh Aug 11, 2025

Choose a reason for hiding this comment

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

can you provide more explanation here? why you create a zero tensor on cpu and pass it to apply_lu_xpu_? and then you copy info_ to xpu? mkl will get seg fault when info is on xpu?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On stock Pytorch side, original info Tensor is on device instead of host.

@jianyizh jianyizh self-requested a review August 12, 2025 02:40
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.

3 participants