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

effects: allow concrete-eval when --check-bounds=no if proven "safe" #50107

Merged
merged 1 commit into from
Jun 12, 2023

Conversation

aviatesk
Copy link
Sponsor Member

@aviatesk aviatesk commented Jun 8, 2023

From version 1.9 onwards, when --check-bounds=no is used, concrete-eval is completely disabled. However, it appears --check-bounds=no is still being used within the community, causing issues like the one reported in JuliaArrays/StaticArrays.jl#1155. Although we should move forward to a direction of eliminating the flag in the future (#48245), for the time being, there are many requests to carry out a certain level of compiler optimization, even when this flag is enabled.

This commit aims to allow concrete-eval "safely" even under --check-bounds=no. Specifically, when the method call being analyzed is :nothrow, it should be predominantly safe to concrete-eval it under this flag. Technically, however, even :nothrow methods could trigger undefined behavior, since :nothrow isn't a strict constraint and it's possible for users to annotate potentially risky methods with Base.@assume_effects :nothrow. Nonetheless, since this possibility is acknowledged in Base.@assume_effects documentation, I feel it's fair to relegate it to user responsibility.

From version 1.9 onwards, when `--check-bounds=no` is used,
concrete-eval is completely disabled. However, it appears
`--check-bounds=no` is still being used within the community, causing
issues like the one reported in JuliaArrays/StaticArrays.jl#1155.
Although we should move forward to a direction of eliminating the flag
in the future (#48245), for the time being, there are many requests to
carry out a certain level of compiler optimization, even when this flag
is enabled.

This commit aims to allow concrete-eval "safely" even under
`--check-bounds=no`. Specifically, when the method call being analyzed
is `:nothrow`, it should be predominantly safe to concrete-eval it under
this flag. Technically, however, even `:nothrow` methods could trigger
undefined behavior, since `:nothrow` isn't a strict constraint and it's
possible for users to annotate potentially risky methods with
`Base.@assume_effects :nothrow`. Nonetheless, since this possibility is
acknowledged in `Base.@assume_effects` documentation, I feel it's fair
to relegate it to user responsibility.
@vtjnash
Copy link
Sponsor Member

vtjnash commented Jun 12, 2023

SGTM.

I think check-bounds=no is still unsound here, regardless. For example, isassigned(a,i) is nothrow, but sometimes relies upon check-bounds being enabled if users do not want to trigger undefined behavior in those cases. But that is a reason we need to do #48245 as that flag makes otherwise well-defined programs potentially unsound, but that is not a reason we can't do this PR too now.

@vchuravy vchuravy merged commit 970941c into master Jun 12, 2023
@vchuravy vchuravy deleted the avi/effects-boundscheck branch June 12, 2023 22:38
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.

3 participants