-
Notifications
You must be signed in to change notification settings - Fork 8
Add Preference to disable runtime invalidation #22
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,8 +48,12 @@ function reset_features!() | |
| for ext ∈ features | ||
| feature, has = process_feature(ext) | ||
| if _has_feature(feature) ≠ has | ||
| @debug "Defining $(has ? "presence" : "absense") of feature $feature." | ||
| set_feature(feature, has) | ||
| if allow_eval | ||
| @debug "Defining $(has ? "presence" : "absense") of feature $feature." | ||
| set_feature(feature, has) | ||
| else | ||
| @warn "Runtime invalidation was disabled, but the CPU info is out-of-date.\nWill continue with incorrect CPU feature flag: $ext." | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aside of this change, I expect that For the reference, that's the info I've collected from real and virtual machines with
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good point. We probably need to tighten that up. I'm curious to have @gbaraldi 's input on this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just a huge mess. some VMs hide features for example There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess to be clear, the mess I mean is as a whole. I think this is mergeable without too many issues but I wish there was something nicer that LLVM exposed, but there isn't currently
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| end | ||
| end | ||
| end | ||
| Libc.free(features_cstring) | ||
|
|
@@ -58,8 +62,13 @@ end | |
| register_size(::Type{T}) where {T} = register_size() | ||
| register_size(::Type{T}) where {T<:Union{Signed,Unsigned}} = simd_integer_register_size() | ||
|
|
||
| function define_cpu_name() | ||
| function redefine_cpu_name() | ||
| cpu = QuoteNode(Symbol(get_cpu_name())) | ||
| @eval cpu_name() = Val{$cpu}() | ||
| if allow_eval | ||
| @eval cpu_name() = Val{$cpu}() | ||
| else | ||
| @warn "Runtime invalidation was disabled, but the CPU info is out-of-date.\nWill continue with incorrect CPU name (from build time)." | ||
| end | ||
| end | ||
| define_cpu_name() | ||
| cpu = QuoteNode(Symbol(get_cpu_name())) | ||
| @eval cpu_name() = Val{$cpu}() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,14 +32,22 @@ fast_int64_to_double() = has_feature(Val(:x86_64_avx512dq)) | |
|
|
||
| fast_half() = False() | ||
|
|
||
| @noinline function setfeaturefalse(s) | ||
| @inline function setfeaturefalse(s) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why the inlining switch?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was to improve inferrability - |
||
| if has_feature(Val(s)) === True() | ||
| @eval has_feature(::Val{$(QuoteNode(s))}) = False() | ||
| if allow_eval | ||
| @eval has_feature(::Val{$(QuoteNode(s))}) = False() | ||
| else | ||
| @warn "Runtime invalidation was disabled, but the CPU info is out-of-date.\nWill continue with incorrect CPU feature flag: $s." | ||
| end | ||
| end | ||
| end | ||
| @noinline function setfeaturetrue(s) | ||
| @inline function setfeaturetrue(s) | ||
| if has_feature(Val(s)) === False() | ||
| @eval has_feature(::Val{$(QuoteNode(s))}) = True() | ||
| if allow_eval | ||
| @eval has_feature(::Val{$(QuoteNode(s))}) = True() | ||
| else | ||
| @warn "Runtime invalidation was disabled, but the CPU info is out-of-date.\nWill continue with incorrect CPU feature flag: $s." | ||
| end | ||
| end | ||
| end | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not to check that
--trimis enabled in JLOptions ?everyone who will use it with trim will have to find out this culprit themself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main thinking is that this preference is usable by more than just JuliaC.jl, since some users may wish to be opt-in to error / warn on invalidation storms from this package. JuliaC.jl can set this preference automatically, so the end-user experience is the same.
Also technically checking
JLOptionsat pre-compilation time won't detect--trimproperly, but something like JuliaLang/JuliaC.jl#31 would work