GithubHelp home page GithubHelp logo

Comments (6)

vtjnash avatar vtjnash commented on May 18, 2024 1

%51 equals to %47

%51 is never equal to %47. Phi nodes apply simultaneously, not sequentially

from julia.

thautwarm avatar thautwarm commented on May 18, 2024

P.S: if we prevent view from being inlined, the result gets correct again.

# replace `view` with `view2`
@noinline view2(args...) = view(args...)

from julia.

vtjnash avatar vtjnash commented on May 18, 2024

it shows %47 is the local variable n

That is not quite how values work. The variable is gone, replaced by zero or more % values that represent the value it had at various points in the code. In particular, it looks like %51 is a time-shifted copy of %47 (e.g. it always has the value from the previous iteration). Can you say a bit more about what result you were expecting? I get this, which looks correct at a glance (that is, I see @interpret simu!(U, u) at least populate the same values into U):

julia> U = reshape(1:3*3*3, (3,3,3)) |> collect;

julia> u = reshape(10 .+ (1:3*3), (3,3)) |> collect;

julia> simu!(U, u)
1
2

julia> U
3×3×3 Array{Int64, 3}:
[:, :, 1] =
 1   4  7
 2  45  8
 3  47  9

[:, :, 2] =
 10  13  16
 11  49  17
 12  92  18

[:, :, 3] =
 19  22  25
 20  23  26
 21  24  27

from julia.

thautwarm avatar thautwarm commented on May 18, 2024

That is not quite how values work. The variable is gone, replaced by zero or more % values that represent the value it had at various points in the code. In particular, it looks like %51 is a time-shifted copy of %47

Yes, my point is that %51 equals to %47 which actually stores an integer 2 when n = 2.

Can you say a bit more about what result you were expecting?
I expect the first arrayref is not using %51 (%47, or n) as the its 5-th argument but a value extracted from some structure.

Given size(U) = (3, 3, 3), when n=2, the 5-th argument of arrayref should be 1 instead of 2 at runtime.

I see @InterPret simu!(U, u) at least populate the same values

(EIDT) I don't think @interpret is related because the interpreter uses the untyped form.

Julia does run the MVE code correctly producing correct results, but I don't think the result of @code_typed is correct.

In my derivation, if U = ones(3, 3, 3) is given, and using the following inputs, the @code_typed output is different from the real execution.

U = ones(3, 3, 3)
u = ones(3, 3)
simu!(U, u)
display(U[:, :, 2])

# julia/correct result
#=
[:, :, 2] =
 1.0  1.0  1.0
 1.0  3.0  1.0
 1.0  4.0  1.0
=#
# according to code_typed
#=
[:, :, 2] =
 1.0  1.0  1.0
 1.0  2.0  1.0
 1.0  3.0  1.0
=#

from julia.

vtjnash avatar vtjnash commented on May 18, 2024

If Julia runs the code correctly, then it seems more likely you are interpreting it wrong mentally than that the code is wrong but still gives the right answer.

from julia.

thautwarm avatar thautwarm commented on May 18, 2024

Thanks a lot for your information, I can confirm this is not a bug.
Very sorry for taking your time with this issue!

from julia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.