YaoCompiler.jl
YaoCompiler.jl copied to clipboard
Errors in @trace for the qft example
julia> using YaoCompiler
julia> using YaoCompiler.Intrinsics
julia> @device function qft(n::Int)
1 => H
for k in 2:n
@ctrl k 1 => shift(2π / 2^k)
end
if n > 1
2:n => qft(n - 1)
end
end
qft (generic routine with 1 methods)
julia> YaoCompiler.@trace qft(5)
ERROR: MethodError: no method matching map_check_nothrow(::Locations{UnitRange{Int64}}, ::Locations{Int64})
Closest candidates are:
map_check_nothrow(::Locations{Int64}, ::Locations{Int64}) at /Users/chenzhao/.julia/dev/YaoCompiler/src/runtime/locations.jl:88
map_check_nothrow(::Locations{Tuple{Vararg{Int64, N}}}, ::Locations{Int64}) where N at /Users/chenzhao/.julia/dev/YaoCompiler/src/runtime/locations.jl:104
map_check_nothrow(::Locations, ::CtrlLocations) at /Users/chenzhao/.julia/dev/YaoCompiler/src/runtime/locations.jl:270
Stacktrace:
[1] map_check_nothrow(parent::Locations{UnitRange{Int64}}, sub::CtrlLocations{Int64, 1, 1})
@ YaoCompiler ~/.julia/dev/YaoCompiler/src/runtime/locations.jl:270
[2] map_check(parent::Locations{UnitRange{Int64}}, sub::CtrlLocations{Int64, 1, 1})
@ YaoCompiler ~/.julia/dev/YaoCompiler/src/runtime/locations.jl:85
[3] getindex
@ ~/.julia/dev/YaoCompiler/src/runtime/locations.jl:277 [inlined]
[4] execute
@ ./REPL[5]:4 [inlined]
[5] execute
@ ./REPL[5]:8 [inlined]
[6] execute(#unused#::typeof(YaoCompiler.Semantic.main), #unused#::YaoCompiler.TraceTape, spec::RoutineSpec{GenericRoutine{:qft}, Tuple{Int64}})
@ YaoCompiler ~/.julia/dev/YaoCompiler/src/compiler/codegen/emulation.jl:0
[7] top-level scope
@ ~/.julia/dev/YaoCompiler/src/runtime/intrinsics.jl:129