Comments (6)
%51 equals to %47
%51 is never equal to %47. Phi nodes apply simultaneously, not sequentially
from julia.
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.
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.
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 firstarrayref
is not using%51
(%47
, orn
) 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.
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.
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)
- LLVM Error out of memory on CI on32-bit GNU linux `compileall`(?)
- Keyword arguments emitted by macros don't get gensym'd
- Interest for an `Iterators.nth(x, n)` API? HOT 4
- `iterate` returns tuple for non-existent state HOT 6
- Should n-arg fastmath addition default to using to 2-arg fastmath addition for all types HOT 1
- suboptimal return type inference for `Base.setindex`
- Stdlib pkgimages seems to be compiled with generic target HOT 2
- Broadcast with missing destroys sparsity
- eltype of Symmetric or Hermitian matrix of matrices is AbstractMatrix HOT 9
- Keyword arguments can be placed anywhere in a function call HOT 1
- Julia's target parsing/detecting deserves a refactor HOT 1
- `help` in normal mode REPL acts strange HOT 1
- `checked_rem` and `checked_mod` don't follow the same promotion rules as regular rem and mod
- `@doc` (`MD` object) doesn't print with horizontal bars between methods, which can mislead the reader.
- support syntax `macro OtherPackage.theirmacro(args...) ... end`
- Feature request: Non allocating sort for tuple HOT 1
- suboptimal return type inference for `reverse(::Tuple)` on v1.11 and master
- Multi index `Base.setindex`
- Remove `Dates.value(::Date)`
- `escape_string` doesn't appear to be able to keep double-quotes. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from julia.