Skip to content

meta nodes lost when converting back to legacy IR #27104

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

Closed
maleadt opened this issue May 15, 2018 · 4 comments
Closed

meta nodes lost when converting back to legacy IR #27104

maleadt opened this issue May 15, 2018 · 4 comments
Assignees
Labels
compiler:optimizer Optimization passes (mostly in base/compiler/ssair/) gpu Affects running Julia on a GPU regression Regression in behavior compared to a previous version

Comments

@maleadt
Copy link
Member

maleadt commented May 15, 2018

The new-style IR -> CodeInfo converter forgets about meta nodes, some of which are handled by codegen (@noinline for noinline LLVM IR attr as used by CUDAnative, @polly).
The fix seemed easy, but causes breakage, and I don't have time to look into this right now...

diff --git a/base/compiler/ssair/legacy.jl b/base/compiler/ssair/legacy.jl
index 6e0c9c1444..7593e9a6fa 100644
--- a/base/compiler/ssair/legacy.jl
+++ b/base/compiler/ssair/legacy.jl
@@ -260,6 +260,7 @@ function replace_code_newstyle!(ci::CodeInfo, ir::IRCode, nargs, linetable)
     resize!(ci.slotnames, nargs+1)
     resize!(ci.slotflags, nargs+1)
     ci.code = ir.stmts
+    prepend!(ci.code, ir.meta)
     ci.codelocs = ir.lines
     ci.linetable = linetable
     ci.ssavaluetypes = ir.types

The other replace_code! converter looks like it handled this, but that code seems dead?

@maleadt maleadt added regression Regression in behavior compared to a previous version compiler:optimizer Optimization passes (mostly in base/compiler/ssair/) labels May 15, 2018
maleadt added a commit to JuliaGPU/CUDAnative.jl that referenced this issue May 31, 2018
@maleadt maleadt added the gpu Affects running Julia on a GPU label Jul 12, 2018
@vtjnash vtjnash closed this as completed Jul 19, 2018
@maleadt
Copy link
Member Author

maleadt commented Jul 20, 2018

Why did you close this, without comment? This isn't fixed.

@maleadt maleadt reopened this Jul 20, 2018
@vtjnash
Copy link
Member

vtjnash commented Jul 24, 2018

To check if it was fixed :P

@nlw0
Copy link
Contributor

nlw0 commented Apr 26, 2019

I am working on #31442 and was going to propose a macro to activate a function argument for LLVM, similar to how @noinline and @polly are supposed to work, and also following the manual advice at https://docs.julialang.org/en/v1/devdocs/meta/ .

It seems I'm hitting this here issue, though. I can try to work on this if I have an idea of what to do, but I have the impression meta nodes should not be used at the codegen.cpp level anymore, and maybe adding a new node type at

if (head == isdefined_sym) {
is the way to go. Is this really the case? Otherwise how should I proceed preserving the meta nodes?

The first error I could see was just about ci.codelocs, but later is not clear. Are meta nodes ignored anywhere at code generation?

@maleadt
Copy link
Member Author

maleadt commented May 2, 2019

Fixed by #31871

@maleadt maleadt closed this as completed May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:optimizer Optimization passes (mostly in base/compiler/ssair/) gpu Affects running Julia on a GPU regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

4 participants