Skip to content
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

Improve logging for Metallib function lookup failures #7836

Merged
merged 2 commits into from
May 9, 2024

Conversation

ullerrm
Copy link
Contributor

@ullerrm ullerrm commented May 7, 2024

If a .metallib was compiled with a target iOS version that's newer than the current device, loading the .metallib as an id<MTLLibrary> may succeed, but finding main0 (or any other function in it) will fail and return nil. Currently, this causes a crash due to an assert; logging the error and returning MetalFunctionBundle::error() will still crash, but in a way that's easier to diagnose.

(Note that in practice, this will probably be a useless "Compiler encountered an internal error" message -- the GPU backend is crashing, and the Metal stub library sees as XPC_ERROR_CONNECTION_INTERRUPTED. It retries up to 3 times, crashing each time, and then gives up.)

ullerrm and others added 2 commits May 7, 2024 23:48
If a .metallib was compiled with a target iOS version that's newer than
the current device, loading the .metallib may succeed, but finding main0
(or any other function in it) will fail. Currently, this causes a crash
due to an assert. Logging the error and returning
MetalFunctionBundle::error() makes the crash slightly easier to
diagnose.

(Note that in practice, this will probably be a useless "Compiler
encountered an internal error" message -- the GPU backend is crashing,
and the Metal stub library sees XPC_ERROR_CONNECTION_INTERRUPTED. It
retries up to 3 times (crashing each time) and then gives up.)
@pixelflinger pixelflinger requested a review from bejado May 8, 2024 19:21
@pixelflinger pixelflinger added the internal Issue/PR does not affect clients label May 8, 2024
@bejado bejado merged commit ad60008 into google:main May 9, 2024
9 checks passed
@ullerrm ullerrm deleted the metal_function_error branch May 9, 2024 18:15
bejado pushed a commit that referenced this pull request May 9, 2024
If a .metallib was compiled with a target iOS version that's newer than
the current device, loading the .metallib may succeed, but finding main0
(or any other function in it) will fail. Currently, this causes a crash
due to an assert. Logging the error and returning
MetalFunctionBundle::error() makes the crash slightly easier to
diagnose.

(Note that in practice, this will probably be a useless "Compiler
encountered an internal error" message -- the GPU backend is crashing,
and the Metal stub library sees XPC_ERROR_CONNECTION_INTERRUPTED. It
retries up to 3 times (crashing each time) and then gives up.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Issue/PR does not affect clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants