perf(algebra): constant-fold affine time-step operators (α·I + β·Laplacian) into one stencil pass
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 48/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- julia
- 领域
- performance
调研方向
Start with the lazy operator-tree path described around apply!, χ∇², AffineStencil, and the ping-pong idiom, then review the invariants for adjoints, boundary-condition contributions, and trait propagation. Compare the 2046² benchmark in comparisons/chmy_diffusion_2d/ and consider the issue complete when affine constant-coefficient operators fold into one stencil pass with documented usage and the stated performance target is measured.
由索引模型根据 Issue 内容生成。
描述
Context
Sibling of #51 (CPU threading). The Diffusion 2D comparison against Chmy.jl (benchmark/comparisons/chmy_diffusion_2d/) confirmed our fused one-pass stencil beats Chmy's two-kernel flux form 2.5–16.9× single-threaded, with final fields agreeing to machine epsilon. Beyond threading, three ideas would compound the lead. Items 2 and 3 have since moved to their own issues (see below); this issue now tracks item 1 only.
1. Constant-fold affine time-step operators into a single stencil pass (ours to exploit)
Explicit Euler today is two sweeps: apply!(du, χ∇², u) (2 array passes) then u .+= Δt·du (3 passes) — 5 passes/step. But u ← (I + Δt·χ·∇²)u is itself a compact 5-point stencil with center 1 − 4Δtχ/h². An algebraic simplification rule α·I + β·Laplacian → AffineStencil (generally: affine combinations of constant-coefficient stencil leaves) applied ping-pong would make a whole Euler step one fused sweep — ~3 passes/step, a further ~1.7× at DRAM-resident sizes, and 2.3× less traffic than Chmy's 7. Needs: the folded leaf with its declared adjoint (BC contributions included — the invariants stand), explicit trait propagation, and a documented ping-pong idiom. This is the lever Chmy cannot pull cheaply — their flux field is user-visible API, our operator tree is lazy and free to rewrite.
2 and 3 have moved
- The inner/outer split with comm/compute overlap now lives in the distributed tracker: see #46 (build a blocking exchange and measure it before reaching for overlap) under #79.
- "Steer explicit stepping away from the flat
mul!path" is #87.
Target
Numbers to beat at 2046², 5 threads: Chmy 2193 µs/step (~1.9 Gcells/s). Threading (#51) + item 1 project ~3 passes at 150–250 GB/s → roughly 400–700 µs/step, i.e. 3–5× ahead of Chmy at the sizes where we currently lose.
🤖 Beep boop — Claude again, leaving borrowed-blueprint breadcrumbs so future Kyle doesn't have to reverse-engineer his own benchmark.
- 主要语言
- Julia
- 星标
- 3
- 派生
- 1
- 平均合并
- 1 分钟
- 30 天内合并 PR
- 1
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
RallypointOne/MatrixFreeOperators.jl 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 45/100
-
enhancement
难度 4/5 3-5 天 新手友好度 48/100
-
performance
难度 5/5 一周以上 新手友好度 45/100
-
performance
难度 4/5 3-5 天 新手友好度 48/100
-
enhancement
难度 5/5 一周以上 新手友好度 25/100
查看 RallypointOne/MatrixFreeOperators.jl 的全部 Issue
相似的 Issue
-
lux
难度 2/5 1-3 小时 新手友好度 76/100
JuliaGraphs/GraphNeuralNetworks.jl#732 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
erfinv(::Float16) and erfcinv(::Float16) are wrong for abs(x) <= 0.75 (erfinv(Float16(0)) == 0.2201)未关闭
难度 2/5 1-3 小时 新手友好度 82/100
JuliaMath/SpecialFunctions.jl#571 ·
-
难度 2/5 1-3 小时 新手友好度 74/100
-
难度 2/5 1-3 小时 新手友好度 67/100