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

Nesting of imperative ifelse inside dynamo #134

Open
PoorvaGarg opened this issue May 3, 2023 · 1 comment
Open

Nesting of imperative ifelse inside dynamo #134

PoorvaGarg opened this issue May 3, 2023 · 1 comment

Comments

@PoorvaGarg
Copy link
Collaborator

PoorvaGarg commented May 3, 2023

The following code

earthquake = flip(0.5)

alarm = @dice begin
    if (burglary)
        (if (earthquake) 
            flip(0.95)
        else
            flip(0.1)
        end)
    else
        flip(0.01)
    end
end

throws the following error:

ERROR: Error compiling @dynamo Dice.DiceDyna on (var"#11#12",):
AssertionError: length(branches(bl)) == 2
Stacktrace:
  [1] functionalbranches!(bl::Any, pr::Any, labels::Any)
    @ IRTools.Inner ~/.julia/packages/IRTools/WiQqY/src/passes/cps.jl:36
  [2] _functional(ir::Any, tree::Any, vars::Any, cs::Any)
    @ IRTools.Inner ~/.julia/packages/IRTools/WiQqY/src/passes/cps.jl:66
  [3] _functional(ir::Any, tree::Any)
    @ IRTools.Inner ~/.julia/packages/IRTools/WiQqY/src/passes/cps.jl:50
  [4] functional(ir::Any)
    @ IRTools.Inner ~/.julia/packages/IRTools/WiQqY/src/passes/cps.jl:70
  [5] macro expansion
    @ ~/.julia/dev/Dice.jl/src/dsl.jl:53 [inlined]
  [6] macro expansion
    @ ./timing.jl:463 [inlined]
  [7] macro expansion
    @ ~/.julia/dev/Dice.jl/src/dsl.jl:50 [inlined]
  [8] transform(#unused#::Type{Dice.DiceDyna}, a::Type)
    @ Dice ~/.julia/packages/IRTools/WiQqY/src/reflection/dynamo.jl:137
  [9] dynamo(cache::Any, f::Any, args::Any)
    @ IRTools.Inner ~/.julia/packages/IRTools/WiQqY/src/reflection/dynamo.jl:76
 [10] #s61#154
    @ ~/.julia/packages/IRTools/WiQqY/src/reflection/dynamo.jl:129 [inlined]
 [11] var"#s61#154"(dyna::Any, args::Any)
    @ Dice ./none:0
 [12] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any})
    @ Core ./boot.jl:582
 [13] dice(f::Function)
    @ Dice ~/.julia/dev/Dice.jl/src/dsl.jl:20
 [14] top-level scope
    @ ~/.julia/dev/Dice.jl/src/dsl.jl:27
@guyvdbroeck
Copy link
Contributor

Same bug as FluxML/IRTools.jl#100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants