cuda.core: support "3D copies with attributes" (follow-on to issue #2365)
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 静か
- 技術スタック
- python
調査の方向性
まず #2636 の実装と既存の _memory.copy_enums の連携部分を読み、続いて StridedMemoryView と texture.Array/MipmappedArray を確認します。実装前に、サポートするオペランド型、pitch と extent の導出、バージョンおよびエラー時の動作に関する設計上の問題を解決してください。属性を持つ 3D コピーの API が確定し、対応する CUDA 13.2 の gating と安全性チェックが備わっていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
#2365 tracked two CUDA 13.2 attribute-carrying copy entry points together. #2636 implemented the flat 1D case (cuMemcpyWithAttributesAsync, exposed via Buffer.copy_to/Buffer.copy_from's new options keyword). This issue splits off the remaining, unimplemented half:
cuMemcpy3DWithAttributesAsync(CUDA_MEMCPY3D_BATCH_OP* op, unsigned long long flags, CUstream)— executes a single 3D copy operation described by aCUDA_MEMCPY3D_BATCH_OP, reusing theCUmemcpySrcAccessOrder/CUmemcpyFlagsmachinery already introduced forcuMemcpyBatchAsync(12.8) and consumed by#2636'sCopyOptions.
cuda.core has no API for 3D/strided copies with attributes today.
Underlying C API
cuMemcpy3DWithAttributesAsync (CUDA 13.2). Takes a single CUDA_MEMCPY3D_BATCH_OP:
src,dst:CUmemcpy3DOperand, each either a raw pointer operand (base pointer + row/depth pitch, matching a strided/3D buffer layout) or a CUDA array operand (CUarray/CUmipmappedArray+ subresource).extent:CUextent3D(width/height/depth), all three components must be nonzero.srcAccessOrder:CUmemcpySrcAccessOrder— the same three-way hint (STREAM/DURING_API_CALL/ANY) as the 1D and batched entry points.flags:CUmemcpyFlags(e.g.CU_MEMCPY_FLAG_PREFER_OVERLAP_WITH_COMPUTE), same as the other attribute-carrying copies.
Relation to #2636
Should reuse as much of #2636's plumbing as possible rather than duplicating it:
MemcpySrcAccessOrder/MemcpyOverlapMode(cuda.core._memory._copy_enums) — same enums, no new ones needed for those two fields.- The
DURING_API_CALLfallback hazard and its guard,_reject_unsupported_during_api_call— the pointer-operand fallback (if any) would have the same correctness hazard as the 1D/batched paths and needs the same treatment, not a silently-downgraded copy. - The
_with_attributes_available()-style CUDA 13.2 version gate, and the graph-capture /LEGACY_DEFAULT_STREAMrejection pattern established there.
Design sketch (draft — needs design-meeting review)
[!IMPORTANT]
Starting point only, not a settled design.
cuda.core already has StridedMemoryView with copy_to/copy_from, and separately texture.Array/texture.MipmappedArray for CUDA-array-backed storage. The pointer-operand case maps naturally onto a strided/3D buffer view; the array-operand case maps onto the existing texture array types. Open questions for the meeting:
- Does this become
StridedMemoryView.copy_to/copy_fromgaining anoptionskeyword (pointer operands), a new API for the array-operand case, or both under one entry point? - How do row/depth pitch and extent get derived: from
StridedMemoryView's shape/strides directly, or does the caller supply them explicitly? - Should mixed operand kinds be supported in one call (e.g. array → pointer), or should the initial version only cover the common pointer-to-pointer case?
- Version gating (CUDA 13.2+) and error behavior, matching the pattern established in #2636.
- Separate PR from any future
cuMemcpy3DBatchAsync(multiple 3D ops per call) work, if that ever gets tracked.
References
- Driver docs: https://docs.nvidia.com/cuda/cuda-driver-api/
- Parent issue: #2365
- Implements the 1D half: #2636
- 主要言語
- Cython
- スター
- 3.4k
- フォーク
- 329
- 平均マージ
- 1日 21時間
- マージ済み PR(30日)
- 113
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NVIDIA/cuda-python のほかの issue
-
bug cuda.core
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
NVIDIA/cuda-python#2886 · コメント 1 件 ·
-
triage
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
NVIDIA/cuda-python#2717 ·
-
triage
難易度 1/5 1〜3時間 初心者へのやさしさ 90/100
NVIDIA/cuda-python#2712 ·
-
triage
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
NVIDIA/cuda-python#2646 · リアクション 1 件 ·
-
cuda.core triage
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
NVIDIA/cuda-python#2435 · コメント 1 件 ·
NVIDIA/cuda-python の issue をすべて見る
似ている issue
-
bug priority:normal ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
OpenHands/extensions#626 · コメント 1 件 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
avniproject/avni-client#2135 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
use-agent-os/agent-os#3276 ·