Skip to content

Commit 41e479c

Browse files
committed
update README
1 parent c56b1c5 commit 41e479c

File tree

1 file changed

+73
-27
lines changed

1 file changed

+73
-27
lines changed

README.md

Lines changed: 73 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,36 +50,82 @@ julia> @profile_call sum("julia")
5050
│││││││││││││││ no matching method found for signature: zero(::Type{Char})
5151
││││││││││││││└
5252
Char
53+
54+
julia> ary = Union{Symbol,Int}[:one, 1]
55+
56+
julia> @profile_call sum(ary) # can profile on abstract-typed inputs
57+
14 errors found
58+
┌ @ reducedim.jl:867 @inline ($fname)(a::AbstractArray; dims=:, kw...) = ($_fname)(a, dims; kw...)
59+
│┌ @ reducedim.jl:867 @inline ($fname)(a::AbstractArray; dims=:, kw...) = ($_fname)(a, dims; kw...)
60+
││┌ @ reducedim.jl:871 ($_fname)(a, ::Colon; kw...) = ($_fname)(identity, a, :; kw...)
61+
│││┌ @ reducedim.jl:871 ($_fname)(a, ::Colon; kw...) = ($_fname)(identity, a, :; kw...)
62+
││││┌ @ reducedim.jl:872 ($_fname)(f, a, ::Colon; kw...) = mapreduce(f, $op, a; kw...)
63+
│││││┌ @ reducedim.jl:872 ($_fname)(f, a, ::Colon; kw...) = mapreduce(f, $op, a; kw...)
64+
││││││┌ @ reducedim.jl:310 mapreduce(f, op, A::AbstractArrayOrBroadcasted; dims=:, init=_InitialValue()) =
65+
│││││││┌ @ reducedim.jl:310 mapreduce(f, op, A::AbstractArrayOrBroadcasted; dims=:, init=_InitialValue()) =
66+
││││││││┌ @ reducedim.jl:318 _mapreduce_dim(f, op, ::_InitialValue, A::AbstractArrayOrBroadcasted, ::Colon) =
67+
│││││││││┌ @ reduce.jl:396 function _mapreduce(f, op, ::IndexLinear, A::AbstractArrayOrBroadcasted)
68+
││││││││││┌ @ reduce.jl:351 mapreduce_empty_iter(f, op, itr, ItrEltype) =
69+
│││││││││││┌ @ reduce.jl:355 @inline reduce_empty_iter(op, itr, ::HasEltype) = reduce_empty(op, eltype(itr))
70+
││││││││││││┌ @ reduce.jl:329 reduce_empty(op::MappingRF, ::Type{T}) where {T} = mapreduce_empty(op.f, op.rf, T)
71+
│││││││││││││┌ @ reduce.jl:343 mapreduce_empty(::typeof(identity), op, T) = reduce_empty(op, T)
72+
││││││││││││││┌ @ reduce.jl:320 reduce_empty(::typeof(add_sum), ::Type{T}) where {T} = reduce_empty(+, T)
73+
│││││││││││││││┌ @ reduce.jl:311 reduce_empty(::typeof(+), ::Type{T}) where {T} = zero(T)
74+
││││││││││││││││ no matching method found for signature: zero(::Type{Union{Int64, Symbol}})
75+
│││││││││││││││└
76+
││││││││││┌ @ reduce.jl:24 add_sum(x, y) = x + y
77+
│││││││││││ no matching method found for signature: +(::Symbol, ::Int64)
78+
││││││││││└
79+
││││││││││┌ @ reduce.jl:24 add_sum(x, y) = x + y
80+
│││││││││││ no matching method found for signature: +(::Int64, ::Symbol)
81+
││││││││││└
82+
││││││││││┌ @ reduce.jl:24 add_sum(x, y) = x + y
83+
│││││││││││ no matching method found for signature: +(::Symbol, ::Symbol)
84+
││││││││││└
85+
││││││││││┌ @ reduce.jl:24 add_sum(x, y) = x + y
86+
│││││││││││ no matching method found for signature: +(::Int64, ::Symbol)
87+
││││││││││└
88+
││││││││││┌ @ reduce.jl:24 add_sum(x, y) = x + y
89+
│││││││││││ no matching method found for signature: +(::Int64, ::Symbol)
90+
││││││││││└
91+
││││││││││┌ @ reduce.jl:257 mapreduce_impl(f, op, A::AbstractArrayOrBroadcasted, ifirst::Integer, ilast::Integer) =
92+
│││││││││││┌ @ reduce.jl:233 @noinline function mapreduce_impl(f, op, A::AbstractArrayOrBroadcasted,
93+
││││││││││││┌ @ reduce.jl:24 add_sum(x, y) = x + y
94+
│││││││││││││ no matching method found for signature: +(::Symbol, ::Int64)
95+
││││││││││││└
96+
││││││││││││┌ @ reduce.jl:24 add_sum(x, y) = x + y
97+
│││││││││││││ no matching method found for signature: +(::Int64, ::Symbol)
98+
││││││││││││└
99+
││││││││││││┌ @ reduce.jl:24 add_sum(x, y) = x + y
100+
│││││││││││││ no matching method found for signature: +(::Symbol, ::Symbol)
101+
││││││││││││└
102+
││││││││││││┌ @ reduce.jl:24 add_sum(x, y) = x + y
103+
│││││││││││││ no matching method found for signature: +(::Int64, ::Symbol)
104+
││││││││││││└
105+
││││││││││││┌ @ reduce.jl:24 add_sum(x, y) = x + y
106+
│││││││││││││ no matching method found for signature: +(::Int64, ::Symbol)
107+
││││││││││││└
108+
││││││││││││┌ @ reduce.jl:24 add_sum(x, y) = x + y
109+
│││││││││││││ no matching method found for signature: +(::Symbol, ::Int64)
110+
││││││││││││└
111+
││││││││││││┌ @ reduce.jl:24 add_sum(x, y) = x + y
112+
│││││││││││││ no matching method found for signature: +(::Int64, ::Symbol)
113+
││││││││││││└
114+
││││││││││││┌ @ reduce.jl:24 add_sum(x, y) = x + y
115+
│││││││││││││ no matching method found for signature: +(::Symbol, ::Symbol)
116+
││││││││││││└
117+
Union{Int64, Symbol}
53118
```
54119
55120
### TODOs
56121
57122
in order of priority:
58-
59-
- [x] show profiled results
60-
- [x] escape recursive calls
61-
- [ ] bug fixes: `TypeVar` etc. can serious errors within the current implementation
62-
- [ ] toplevel executions
63-
- handle untyped IRs while splitting expressions as JuliaIntepreter.jl does
64-
- then, TP will be able to profile a file directly like an usual static linter
65-
- [ ] more reports
66-
- [ ] `UndefVarError`
67-
- [x] report `GlobalRef` for really undefined variable
68-
- report `:throw_undef_if_not` ? (includes lots of false positives as is)
69-
- [ ] method ambiguity error
70-
- more and more ...
71-
- [ ] don't trace into "primitive" functions in `Core` and `Base`: with the similar approach to https://github.com/FluxML/Mjolnir.jl/tree/9435d98673752cec4e222e31a6b9f38edcd7d5e0/src/lib
72-
- [ ] balance between Julia's inference approach and error profiling
123+
- setup a type-level virtual machine and enable profiling on toplevel code
124+
- more reports
125+
* invalid built-in function calls
126+
* report some cases of `throw`, e.g. `rand('1')::ArgumentError("Sampler for this object is not defined")`
127+
- balance between Julia's inference approach and error profiling ?
73128
- Julia's type inference allows abstract type (like `Any`) to slip into the inference process by various heuristics, in order to ensure its termination and obtain the performance
74-
- but this is obviously unideal for TP, since our basic stance is _"better safe than sorry"_, meaning ideally we want to find all the possible errors while revealing some uncertainty Julia's inference accepts
75-
- nevertheless, as far as TP relies on the Julia's inference, we need to achieve the conservative error profiling in the existence of abstract types, _somehow_
76-
- as a consequence, TP will be able to profile, e.g.:
77-
- [ ] `print`
78-
- [ ] `sort`
79-
- [ ] support generated functions
80-
- [ ] replace `Core` types: enables profiling things in `Core.Compiler` module
81-
82-
### Ideas
83-
84-
- report performance pitfalls
85-
- somehow profiles possible exceptions ?
129+
- but this is somewhat unideal in the context of bug reports, since the stance would be _"better safe than sorry"_, meaning we ideally want to find all the possible errors while revealing some uncertainty Julia's inference accepts
130+
- maybe we need some additional setup for supporting generated functions
131+
- report performance pitfalls ?

0 commit comments

Comments
 (0)