test(ad): GPU/packed-field AD parity for the exchange rules
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Start with test/enzyme_rules.jl, test/device.jl, and test/device_gpu.jl, then inspect the packed-field exchange entry points in src/packedfield.jl and src/transfer_kernels.jl. Add CPU packed-field AD coverage and GPU coverage under MFO_TEST_GPU, checking the declared gradient and ENZ_EXT.rule_hits(). Document whether GPU reverse mode is supported or refused.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
ext/MatrixFreeOperatorsEnzymeCoreExt.jl registers rules on _exchange_storage!/_bc_storage!, which are layout-agnostic: they take raw storage plus a BlockLayout tag, so PackedBlockField goes through the same rules as BlockField. That is the mechanism DESIGN.md §6 calls mandatory for @kernel-authored leaves — the packed GPU exchange must never be differentiated through, and now it structurally cannot be.
None of that is tested on a GPU. Specifically:
- No AD test uses a packed field at all, on any backend.
src/packedfield.jl:17-18still designatesBlockFieldas "the reference layout for AD". test/device.jl/test/device_gpu.jlnever differentiate, soMFO_TEST_GPU=trueadds no AD coverage.- The device exchange path (
_run_exchange!(::PackedBlockField, ...)insrc/transfer_kernels.jl:194-198) dispatches to batched kernels below the rule seam only when the backend is a real GPU. On CPU it falls back to_run_exchange_host!, which is what the current tests exercise — so the rule is verified against the fallback, not against the kernels.
What to add
- CPU-side first — the quick, self-contained first deliverable. It needs no hardware and can land as its own PR ahead of steps 2-3: a packed-field AD test asserting the gradient matches the declared adjoint and that the rules fire (
ENZ_EXT.rule_hits()counters increase across the call), mirroringtest/enzyme_rules.jl. - Under
MFO_TEST_GPU, the same against CUDA arrays — the real question being whether the rule's reverse body (_exchange_storage_adjoint!, which stays on host descriptor loops on all backends by design, seetransfer_kernels.jl:16-23) composes correctly with a forward pass that ran as batched kernels. - Decide and document whether GPU reverse mode is supported or explicitly refused. Right now it is neither — it is untested.
—
🤖 Claude fixed a line number that had wandered off.
claude-opus-5-5[1m] (high) · claude-code 2.1.285 · unreviewed
- Ngôn ngữ chính
- Julia
- Star
- 3
- Fork
- 1
- Merge trung bình
- 1 ngày 28 phút
- Pull request đã merge (30 ngày)
- 6
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của RallypointOne/MatrixFreeOperators.jl
-
Roadmap: open-issue priorityĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
performance
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
-
perf(forest): thread the reference BlockForest path — leaf sweeps and exchange descriptor loopsĐang mởperformance
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Tất cả issue của RallypointOne/MatrixFreeOperators.jl
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
bmad-sim/BeamTracking.jl#382 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Typo in the Adjoint sectionĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
-
Using the test generatorĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày