-
-
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
Boxed tuples leaking into generated code #21121
Comments
Aha, @Keno has also recently been having trouble with this (related to #21074). Apparently our codegen emits llvm literals when a constant is used to initialize a slot, but opaque pointers when it is used to initialize an ssavalue. #20853 did not cause this, but makes it more prevalent due to replacing slots with ssavalues in more cases. We need to fix codegen not to use these opaque pointers so often. As part of this, we'll probably need to keep around (during codegen) both a literal and boxed representation of a value, in case the value needs to be boxed (to avoid allocating the box at runtime). |
Basically dup of #18387 ? |
I have this commit locally:
|
you shouldn't discard the |
Yeah, basically we probably just want to have |
this allows llvm to optimize constant data access fix #21121
this allows llvm to optimize constant data access fix #21121
this allows llvm to optimize constant data access fix #21121
I've got an issue with generating a literal tuple from a macro → generated function, where in some cases the tuple in the AST is a boxed, breaking optimizations and (in my case) resulting in GPU incompatible code due to a literal pointer.
If instead
generated_wrap
returns e.g.Wrapper((42,))
,code_lowered
is identical but the other two are different:On the CPU side, the generated code seems suboptimal but is still correct. On the GPU side however, we can't deal with these literal pointers to CPU memory. That's why I have added a codegenparam
allow_alloc
, which is passed tostatic_eval
, but apparently there's other codegen paths that can emit literal pointers... Is this a bug, i.e. should I only expectstatic_eval
to perform compile-time allocations and emit references to them, or are there other places that need to be guarded by such a codegenparam?Bisected to #20853
cc @JeffBezanson, @cfoket
Version info:
The text was updated successfully, but these errors were encountered: