Skip to content

Commit

Permalink
Merge pull request #107 from timholy/teh/split_fixes
Browse files Browse the repository at this point in the history
Various fixes (mostly for the split)
  • Loading branch information
timholy authored Jun 24, 2020
2 parents f9ea9ea + 3e25fa3 commit 0aa0dae
Show file tree
Hide file tree
Showing 21 changed files with 127 additions and 29 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@ on:
tags: [v*]
pull_request:

defaults:
run:
shell: bash

jobs:
Documenter:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
version: nightly
- run: julia --project -e 'using Pkg; Pkg.develop([PackageSpec(path="SnoopCompileCore"),
PackageSpec(path="SnoopCompileAnalysis"),
PackageSpec(path="SnoopCompileBot")])'
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-docdeploy@releases/v1
env:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: CI
on:
- push
- pull_request
defaults:
run:
shell: bash
jobs:
test:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
Expand All @@ -27,6 +30,9 @@ jobs:
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- run: julia --project -e 'using Pkg; Pkg.develop([PackageSpec(path="SnoopCompileCore"),
PackageSpec(path="SnoopCompileAnalysis"),
PackageSpec(path="SnoopCompileBot")])'
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest

Expand Down
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SnoopCompile"
uuid = "aa65fe97-06da-5843-b5b1-d5d13cad87d2"
author = ["Tim Holy <tim.holy@gmail.com>"]
version = "1.6.0"
version = "1.6.1"

[deps]
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Expand All @@ -11,9 +11,9 @@ SnoopCompileBot = "1d5e0e55-7d74-4714-b8d8-efa80e938cf7"
SnoopCompileCore = "e2b509da-e806-4183-be48-004708413034"

[compat]
SnoopCompileAnalysis = "1"
SnoopCompileBot = "1"
SnoopCompileCore = "1"
SnoopCompileAnalysis = "~1.6.1"
SnoopCompileBot = "~1.6.1"
SnoopCompileCore = "~1.6.1"
julia = "1"

[extras]
Expand Down
22 changes: 22 additions & 0 deletions SnoopCompileAnalysis/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The SnoopCompile.jl package is licensed under the MIT "Expat" License:

> Copyright (c) 2015: Tim Holy.
>
> Permission is hereby granted, free of charge, to any person obtaining
> a copy of this software and associated documentation files (the
> "Software"), to deal in the Software without restriction, including
> without limitation the rights to use, copy, modify, merge, publish,
> distribute, sublicense, and/or sell copies of the Software, and to
> permit persons to whom the Software is furnished to do so, subject to
> the following conditions:
>
> The above copyright notice and this permission notice shall be
> included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion SnoopCompileAnalysis/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SnoopCompileAnalysis"
uuid = "9ea4277c-da97-4c3a-afb0-537c066769de"
author = ["Tim Holy <tim.holy@gmail.com>"]
version = "1.6.0"
version = "1.6.1"

[deps]
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
Expand Down
3 changes: 3 additions & 0 deletions SnoopCompileAnalysis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SnoopCompileAnalysis

