Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

test(ad): GPU/packed-field AD parity for the exchange rules

Đang mở
#43 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
julia
Lĩnh vực
backend, testing

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ả

enhancement

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-18 still designates BlockField as "the reference layout for AD".
  • test/device.jl / test/device_gpu.jl never differentiate, so MFO_TEST_GPU=true adds no AD coverage.
  • The device exchange path (_run_exchange!(::PackedBlockField, ...) in src/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

  1. 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), mirroring test/enzyme_rules.jl.
  2. 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, see transfer_kernels.jl:16-23) composes correctly with a forward pass that ran as batched kernels.
  3. 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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của RallypointOne/MatrixFreeOperators.jl

Tất cả issue của RallypointOne/MatrixFreeOperators.jl

Issue tương tự

Thêm issue về Julia

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.