Skip to content

Commit e748186

Browse files
committed
Accept some interpolated functions
1 parent 4a7e629 commit e748186

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/costs.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,11 @@ const FUNCTIONSYMBOLS = IdDict{Type{<:Function},Instruction}(
463463
typeof(Base.ifelse) => :ifelse,
464464
typeof(ifelse) => :ifelse,
465465
typeof(identity) => :identity,
466-
typeof(conj) => :conj
466+
typeof(conj) => :conj,
467+
typeof(zero) => :zero,
468+
typeof(one) => :one,
469+
typeof(axes) => :axes,
470+
typeof(eltype) => :eltype
467471
)
468472

469473
# implement whitelist for avx_support that package authors may use to conservatively guard `@avx` application

src/graphs.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,13 @@ end
562562
# end
563563
# instruction(ls::LoopSet, f::Symbol) = instruction!(ls, f)
564564
function instruction!(ls::LoopSet, x::Expr)
565-
x isa Symbol && return x
565+
# x isa Symbol && return x
566+
if x.head === :$
567+
_x = only(x.args)
568+
_x isa Symbol && return instruction!(ls, _x)
569+
@assert _x isa Expr
570+
x = _x
571+
end
566572
instr = last(x.args).value
567573
if instr keys(COST)
568574
instr = gensym(:f)
@@ -571,6 +577,10 @@ function instruction!(ls::LoopSet, x::Expr)
571577
Instruction(Symbol(""), instr)
572578
end
573579
instruction!(ls::LoopSet, x::Symbol) = instruction(x)
580+
function instruction!(ls::LoopSet, ::F) where {F <: Function}
581+
FUNCTIONSYMBOLS[F]
582+
# get(FUNCTIONSYMBOLS, F,
583+
end
574584

575585

576586
function maybe_const_compute!(ls::LoopSet, LHS::Symbol, op::Operation, elementbytes::Int, position::Int)

0 commit comments

Comments
 (0)