Skip to content

Commit 1fb353d

Browse files
committed
Make broadcasting define unknown functions as broadcasted.f, and change lowering to always reference the module.
1 parent eb5c805 commit 1fb353d

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/broadcast.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ function add_broadcast!(
169169
elementbytes::Int
170170
) where {N,S<:Base.Broadcast.AbstractArrayStyle{N},F,A}
171171
instr = get(FUNCTIONSYMBOLS, F) do
172-
f = gensym(:func)
173-
pushpreamble!(ls, Expr(:(=), f, Expr(:(.), bcname, QuoteNode(:f))))
174-
Instruction(Symbol(""), f)
172+
# f = gensym(:func)
173+
# pushpreamble!(ls, Expr(:(=), f, Expr(:(.), bcname, QuoteNode(:f))))
174+
Instruction(bcname, :f)
175175
end
176176
args = A.parameters
177177
Nargs = length(args)

src/costs.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ end
1414
Instruction(instr::Symbol) = Instruction(:LoopVectorization, instr)
1515
Base.convert(::Type{Instruction}, instr::Symbol) = Instruction(instr)
1616
# lower(instr::Instruction) = Expr(:(.), instr.mod, QuoteNode(instr.instr))
17+
Base.convert(::Type{Expr}, instr::Instruction) = Expr(:(.), instr.mod, QuoteNode(instr.instr))
1718
function Base.Expr(instr::Instruction, args...)
1819
if instr.mod === :LoopVectorization
1920
Expr(:call, lv(instr.instr), args...)::Expr
2021
else
21-
Expr(:call, instr.instr, args...)::Expr
22+
Expr(:call, convert(Expr, instr), args...)::Expr
2223
end
2324
end
2425
Base.hash(instr::Instruction, h::UInt64) = hash(instr.instr, hash(instr.mod, h))
@@ -128,6 +129,8 @@ const COST = Dict{Instruction,InstructionCost}(
128129
Instruction(:(<)) => InstructionCost(1, 0.5),
129130
Instruction(:(>=)) => InstructionCost(1, 0.5),
130131
Instruction(:(<=)) => InstructionCost(1, 0.5),
132+
Instruction(:()) => InstructionCost(1, 0.5),
133+
Instruction(:()) => InstructionCost(1, 0.5),
131134
Instruction(:>>) => InstructionCost(1, 0.5),
132135
Instruction(:>>>) => InstructionCost(1, 0.5),
133136
Instruction(:<<) => InstructionCost(1, 0.5),

src/determinestrategy.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ function cost(op::Operation, unrolled::Symbol, Wshift::Int, size_T::Int = op.ele
1414
isconstant(op) && return 0.0, 0, 1
1515
# Wshift == dependson(op, unrolled) ? Wshift : 0
1616
# c = first(cost(instruction(op), Wshift, size_T))::Int
17-
instr = instruction(op)
17+
instr = Instruction(:LoopVectorization, instruction(op).instr)
18+
# instr = instruction(op)
1819
if length(parents(op)) == 1
1920
if instr == Instruction(:-) || instr === Instruction(:vsub) || instr == Instruction(:+) || instr == Instruction(:vadd)
2021
return 0.0, 0, 1

0 commit comments

Comments
 (0)