← Back to Pull requests

nvme-ep: add GPU-initiated NVMe Key-Value Store/Retrieve #177

Closed
unknown closed this pull request without merging on Sep 16, 2026 23:00 UTC
View on GitHub
unknown unknown commented on Jun 09, 2026 16:41 UTC
Author

Add a GPU-initiated NVMe Key-Value path to the nvme-ep endpoint: the GPU issues KV Store then Retrieve from __device__ code via a new nvme-ep --kv-op mode, with the value landing directly in GPU memory.

  • src/include/nvme-kv.h: KV command/opcode definitions

  • src/endpoints/nvme-ep/nvme-ep.{h,hip}: KV Store/Retrieve handling

  • src/tester/xio-cli-options.cpp: --kv-op CLI option

  • docs/nvme-kv.md: design + usage notes

  • examples/: KV CPU probe and GPU-over-RADOS demo harness
  • Motivation

    nvme-ep today drives block I/O from the GPU. This adds the NVMe Key-Value Command Set (Store/Retrieve) so device code can put/get values keyed by name, with the value transferred straight into GPU-accessible memory (host or VRAM/P2PDMA) — no CPU round-trip on the data path. The motivating workload is GPU-initiated fetch of key-addressed blobs (e.g. weight shards) directly into VRAM. The feature is additive: it's a flag on the existing endpoint, and block behavior is unchanged when --kv-op is not set.

    Technical Details

  • Additive flag, not a new endpoint. KV reuses the entire nvme-ep machinery verbatim — admin/IO queue creation, doorbells (including the --pci-mmio-bridge path), PRP/value-buffer allocation (host and VRAM/P2PDMA via --memory-mode 8), CQ polling, and the endpoint registry/dispatch. The only deltas are the SQE encoding and reading the returned value length from the completion. driveEndpointKv() is a sibling of driveEndpointSingle(), selected by ioParams.kvOpcode.

  • Wire format follows the NVMe KV Command Set spec, so it interoperates with any conformant KV controller. Opcodes are numerically equal to block Write/Read; the controller routes them as KV because the namespace CSI is Key Value (0x1). Key bytes ride in CDW2/3 + CDW14/15, key length in CDW11, value size in CDW10; Retrieve reads the true stored value length from CQE DW0. See docs/nvme-kv.md for the full field table.

  • Block-only queries are gated in KV mode (KV namespaces have no block LBA format or capacity), and the KV device routine is single-thread guarded so it can't race the shared queues if launched with --batch-size > 1.

  • Reference target: validated against an SPDK vfio-user kvdev_rados namespace over Ceph RADOS (examples/stage2_kv_rados_gpu.sh); any other NVMe-KV target presenting a CSI=KV namespace works unchanged from the host side.

  • Known follow-ups (tracked in the doc): batched/wavefront KV (current path is serial single-thread), and KV Delete/Exist/List opcodes (defines are present; handling is not wired yet).
  • Test Plan

  • Build: incremental hipcc build of xio-tester (cmake --build build).

  • Unit tests: ctest -R "cli-options|nvme-config|nvme-helpers|nvme-hardware".

  • CPU-only path validation (GPU-free): examples/kv_cpu_probe.c issues a KV Sto/nvme0 via the kernel NVMe passthrough ioctl, exercising guest enumeration ofthe KV controller and the exact KV SQE encoding without the GPU doorbell.

  • End-to-end GPU run: examples/stage2_kv_rados_gpu.sh stands up the SPDK vfio-S and runs a GPU __device__ Store + Retrieve, verifying the value lands in GPUmemory and the stored object exists in RADOS (rados ... stat).
  • Test Result

  • Build: clean; xio-tester and test-xio-cli-options link without warnings on the changed files.

  • Unit tests: test-nvme-config, test-nvme-helpers, test-xio-cli-options pass; equires hardware).

  • End-to-end GPU run: verified. The guest Linux NVMe driver enumerates the KV-only controller directly (CC.CSS=IOCS, exposes /dev/nvme0, no block namespace required); GPU-initiated KV Store then Retrieve completes, the returned value length is reported from CQE emory, and the store is confirmed via rados -p kvpool -N kvns stat.
  • Submission Checklist

  • Look over the contributing guidelines at https://github.com/ROCm/ROCm/blll-requests.
  • Diff: 477 lines (+357 / -120) across 5 files Reviewer: mmgaggle Review duration: 142938m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 477 lines diff across 5 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.369
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #177"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.8% (MEDIUM) · Higher = larger blast radius
    45.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.1% · Safe to merge
    18.1%
    Repository