Skip to content

Commit 4e8adf8

Browse files
committed
Minor progress; WIP.
1 parent f3aa3b5 commit 4e8adf8

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

src/costs.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ const COST = Dict{Symbol,InstructionCost}(
6565
:vmuladd => InstructionCost(4,0.5), # + and * will fuse into this, so much of the time they're not twice as expensive
6666
:vfma => InstructionCost(4,0.5), # + and * will fuse into this, so much of the time they're not twice as expensive
6767
:vfmadd => InstructionCost(4,0.5), # + and * will fuse into this, so much of the time they're not twice as expensive
68-
:vfmsub => InstructionCost(4,0.5), # + and * will fuse into this, so much of the time they're not twice as expensive
69-
:vfnmadd => InstructionCost(4,0.5), # + and * will fuse into this, so much of the time they're not twice as expensive
70-
:vfnmsub => InstructionCost(4,0.5), # + and * will fuse into this, so much of the time they're not twice as expensive
68+
:vfmsub => InstructionCost(4,0.5), # - and * will fuse into this, so much of the time they're not twice as expensive
69+
:vfnmadd => InstructionCost(4,0.5), # + and -* will fuse into this, so much of the time they're not twice as expensive
70+
:vfnmsub => InstructionCost(4,0.5), # - and -* will fuse into this, so much of the time they're not twice as expensive
7171
:sqrt => InstructionCost(15,4.0,-2.0),
7272
:log => InstructionCost(20,20.0,40.0,21),
7373
:exp => InstructionCost(20,20.0,20.0,19),

src/graphs.jl

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,23 @@ isdense(::Type{<:DenseArray}) = true
77
memload
88
memstore
99
reduction
10+
compute
1011
end
1112

1213

1314
struct Operation
14-
outtype::DataType
15+
elementbytes::Int
1516
instruction::Symbol
1617
node_type::NodeType
18+
parents::Vector{Operation}
19+
children::Vector{Operation}
20+
metadata::Vector{Float64}
21+
function Operation(elementbytes, instruction, node_type)
22+
new(
23+
elementbytes, instruction, node_type,
24+
Operation[], Operation[], Float64[]
25+
)
26+
end
1727
end
1828

1929
isreduction(op::Operation) = op.node_type == reduction
@@ -43,6 +53,11 @@ function Base.hash(x::ShortVector, h::UInt)
4353
h
4454
end
4555

56+
function stride(op::Operation, sym::Symbol)
57+
@assert accesses_memory(op) "This operation does not access memory!"
58+
# access stride info?
59+
end
60+
function
4661

4762
struct Node
4863
type::DataType
@@ -107,9 +122,7 @@ function evaluate_cost_unroll(
107122
total_cost = 0.0
108123
iter = 1.0
109124
# Need to check if fusion is possible
110-
W, Wshift = VectorizationBase.pick_vector_width_shift(length(ls, unrolled), biggest_type(ls))::Tuple{Int,Int}
111-
112-
fused_with_previous = fill(false, length(order))
125+
# W, Wshift = VectorizationBase.pick_vector_width_shift(length(ls, unrolled), biggest_type(ls))::Tuple{Int,Int}
113126
for itersym order
114127
# Add to set of defined symbles
115128
push!(nested_loop_syms, itersym)
@@ -119,8 +132,7 @@ function evaluate_cost_unroll(
119132
end
120133
iter *= liter
121134
# check which vars we can define at this level of loop nest
122-
added_vars = 0
123-
for (var,instruction) variables(ls)
135+
for var variables(ls)
124136
# won't define if already defined...
125137
sym(var) included_vars && continue
126138
# it must also be a subset of defined symbols
@@ -131,9 +143,6 @@ function evaluate_cost_unroll(
131143
total_cost += iter * cost(var, W, Wshift, unrolled, liter)
132144
total_cost > max_cost && return total_cost # abort
133145
end
134-
if added_vars == 0
135-
# Then it is worth checking if we can fuse with previous
136-
end
137146
end
138147
end
139148
function evaluate_cost_tile(

0 commit comments

Comments
 (0)