Avoid a couple of InexactErrors in the IdDict code. #48116
Merged
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.
Fixes #48097 (working around the issue).
On 1.9, kwarg calls use
Base._tuple_unique_fieldtypes
, which relies on IdDict. Normally that doesn't matter, because the method is marked@total_meta
so the optimizer is free to use concrete evaluation to evaluate the function at compile time. However, with our GPU back-ends,Core.throw_inexacterror
is replaced with an overlay method that does GPU-compatible exception reporting. That currently disables concrete evaluation, resulting in run-time calls toBase._tuple_unique_fieldtypes
(and a whole lot of dynamic code following it).To get things working in time for 1.9, just avoid throwing InexactErrors as part of IdDict operations. That results in the optimizer being able to concrete evaluate
Base._tuple_unique_fieldtypes
even in GPU compilation mode.For 1.10, we probably need a better way of overriding methods without disabling concrete evaluation. Some GPU overrides should not disable these optimizations, e.g., if we override
Base.sin
with a version that uses hardware intrinsics we should still get to benefit from concrete evaluation (albeit using the original method). In other cases, like theCore.throw_inexacterror
overlay here, it's not so clear what needs to happen.