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

Cherry-pick inlining fix from #725 #730

Merged
merged 1 commit into from
Dec 9, 2024
Merged

Cherry-pick inlining fix from #725 #730

merged 1 commit into from
Dec 9, 2024

Conversation

jiribenes
Copy link
Contributor

As discussed in #561 (comment), there's a missing rewrite.
This fix is necessary for the map and set examples, as well as some of my AoC solutions using them, so I'd like to upstream it, if possible.

@jiribenes jiribenes added the bug Something isn't working label Dec 9, 2024
@jiribenes
Copy link
Contributor Author

Since the tests seem to pass, I'll just merge this. :)

@jiribenes jiribenes merged commit 82af20f into master Dec 9, 2024
2 checks passed
@jiribenes jiribenes deleted the fix/inlining branch December 9, 2024 18:18
@jiribenes
Copy link
Contributor Author

Unfortunately, this doesn't seem to help with other inliner bugs I've seen:

ReferenceError: l_9 is not defined
    at out/amap.js:4182:76

It looks like the same bug as in #561:

                                            switch (v_y_166.__tag) {
                                              case 0: 
                                                return () =>
                                                  link_0(v_y_154, v_y_155, l_9, v_y_164, ks_119, (v_r_97, ks_120) =>
                                                    () =>
                                                      go_1((level_1 << (1)), v_r_97, v_y_165, ks_120, k_88));
                                              default: 
                                                switch (v_y_165.__tag) {
                                                  case 0: 
                                                    return () =>
                                                      link_0(v_y_154, v_y_155, l_9, v_y_164, ks_119, (v_r_98, ks_121) => {

opt IR

                          let cr9991647052 = run {create403246401(level867844944, v_y_1271111410644966)}
                          
                          cr9991647052 match {
                            case Tuple3335 { (v_y_126991101021747053: Map8335[A10266, Unit394], v_y_127001111031847054: List910[Tuple2249[A10266, Unit394]], v_y_127011121041947055: List910[Tuple2249[A10266, Unit394]]) => 
                              v_y_127011121041947055 match {
                                case Nil1135 { () => 
                                  let v_r_126891039510350733 = run {link8561[A10266, Unit394](v_y_1271411510744967, v_y_1271511610844968, l9890547046, v_y_126991101021747053)}
                                  
                                  go857746408(bitwiseShl225(level867844944, 1), v_r_126891039510350733, v_y_127001111031847054)
                                }
                              } else {
                                v_y_127001111031847054 match {
                                  case Nil1135 { () => 
                                    let v_r_126931079914350736 = run {link8561[A10266, Unit394](v_y_1271411510744967, v_y_1271511610844968, l9890547046, v_y_126991101021747053)}
                                    

@marvinborner
Copy link
Member

marvinborner commented Dec 10, 2024

I didn't have time to investigate this yet, but could this effekt-plots error (on master?!) be related?

https://github.com/effekt-lang/effekt-plots/actions/runs/12247898051/job/34166543555

@jiribenes
Copy link
Contributor Author

jiribenes commented Dec 10, 2024

I didn't have time to investigate this yet, but could this effekt-plots error (on master?!) be related?

https://github.com/effekt-lang/effekt-plots/actions/runs/12247898051/job/34166543555

Fascinating. I have something similar in the exact same file reported above (where the inliner fails ^)

$ effekt --no-optimize --backend=llvm day08/amap.effekt
Exception in thread "main" java.lang.RuntimeException: Cannot find block info for b_tmp_15333.
HashMap(infixEq -> Definition(List(),List(Variable(x_67,Int()), Variable(y_68,Int()))), b_k_13343 -> Definition(List(),List()), fail -> Parameter(Interface(fail,List())), b_k_11016 -> Definition(List(),List()), b_k_13296 -> Definition(List(),List()), balance -> Definition(List(),List(Variable(k_7096,Positive()), Variable(v_7097,Positive()), Variable(l_7098,Positive()), Variable(r_7099,Positive()))), bitwiseOr -> Definition(List(),List(Variable(x_232,Int()), ...

=> reported in #733 and #732 :)

@jiribenes
Copy link
Contributor Author

On the meeting, we found out that Effekt Plots doesn't work because of this change (cc @marvinborner)

jiribenes added a commit that referenced this pull request Dec 12, 2024
jiribenes added a commit that referenced this pull request Dec 12, 2024
Reverts #730 as it seems like an incorrect fix,
judging both by the Effekt Working Group meeting, and the graphs after
merging it:


![image](https://github.com/user-attachments/assets/67f28d10-ef57-4529-b47d-4df1d342bd63)

![image](https://github.com/user-attachments/assets/e6de9240-d9fd-4aeb-8f45-79a225307811)
b-studios pushed a commit that referenced this pull request Dec 24, 2024
As discussed in
#561 (comment),
there's a missing rewrite.
This fix is necessary for the `map` and `set` examples, as well as some
of my AoC solutions using them, so I'd like to upstream it, if possible.

Co-authored-by: Marvin <git@marvinborner.de>
b-studios pushed a commit that referenced this pull request Dec 24, 2024
Reverts #730 as it seems like an incorrect fix,
judging both by the Effekt Working Group meeting, and the graphs after
merging it:


![image](https://github.com/user-attachments/assets/67f28d10-ef57-4529-b47d-4df1d342bd63)

![image](https://github.com/user-attachments/assets/e6de9240-d9fd-4aeb-8f45-79a225307811)
EveEme pushed a commit to EveEme/effekt that referenced this pull request Jan 20, 2025
As discussed in
effekt-lang#561 (comment),
there's a missing rewrite.
This fix is necessary for the `map` and `set` examples, as well as some
of my AoC solutions using them, so I'd like to upstream it, if possible.

Co-authored-by: Marvin <git@marvinborner.de>
EveEme pushed a commit to EveEme/effekt that referenced this pull request Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants