Propagate Mosaic GPU kernel launch errors to XLA instead of calling abort(). - #40252
Merged
Conversation
copybara-service
Bot
force-pushed
the
test_971589912
branch
3 times, most recently
from
August 27, 2026 14:02
8b4cbb0 to
eca354a
Compare
…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
Bot
force-pushed
the
test_971589912
branch
from
August 27, 2026 14:59
eca354a to
f3fcb67
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Propagate Mosaic GPU kernel launch errors to XLA instead of calling abort().
Previously,
mosaic_gpu_launch_kernelinruntime.ccunconditionally invokedabort_on_errorwhencuLaunchKernelExreturned a failure (such asCUDA_ERROR_CAPTURE_ALREADY_FAILEDduring CUDA Graph / Command Buffer tracing). This raisedSIGABRTand killed the process immediately.This change:
mosaic_gpu_launch_kernelinruntime.ccto returnCUresultdirectly instead of callingabort().emitRuntimeDeclsandlaunchPreloadedKernelinlaunch_lowering.ccto declare and returni32from the preloaded kernel launcher and host function.MosaicGpuExecuteandMosaicHostFuncincustom_call.ccto check the returnedCUresultand return a descriptiveabsl::InternalErrorwhen kernel launch fails, allowing XLA FFI to handle it cleanly.