Skip to content

Commit 57c1b4d

Browse files
committed
Minor update.
1 parent 2c99f6a commit 57c1b4d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/graphs.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,16 @@ function stride(var::Variable, sym::Symbol)
6060
end
6161
function cost(var::Variable, unrolled::Symbol, dim::Int)
6262
c = cost(instruction(var), Wshift, T)::Int
63-
if accesses_memory(var) && stride(var, unrolled) != 1
64-
c *= W
63+
if accesses_memory(var)
64+
# either vbroadcast/reductionstore, vmov(a/u)pd, or gather/scatter
65+
if (unrolled loopdependencies(var))
66+
if (stride(var, unrolled) != 1) # gather/scatter
67+
c *= W
68+
# else # vmov(a/u)pd
69+
end
70+
elseif sym(var) == :setindex! # broadcast or reductionstore; if store we want to penalize reduction
71+
c *= 2
72+
end
6573
end
6674
c
6775
end

0 commit comments

Comments
 (0)