-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
correct codegen bugs introduced by allocation-hoisting-PR #45476
Conversation
@vtjnash How does this look to you? The mangling from |
@@ -901,7 +901,7 @@ static LoadInst *emit_nthptr_recast(jl_codectx_t &ctx, Value *v, ssize_t n, MDNo | |||
emit_bitcast(ctx, vptr, PointerType::get(type, 0))))); | |||
} | |||
|
|||
static Value *boxed(jl_codectx_t &ctx, const jl_cgval_t &v); | |||
static Value *boxed(jl_codectx_t &ctx, const jl_cgval_t &v, bool is_promotable=false); |
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.
So promotion is now always forbidden implicitly?
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.
Yes, the regression we were seeing was from something getting promoted when we called boxed
on a separate part fo the of the compilation and then hoist something that shouldn't be hoisted.
In the case of the regression we were hosting a string allocation from inside an error to the main path of the function which then impeded an optimization.
From what I understand we should only hoist the allocation when we have nested structs and it's fields are promotable which we only check inside emit_new_struct
Co-authored-by: Jameson Nash <[email protected]>
@nanosoldier |
Something went wrong when running your job:
Unfortunately, the logs could not be uploaded. |
@vtjnash I'm not super accustomed to nanosoldier results, was this a particularly noisy benchmark or should I take a look at some more regressions. |
It looks like noise, though it wouldn't be too surprising if some of the differences were real. The memory changes are always real. |
Maybe related to #45485. julia> versioninfo()
Julia Version 1.9.0-DEV.883
Commit e4257cbc89 (2022-06-30 17:58 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 6 × Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-14.0.5 (ORCJIT, skylake)
Threads: 1 on 6 virtual cores
julia> VERSION
v"1.9.0-DEV.883"
julia> struct MaybeTuple
val::Union{Nothing, Tuple{Float32}}
end
julia> MaybeTuple((0,))
Assertion failed: New->getType() == getType() && "replaceAllUses of value with new value of different type!", file /workspace/srcdir/llvm-project/llvm/lib/IR/Value.cpp, line 503
signal (22): SIGABRT
in expression starting at REPL[4]:1 |
Yeah, this branch currently breaks unions. edit: this commit should fix them |
How close is this? Should we revert #45153 and then re-land it with these fixes? |
We might want to run pkgeval, but the issues related to the original pr are fixed by this |
@nanosoldier |
Your package evaluation job has completed - possible new issues were detected. A full report can be found here. |
After a rebase I tested it locally and the failures seen weren't there |
@@ -3681,7 +3681,7 @@ static jl_cgval_t emit_new_struct(jl_codectx_t &ctx, jl_value_t *ty, size_t narg | |||
if (fval_info.typ == jl_bottom_type) | |||
return jl_cgval_t(); | |||
// TODO: Use (post-)domination instead. | |||
bool field_promotable = !init_as_value && fval_info.promotion_ssa != -1 && | |||
bool field_promotable = !jl_is_uniontype(jtype) && !init_as_value && fval_info.promotion_ssa != -1 && |
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.
It would be valid though if jl_field_isptr
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 issue is that unions currently don't get their promotion point correctly, I'm not exactly what's needed to fix that, so for now, not allowing unions at all seems fine.
@nanosoldier |
@nanosoldier |
Your package evaluation job has completed - possible new issues were detected. A full report can be found here. |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
@nanosoldier |
@nanosoldier |
@nanosoldier |
Your benchmark job has completed - no performance regressions were detected. A full report can be found here. |
…45476) Co-authored-by: Jameson Nash <[email protected]>
…45476) Co-authored-by: Jameson Nash <[email protected]>
Adresses some of the reviews for #45153