SnoopCompileAnalysis is a component of [SnoopCompile](https://github.com/timholy/SnoopCompile.jl).
4 changes: 3 additions & 1 deletion SnoopCompileAnalysis/src/invalidations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ end
"""
trees = invalidation_trees(list)
Parse `list`, as captured by [`@snoopr`](@ref), into a set of invalidation trees, where parents nodes
Parse `list`, as captured by [`SnoopCompileCore.@snoopr`](@ref), into a set of invalidation trees, where parents nodes
were called by their children.
# Example
Expand Down Expand Up @@ -284,6 +284,7 @@ function invalidation_trees(list)
push!(methodinvs, sort!(MethodInvalidations(method, reason, mt_backedges, backedges, mt_cache)))
mt_backedges, backedges, mt_cache = methinv_storage()
leaf = nothing
reason = nothing
else
error("unexpected item ", item, " at ", i)
end
Expand All @@ -292,6 +293,7 @@ function invalidation_trees(list)
reason = checkreason(reason, item)
push!(backedges, getroot(leaf))
leaf = nothing
reason = nothing
elseif isa(item, Type)
push!(mt_backedges, item=>getroot(leaf))
leaf = nothing
Expand Down
22 changes: 22 additions & 0 deletions SnoopCompileBot/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The SnoopCompile.jl package is licensed under the MIT "Expat" License:

> Copyright (c) 2020: Amin Yahyaabadi
>
> Permission is hereby granted, free of charge, to any person obtaining
> a copy of this software and associated documentation files (the
> "Software"), to deal in the Software without restriction, including
> without limitation the rights to use, copy, modify, merge, publish,
> distribute, sublicense, and/or sell copies of the Software, and to
> permit persons to whom the Software is furnished to do so, subject to
> the following conditions:
>
> The above copyright notice and this permission notice shall be
> included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6 changes: 3 additions & 3 deletions SnoopCompileBot/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SnoopCompileBot"
uuid = "1d5e0e55-7d74-4714-b8d8-efa80e938cf7"
author = ["Amin Yahyaabadi <aminyahyaabadi74@gmail.com>"]
version = "1.6.0"
version = "1.6.1"

[deps]
FilePathsBase = "48062228-2e41-5def-b9a4-89aafe57970f"
Expand All @@ -12,8 +12,8 @@ SnoopCompileCore = "e2b509da-e806-4183-be48-004708413034"

[compat]
FilePathsBase = "0.9"
SnoopCompileAnalysis = "1"
SnoopCompileCore = "1"
SnoopCompileAnalysis = "~1.6.1"
SnoopCompileCore = "~1.6.1"
YAML = "0.4"
julia = "1"

Expand Down
3 changes: 3 additions & 0 deletions SnoopCompileBot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SnoopCompileBot

SnoopCompileBot is a component of [SnoopCompile](https://github.com/timholy/SnoopCompile.jl).
10 changes: 5 additions & 5 deletions SnoopCompileBot/src/botutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Standardize different names from Github actions, Travis, etc
https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources
# Examples
```jldoctest
```jldoctest; setup=:(using SnoopCompile)
julia> SnoopCompile.standardize_osname("ubuntu-latest")
"linux"
Expand Down Expand Up @@ -281,13 +281,13 @@ returns the Julia version number by following the same specifications as Version
`JuliaVersionNumber` will fetch the latest nightly version number if `"nightly"` or `"latest"` is given as the input.
# Examples
```julia
julia> JuliaVersionNumber("nightly")
julia> SnoopCompile.JuliaVersionNumber("nightly")
v"1.6.0-DEV"
```
```jldoctest
julia> JuliaVersionNumber("1.2.3")
```jldoctest; setup=:(using SnoopCompile)
julia> SnoopCompile.JuliaVersionNumber("1.2.3")
v"1.2.3"
julia> JuliaVersionNumber(v"1.2.3")
julia> SnoopCompile.JuliaVersionNumber(v"1.2.3")
v"1.2.3"
```
"""
Expand Down
2 changes: 1 addition & 1 deletion SnoopCompileBot/src/snoop_bench.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Benchmark the impact of precompile statements, by running a script with and with
`config` can be generated by [`BotConfig`](@ref).
`path_to_example_script` is preferred to be an absolute path.
The example script will be run in the module specified by `test_modul`.
`snoop_mode` can be `:auto`, `:snoopi` (to test with [`@snoopi`](@ref)),
`snoop_mode` can be `:auto`, `:snoopi` (to test with [`SnoopCompileCore.@snoopi`](@ref)),
or `:runtime` (to measure total script run time with `@timev`).
`:auto` chooses `:snoopi` on supported versions of Julia.
Expand Down
4 changes: 2 additions & 2 deletions SnoopCompileBot/src/snoop_bot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ Generate precompile statements using a precompile script.
`config` can be generated by [`BotConfig`](@ref).
`path_to_example_script` is preferred to be an absolute path.
The example script will be run in the module specified by `test_modul`.
`snoop_mode` can be `:auto`, `:snoopi` (to run [`@snoopi`](@ref)),
or `:snoopc` (to run [`@snoopc`](@ref)),
`snoop_mode` can be `:auto`, `:snoopi` (to run [`SnoopCompileCore.@snoopi`](@ref)),
or `:snoopc` (to run [`SnoopCompileCore.@snoopc`](@ref)),
where `:auto` chooses `:snoopi` on supported versions of Julia.
See the [online documentation](https://timholy.github.io/SnoopCompile.jl/stable/bot/)
Expand Down
22 changes: 22 additions & 0 deletions SnoopCompileCore/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The SnoopCompile.jl package is licensed under the MIT "Expat" License:

> Copyright (c) 2015: Tim Holy.
>
> Permission is hereby granted, free of charge, to any person obtaining
> a copy of this software and associated documentation files (the
> "Software"), to deal in the Software without restriction, including
> without limitation the rights to use, copy, modify, merge, publish,
> distribute, sublicense, and/or sell copies of the Software, and to
> permit persons to whom the Software is furnished to do so, subject to
> the following conditions:
>
> The above copyright notice and this permission notice shall be
> included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion SnoopCompileCore/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SnoopCompileCore"
uuid = "e2b509da-e806-4183-be48-004708413034"
author = ["Tim Holy <tim.holy@gmail.com>"]
version = "1.6.0"
version = "1.6.1"

[deps]
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
Expand Down
3 changes: 3 additions & 0 deletions SnoopCompileCore/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SnoopCompileCore

SnoopCompileCore is a component of [SnoopCompile](https://github.com/timholy/SnoopCompile.jl).
2 changes: 1 addition & 1 deletion SnoopCompileCore/src/snoopr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Capture method cache invalidations triggered by evaluating `expr`.
of integers (encoding depth) and strings (documenting the source of an invalidation).
Unless you are working at a low level, you essentially always want to pass `list`
directly to [`invalidation_trees`](@ref).
directly to [`SnoopCompileAnalysis.invalidation_trees`](@ref).
# Extended help
Expand Down
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ makedocs(
format = Documenter.HTML(
prettyurls = get(ENV, "CI", nothing) == "true"
),
modules = [SnoopCompile],
modules = [SnoopCompile.SnoopCompileCore, SnoopCompile.SnoopCompileAnalysis, SnoopCompile.SnoopCompileBot, SnoopCompile],
pages = ["index.md", "snoopi.md", "snoopc.md", "userimg.md", "bot.md", "snoopr.md", "reference.md"]
)

Expand Down
10 changes: 8 additions & 2 deletions docs/src/snoopr.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ So we can see the consequences for the compiled code, we'll make this definition

```jldoctest invalidations
julia> trees = invalidation_trees(@snoopr f(::Float64) = 2)
1-element Array{SnoopCompile.MethodInvalidations,1}:
1-element Array{SnoopCompileAnalysis.MethodInvalidations,1}:
inserting f(::Float64) in Main at REPL[9]:1 invalidated:
backedges: 1: superseding f(::Real) in Main at REPL[2]:1 with MethodInstance for f(::Float64) (2 children) more specific
2: superseding f(::Real) in Main at REPL[2]:1 with MethodInstance for f(::AbstractFloat) (2 children) more specific
2 mt_cache
```

The list of `MethodInvalidations` indicates that some previously-compiled code got invalidated.
Expand Down Expand Up @@ -85,7 +86,7 @@ This is often seen with more complex, real-world tests:

```julia
julia> trees = invalidation_trees(@snoopr using SIMD)
4-element Array{SnoopCompile.MethodInvalidations,1}:
4-element Array{SnoopCompileAnalysis.MethodInvalidations,1}:
inserting convert(::Type{Tuple{Vararg{R,N}}}, v::Vec{N,T}) where {N, R, T} in SIMD at /home/tim/.julia/packages/SIMD/Am38N/src/SIMD.jl:182 invalidated:
mt_backedges: 1: signature Tuple{typeof(convert),Type{Tuple{DataType,DataType,DataType}},Any} triggered MethodInstance for Pair{DataType,Tuple{DataType,DataType,DataType}}(::Any, ::Any) (0 children) ambiguous
2: signature Tuple{typeof(convert),Type{NTuple{8,DataType}},Any} triggered MethodInstance for Pair{DataType,NTuple{8,DataType}}(::Any, ::Any) (0 children) ambiguous
Expand Down Expand Up @@ -159,6 +160,11 @@ MethodInstance for pointer(::String, ::Integer) (1027 children)

Many nodes in this tree have multiple "child" branches.

!!! note
These `trees` are sorted so that the last items have the largest number of children.
It works this way so that long printouts don't have the most important information scroll off the
top of the screen.

## Filtering invalidations

Some methods trigger widespread invalidation.
Expand Down
9 changes: 4 additions & 5 deletions src/SnoopCompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export @snoopc

using SnoopCompileAnalysis

# needed for snoopc
# needed for processing the output of snoopc (avoids a breaking change in scoping)
using SnoopCompileAnalysis: parcel, read, write, parse_call, format_userimg

if isdefined(SnoopCompileCore, Symbol("@snoopi"))
Expand All @@ -14,8 +14,8 @@ if isdefined(SnoopCompileCore, Symbol("@snoopi"))
end

if isdefined(SnoopCompileCore, Symbol("@snoopr"))
export @snoopr, invalidation_trees, filtermod, findcaller
using SnoopCompileAnalysis: getroot
export @snoopr, invalidation_trees, filtermod, findcaller, ascend
using SnoopCompileAnalysis: getroot, remove_if_not_eval!
end

using SnoopCompileBot
Expand All @@ -25,7 +25,6 @@ if isdefined(SnoopCompileBot, Symbol("@snoopiBench"))
# deprecated names
export @snoopiBench, @snoopiBot, @snoopi_bench, @snoopi_bot
end

export SnoopCompileCore, SnoopCompileAnalysis, SnoopCompileBot
using SnoopCompileBot: standardize_osname, JuliaVersionNumber, addtestdep

end # module
4 changes: 2 additions & 2 deletions test/snoopi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ end

@testset "@snoopi docs" begin
# docstring is present (weird Docs bug)
dct = Docs.meta(SnoopCompileCore)
@test haskey(dct, Docs.Binding(SnoopCompileCore, Symbol("@snoopi")))
dct = Docs.meta(SnoopCompile.SnoopCompileCore)
@test haskey(dct, Docs.Binding(SnoopCompile.SnoopCompileCore, Symbol("@snoopi")))
end

@testset "Duplicates (#70)" begin
Expand Down

0 comments on commit 0aa0dae

Please sign in to comment.