-
Notifications
You must be signed in to change notification settings - Fork 5
Cut compile time: de-inline setup helpers + add a small precompile workload #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9c3806e
Don't force-inline StridedView setup/view-construction helpers
lkdvos f83ec7b
Add a small PrecompileTools workload for core StridedView ops
lkdvos 565c833
restore inline for recursive functions
lkdvos 6937561
increase precompile workload
lkdvos c798328
remove slop
lkdvos 4c04cf9
bump precompiletools version
lkdvos 879f83c
attempt to fix JET
lkdvos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Precompilation workload | ||
| # ------------------------ | ||
| # Cache the core `StridedView` specializations for the BLAS element types over a small | ||
| # range of dimensionalities and the op-wrappers a `StridedView` can carry. These are the | ||
| # specializations that downstream packages (e.g. TensorOperations / Strided) hit on their | ||
| # first call, so warming them here removes that first-call latency. | ||
| using PrecompileTools: @setup_workload, @compile_workload | ||
|
|
||
| @setup_workload begin | ||
| @compile_workload begin | ||
| for T in (Float32, Float64, ComplexF32, ComplexF64) | ||
| # construction + property queries + core ops for ndims 1:4 | ||
| for N in 1:6 | ||
| A = Array{T, N}(undef, ntuple(_ -> 2, N)) | ||
| sv = StridedView(A) | ||
| size(sv) | ||
| strides(sv) | ||
| offset(sv) | ||
| csv = conj(sv) | ||
| # permute through the identity permutation (exercises the per-N path) | ||
| permutedims(sv, ntuple(identity, N)) | ||
| permutedims(csv, ntuple(identity, N)) | ||
| # reshape to a flat vector and back (also exercises sview on the flat view) | ||
| flat = sreshape(sv, (length(sv),)) | ||
| sview(flat, 1:length(sv)) | ||
| getindex(sv, ntuple(_ -> 1, N)...) | ||
| flat = sreshape(csv, (length(sv),)) | ||
| sview(flat, 1:length(csv)) | ||
| getindex(csv, ntuple(_ -> 1, N)...) | ||
| end | ||
| # 2D matrix wrappers: transpose / adjoint | ||
| M = Array{T, 2}(undef, 2, 2) | ||
| svM = StridedView(M) | ||
| transpose(svM) | ||
| adjoint(svM) | ||
| # a representative 4D slice view (the SliceIndex `getindex` construction path) | ||
| A4 = Array{T, 4}(undef, 2, 2, 2, 2) | ||
| sv4 = StridedView(A4) | ||
| getindex(sv4, :, 1:2, 1, 1:2) | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.