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 #2040

Closed
FluxusMagna opened this issue Nov 3, 2023 · 2 comments
Closed

Internal compiler error #2040

FluxusMagna opened this issue Nov 3, 2023 · 2 comments

Comments

@FluxusMagna
Copy link

This is the most reduced code that reproduces the error that I've come up with.

def fun [k] (n:i64)
    (op:[k]f32 -> [k]f32) (_:[k]f32)
    =
    let process (Q:*[n+1][k]f32) i =
        let q = op Q[i]
        let q = map (+1) q
        in Q with [i+1] = q
    let (i, Q) =
        loop (i, Q) =
            ( 0, replicate (n+1) (replicate k 0))
        while i < n do
            let Q = process Q i
            in (i, Q)
    in i

entry test n k = fun n (map (+1)) (replicate k 0)

The error I get is

Internal compiler error (unhandled IO exception).
Please report this at https://github.com/diku-dk/futhark/issues
defuncApplyArg: cannot apply StaticVal
Dynamic (Scalar (Prim (Signed Int64)))
Function name: defunc_0_+
CallStack (from HasCallStack):
  error, called at src/Futhark/Internalise/Defunctionalise.hs:979:3 in futhark-0.26.0-HXLlDtoyvtTB3lobWyH4uu:Futhark.Internalise.Defunctionalise

The code (or rather what was reduced to this code) works fine in the interpreter.

@athas
Copy link
Member

athas commented Nov 3, 2023

Slightly smaller:

def fun [k] (n:i64) (op:[k]f32 -> *[k]f32) (_:[k]f32) =
  let process (Q:*[n+1][k]f32) i =
    let q = op Q[i]
    in Q with [i+1] = q
  let Q = replicate (n+1) (replicate k 0)
  let Q = process Q 0
  in Q

entry test n k = fun n copy (replicate k 0)

Strange failure. This program does not do anything odd.

@athas athas closed this as completed in 97ef688 Nov 3, 2023
@athas
Copy link
Member

athas commented Nov 3, 2023

Defunctionalisation was naive and shadowed the + intrinsic.

athas added a commit that referenced this issue Nov 7, 2023
CKuke pushed a commit to CKuke/futhark-seq that referenced this issue Nov 8, 2023
CKuke pushed a commit to CKuke/futhark-seq that referenced this issue Nov 8, 2023
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