feat: alloc profile analyzer (top_alloc_types/leaves/frames + report)#8
Merged
Merged
Conversation
e332750 to
1a44f44
Compare
jack-champagne
added a commit
that referenced
this pull request
May 20, 2026
Bring HBJ's `.github/` up to parity with the Piccolo.jl-shaped layout that the rest of the org uses. Files are copied verbatim from Piccolo unless noted. Workflows --------- - **CI.yml**: replace the precompile-only smoke check with the canonical matrix test workflow — runs `julia-runtest`, processes coverage, and uploads to codecov on Julia 1.10/1.11/1.12 + Linux x64. Adds `paths-ignore: ['docs/**', '*.md']` so doc-only PRs don't burn CI minutes once docs/ exists. - **Formatter.yml** *(new)*: JuliaFormatter check on PR/push, with workflow_dispatch escape hatch to autoformat + commit. - **nightly.yml** *(new)*: daily Julia 'pre' install check (matches Piccolo — install-only, not test run; intentionally lighter than DTO's nightly). - **TagBot.yml**: cosmetic — unquote `lookback: 3` to match Piccolo exactly (functionally identical, both parse as string). (Piccolo's `tasksmd-sync.yml` is intentionally omitted — HBJ doesn't use the TASKS.md convention and adding the workflow speculatively is clutter.) dependabot.yml -------------- Add the `julia` ecosystem alongside `github-actions` so dependabot opens compat-bump PRs against Project.toml weekly. Comments restored to Piccolo's verbose form. CI.yml previously only checked that the package precompiles and loads — so the test suite was never actually run on CI. This commit fixes that gap; downstream branches (e.g. the alloc-analyzer PR #8) will rebase on top of this to pick up the real test runs.
98fc9d6 to
f5c08c4
Compare
jack-champagne
added a commit
that referenced
this pull request
May 20, 2026
Bring HBJ's `.github/` up to parity with the Piccolo.jl-shaped layout that the rest of the org uses. Files are copied verbatim from Piccolo unless noted. Workflows --------- - **CI.yml**: replace the precompile-only smoke check with the canonical matrix test workflow — runs `julia-runtest`, processes coverage, and uploads to codecov on Julia 1.10/1.11/1.12 + Linux x64. Adds `paths-ignore: ['docs/**', '*.md']` so doc-only PRs don't burn CI minutes once docs/ exists. - **Formatter.yml** *(new)*: JuliaFormatter check on PR/push, with workflow_dispatch escape hatch to autoformat + commit. - **nightly.yml** *(new)*: daily Julia 'pre' install check (matches Piccolo — install-only, not test run; intentionally lighter than DTO's nightly). - **tasksmd-sync.yml** *(new)*: TASKS.md ↔ org GitHub Project sync. Filtered on `paths: ['TASKS.md']` so it's a no-op until/unless HBJ adopts the TASKS.md convention. - **TagBot.yml**: cosmetic — unquote `lookback: 3` to match Piccolo exactly (functionally identical, both parse as string). dependabot.yml -------------- Add the `julia` ecosystem alongside `github-actions` so dependabot opens compat-bump PRs against Project.toml weekly. Comments restored to Piccolo's verbose form. CI.yml previously only checked that the package precompiles and loads — so the test suite was never actually run on CI. This commit fixes that gap; downstream branches (e.g. the alloc-analyzer PR #8) will rebase on top of this to pick up the real test runs.
e21d665 to
60463a7
Compare
Adds `src/analyze.jl` — aggregation helpers for `AllocProfileResult`
that previously lived as a DTO-local script
(`DirectTrajOpt.jl/benchmark/analyze_allocs.jl`) but are general-purpose
and belong next to `benchmark_memory!` here in HBJ.
Three core query functions return `Vector{AllocFrameSummary}` sorted by
allocated bytes, with optional `1/sample_rate` extrapolation:
- `top_alloc_types(profile; k=15)` — by allocated type
- `top_alloc_leaves(profile; k=25)` — by first non-noise/non-wrapper
frame (the user-code call site)
- `top_alloc_frames(profile; k=25)` — by every frame in every sample's
stacktrace
Built-in noise patterns drop Julia runtime / GC / `Profile.Allocs` /
loader frames; built-in HBJ-wrapper patterns drop `benchmark_memory!` and
package-internal frames so the leaf view shows actual user code. Both
sets are extensible via `extra_noise` / `extra_wrappers` kwargs for
caller-specific patterns (e.g. an integration that wants to drop its
own dispatch shims).
`report_alloc_profile` is a pretty-printer that calls all three.
Also adds Printf to `[deps]` / `[compat]` (was implicitly available
through the runtime but not declared) and a unit test that builds a
synthetic `AllocProfileResult`, verifies noise filtering, scaling, and
extra-pattern threading.
60463a7 to
3b1f029
Compare
jack-champagne
added a commit
that referenced
this pull request
May 20, 2026
* chore: align .github structure with Piccolo conventions Bring HBJ's `.github/` up to parity with the Piccolo.jl-shaped layout that the rest of the org uses. Files are copied verbatim from Piccolo unless noted. Workflows --------- - **CI.yml**: replace the precompile-only smoke check with the canonical matrix test workflow — runs `julia-runtest`, processes coverage, and uploads to codecov on Julia 1.10/1.11/1.12 + Linux x64. Adds `paths-ignore: ['docs/**', '*.md']` so doc-only PRs don't burn CI minutes once docs/ exists. - **Formatter.yml** *(new)*: JuliaFormatter check on PR/push, with workflow_dispatch escape hatch to autoformat + commit. - **nightly.yml** *(new)*: daily Julia 'pre' install check (matches Piccolo — install-only, not test run; intentionally lighter than DTO's nightly). - **TagBot.yml**: cosmetic — unquote `lookback: 3` to match Piccolo exactly (functionally identical, both parse as string). (Piccolo's `tasksmd-sync.yml` is intentionally omitted — HBJ doesn't use the TASKS.md convention and adding the workflow speculatively is clutter.) dependabot.yml -------------- Add the `julia` ecosystem alongside `github-actions` so dependabot opens compat-bump PRs against Project.toml weekly. Comments restored to Piccolo's verbose form. CI.yml previously only checked that the package precompiles and loads — so the test suite was never actually run on CI. This commit fixes that gap; downstream branches (e.g. the alloc-analyzer PR #8) will rebase on top of this to pick up the real test runs. * chore: apply JuliaFormatter to existing tree The Formatter workflow added in the previous commit will reject any source file that isn't JuliaFormatter-clean. HBJ has never had a formatter check, so the existing tree had accumulated formatter debt (multi-line arg lists kept on one line, short conjunctions split across multiple lines, etc). Apply `JuliaFormatter.format(".")` over the whole repo so the Formatter CI check on this PR (and every PR thereafter) starts from a clean baseline. No semantic changes. Touched: examples/convergence_template.jl, src/extractors.jl, src/harness.jl, src/report.jl, src/schema.jl, src/storage.jl, test/runtests.jl.
4 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds
src/analyze.jl— aggregation helpers forAllocProfileResultthatpreviously lived as a DTO-local script in
harmoniqs/DirectTrajOpt.jl#71
(
benchmark/analyze_allocs.jl) but are general-purpose and belong next tobenchmark_memory!here in HBJ.PR #71 in DTO is stale and most of its value is now covered by HBJ v0.2.0's
benchmark_memory!. The one piece worth keeping is the analyzer — porting ithere so any HBJ consumer (DTO, Piccolissimo, Piccolo, …) can call it on the
profiles
benchmark_memory!produces, without each downstream having its owncopy.
What's in the PR
Three query functions return
Vector{AllocFrameSummary}sorted by allocatedbytes, with optional
1 / \texttt{sample\_rate}extrapolation:top_alloc_types(profile; k=15)— by allocated typetop_alloc_leaves(profile; k=25)— by first non-noise/non-wrapper frame (theuser-code call site that actually allocated)
top_alloc_frames(profile; k=25)— by every frame in every sample's stackBuilt-in noise patterns drop Julia runtime / GC /
Profile.Allocs/ loaderframes; built-in HBJ-wrapper patterns drop
benchmark_memory!andpackage-internal frames so leaf views show actual user code. Both sets are
extensible via
extra_noise/extra_wrapperskwargs.report_alloc_profileis a pretty-printer that calls all three.Also adds
Printfto[deps]/[compat](was implicitly loaded by otherdeps but not declared).
Test plan
Pkg.test()passes locally — 295 passing, including a newanalyze: top_alloc_types / leaves / framestestset that builds a syntheticAllocProfileResult, verifies noise filtering, sample-rate scaling, andextra_noise/extra_wrappersthreading.alloc analysis (DTO, Piccolissimo) can pull this in via
using HarmoniqsBenchmarks: report_alloc_profileFollow-up
The DTO-local
benchmark/analyze_allocs.jlCLI driver (reads fromresults/allocs/, prints reports) can become a 10-line wrapper aroundreport_alloc_profilein DTO once HBJ ships these helpers.