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

Internal Compiler Error when Compiling to Cuda and OpenCL, Works with compilation to C #2176

Closed
Holindauer opened this issue Sep 9, 2024 · 3 comments
Assignees

Comments

@Holindauer
Copy link

Holindauer commented Sep 9, 2024

Hello, I have just run into an interesting bug.

While working on some futhark code, I added a new entry point to my main.fut file. There were no syntax errors/ any reason to think the code would not compile. For some reason, I was not able to compile to Cuda or OpenCL. However, compiling to C still works fine.

Not exactly sure why. It is not always consistent when/why this happens.

I noticed that even if I commented out the entry port that seemed to have caused the compilation error, it would still not compile for Cuda/OpenCL.

If I commented all of the code, then I was able to compile with Cuda/OpenCL. I could even uncomment portions of the main.fut that had been commented out and it would also compile. Though, once that entry port was uncommented, it would fail again, even after commenting out.

I was able to replicate this on two different machines.

Below are the error messages I was shown when this happened:

$ futhark opencl main.fut
Internal compiler error (unhandled IO exception).
Please report this at https://github.com/diku-dk/futhark/issues
Scope.lookupInfo: Name mem_35410 not found in type environment.
CallStack (from HasCallStack):
error, called at src/Futhark/IR/Prop/Scope.hs:85:9 in futhark-0.26.0-inplace:Futhark.IR.Prop.Scope

$ futhark cuda main.fut
Internal compiler error (unhandled IO exception).
Please report this at https://github.com/diku-dk/futhark/issues
Scope.lookupInfo: Name mem_35410 not found in type environment.
CallStack (from HasCallStack):
error, called at src/Futhark/IR/Prop/Scope.hs:85:9 in futhark-0.26.0-inplace:Futhark.IR.Prop.Scope

$ futhark c main.fut # <--- this works

@athas
Copy link
Member

athas commented Sep 9, 2024

It's probably a bug in a pass that only runs with the GPU backends. Deleting entry points can cause code to go dead and be removed before it makes it to the problematic pass. Can I see the program?

@athas athas self-assigned this Sep 9, 2024
@Holindauer
Copy link
Author

Here is the main file with the problematic entry point at line 70:

https://github.com/Holindauer/ruthark/blob/a828904c12364ffc8aa333dcf8a66b65607a460c/fut-src/main.fut#L70

@athas
Copy link
Member

athas commented Sep 9, 2024

I can reproduce. It is a bug in memory short circuiting. It looks like a minor oversight, and I hope that this is true.

athas added a commit that referenced this issue Sep 9, 2024
athas added a commit that referenced this issue Sep 9, 2024
@athas athas closed this as completed in 1d48449 Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants