Skip to content

Propagate Mosaic GPU kernel launch errors to XLA instead of calling abort(). - #40252

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_971589912
Aug 27, 2026
Merged

Propagate Mosaic GPU kernel launch errors to XLA instead of calling abort().#40252
copybara-service[bot] merged 1 commit into
mainfrom
test_971589912

Conversation

@copybara-service

Copy link
Copy Markdown

Propagate Mosaic GPU kernel launch errors to XLA instead of calling abort().

Previously, mosaic_gpu_launch_kernel in runtime.cc unconditionally invoked abort_on_error when cuLaunchKernelEx returned a failure (such as CUDA_ERROR_CAPTURE_ALREADY_FAILED during CUDA Graph / Command Buffer tracing). This raised SIGABRT and killed the process immediately.

This change:

  1. Updates mosaic_gpu_launch_kernel in runtime.cc to return CUresult directly instead of calling abort().
  2. Updates emitRuntimeDecls and launchPreloadedKernel in launch_lowering.cc to declare and return i32 from the preloaded kernel launcher and host function.
  3. Updates MosaicGpuExecute and MosaicHostFunc in custom_call.cc to check the returned CUresult and return a descriptive absl::InternalError when kernel launch fails, allowing XLA FFI to handle it cleanly.

@copybara-service
copybara-service Bot force-pushed the test_971589912 branch 3 times, most recently from 8b4cbb0 to eca354a Compare August 27, 2026 14:02
…bort().

Previously, `mosaic_gpu_launch_kernel` in `runtime.cc` unconditionally invoked `abort_on_error` when `cuLaunchKernelEx` returned a failure (such as `CUDA_ERROR_CAPTURE_ALREADY_FAILED` during CUDA Graph / Command Buffer tracing). This raised `SIGABRT` and killed the process immediately.

This change:
1. Updates `mosaic_gpu_launch_kernel` in `runtime.cc` to return `CUresult` directly instead of calling `abort()`.
2. Updates `emitRuntimeDecls` and `launchPreloadedKernel` in `launch_lowering.cc` to declare and return `i32` from the preloaded kernel launcher and host function.
3. Updates `MosaicGpuExecute` and `MosaicHostFunc` in `custom_call.cc` to check the returned `CUresult` and return a descriptive `absl::InternalError` when kernel launch fails, allowing XLA FFI to handle it cleanly.

PiperOrigin-RevId: 971955078
@copybara-service
copybara-service Bot merged commit f3fcb67 into main Aug 27, 2026
4 of 5 checks passed
@copybara-service
copybara-service Bot deleted the test_971589912 branch August 27, 2026 14:59
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.

1 participant