Repository navigation
feat(snapshot): add shared CUDA CustomStorage operation layer #12488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
hhzhang16
merged 11 commits into
main
from
hannahz/dyn-3691-extract-shared-target-pid-cuda-customstorage-operation-layer
Aug 7, 2026
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
321836b
feat: roundtrip test for cuda-checkpoint with customstorage
hhzhang16 e4b0aa6
fix: address Linux warnings in CustomStorage harness
hhzhang16 f7d046d
Merge branch 'main' of https://github.com/ai-dynamo/dynamo into hanna…
hhzhang16 143138e
refactor(snapshot): share CustomStorage operation handling
hhzhang16 6cec1b9
refactor: move things around within benchmark for customstorage
hhzhang16 731eba8
feat: add new benchmark to codeowners and areas for gms codeowners
hhzhang16 3ac6bd3
Merge branch 'main' of https://github.com/ai-dynamo/dynamo into hanna…
hhzhang16 088daf3
fix: address MR comments
hhzhang16 614e1c1
Merge branch 'main' of https://github.com/ai-dynamo/dynamo into hanna…
hhzhang16 dd0b602
Merge branch 'main' into hannahz/dyn-3691-extract-shared-target-pid-c…
hhzhang16 c296a30
Merge branch 'main' into hannahz/dyn-3691-extract-shared-target-pid-c…
hhzhang16 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| CUDA_HOME ?= /usr/local/cuda | ||
| CXX ?= g++ | ||
| CXXFLAGS ?= -O2 -g | ||
|
|
||
| TARGET := cuda-custom-storage-roundtrip | ||
| SHARED_DIR := ../../deploy/snapshot/cmd/cuda-checkpoint-helper | ||
| SOURCES := roundtrip.cpp $(SHARED_DIR)/custom_storage_operation.cpp | ||
|
|
||
| .PHONY: all clean | ||
|
|
||
| all: $(TARGET) | ||
|
|
||
| $(TARGET): $(SOURCES) $(SHARED_DIR)/custom_storage_operation.h $(SHARED_DIR)/cuda_checkpoint_compat.h | ||
| $(CXX) -std=c++20 $(CXXFLAGS) -Wall -Wextra -Werror \ | ||
| -I$(CUDA_HOME)/include \ | ||
| -I$(SHARED_DIR) \ | ||
| -L$(CUDA_HOME)/lib64/stubs \ | ||
| -Wl,-rpath,$(CUDA_HOME)/lib64 \ | ||
| -o $@ $(SOURCES) -lcuda | ||
|
|
||
| clean: | ||
| $(RM) $(TARGET) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| <!-- | ||
| SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| SPDX-License-Identifier: Apache-2.0 | ||
| --> | ||
|
|
||
| # CUDA CustomStorage standalone round-trip | ||
|
|
||
| This single-GPU harness validates the CUDA 13.4 CustomStorage checkpoint contract without | ||
| Snapshot, CRIU, GMS, HVBM, NIXL, or Kubernetes. | ||
|
|
||
| The target-PID CustomStorage operation and capability handling live in | ||
| `deploy/snapshot/cmd/cuda-checkpoint-helper/custom_storage_operation.*`. The harness is | ||
| their smallest consumer. It deliberately supplies its own single-buffer POSIX transfer | ||
| instead of depending on Snapshot's daemon, NIXL engine, or artifact format. | ||
|
|
||
| It forks a standalone CUDA workload that allocates a deterministic local device | ||
| buffer. The controller process then: | ||
|
|
||
| 1. locks the workload; | ||
| 2. requests a CustomStorage checkpoint; | ||
| 3. requires one driver-provided device extent and reports its requested device ordinal, | ||
| UUID, pointer, size, and stream; | ||
| 4. copies that extent to one POSIX file through one bounded pinned buffer; | ||
| 5. completes the checkpoint operation; | ||
| 6. validates the file size before mutating restore state; | ||
| 7. restores the extent and unlocks the workload; | ||
| 8. asserts the documented RUNNING → LOCKED → CHECKPOINTED → LOCKED → RUNNING states; and | ||
| 9. asks the workload to verify its original bytes and execute another CUDA operation. | ||
|
|
||
| An internal 120-second watchdog kills the child workload and exits the controller if a | ||
| driver call, pipe operation, or workload exit hangs. Multi-GPU restore is an explicit | ||
| non-goal of this proof. | ||
|
|
||
| The driver-provided CustomStorage pointer is checkpoint storage, not necessarily an | ||
| application allocation address. Correctness is therefore established by application | ||
| byte verification after a complete checkpoint/restore cycle, not by matching the | ||
| application pointer against the returned extent pointer. | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Linux on x86-64 | ||
| - CUDA driver exposing the CUDA 13.4 CustomStorage API | ||
| - CUDA toolkit headers and driver stubs under `CUDA_HOME` | ||
| - Permission to checkpoint the child process | ||
|
|
||
| The compatibility header temporarily permits a build image with pre-13.4 headers when | ||
| the runtime driver already exposes the 13.4 symbol. Prefer the released CUDA 13.4 | ||
| headers as soon as they are available. | ||
|
|
||
| ## Build | ||
|
|
||
| ```bash | ||
| make -C benchmarks/cuda_custom_storage | ||
| ``` | ||
|
|
||
| ## Verify a normal round-trip | ||
|
|
||
| The artifact directory must not already exist: | ||
|
|
||
| ```bash | ||
| artifact_dir="$(mktemp -d)/artifact" | ||
| timeout 130s benchmarks/cuda_custom_storage/cuda-custom-storage-roundtrip \ | ||
| --artifact-dir "${artifact_dir}" \ | ||
| --bytes 67108864 | ||
| ``` | ||
|
|
||
| Expected output reports the CUDA-provided extent and ends with `roundtrip=passed`. | ||
| The output directory contains one `checkpoint.bin` file. Its metadata remains in | ||
| memory for the duration of the test; the harness does not define a persistent artifact | ||
| format. | ||
|
|
||
| ## Verify truncated-artifact rejection | ||
|
|
||
| Use a new artifact directory: | ||
|
|
||
| ```bash | ||
| artifact_dir="$(mktemp -d)/artifact" | ||
| timeout 130s benchmarks/cuda_custom_storage/cuda-custom-storage-roundtrip \ | ||
| --artifact-dir "${artifact_dir}" \ | ||
| --bytes 67108864 \ | ||
| --truncate-before-restore | ||
| ``` | ||
|
|
||
| The harness intentionally truncates the checkpoint file, rejects it before invoking CUDA | ||
| restore, terminates the now-checkpointed test workload, and reports | ||
| `corruption_check=passed`. | ||
|
|
||
| ## Verify that restored state depends on artifact bytes | ||
|
|
||
| Use another new artifact directory: | ||
|
|
||
| ```bash | ||
| artifact_dir="$(mktemp -d)/artifact" | ||
| timeout 130s benchmarks/cuda_custom_storage/cuda-custom-storage-roundtrip \ | ||
| --artifact-dir "${artifact_dir}" \ | ||
| --bytes 67108864 \ | ||
| --corrupt-before-restore | ||
| ``` | ||
|
|
||
| This preserves the extent's declared size but overwrites its contents. The test passes | ||
| only if CUDA restore/completion rejects the bytes or the workload explicitly rejects | ||
| the restored application state. | ||
|
|
||
| ## Explicit non-goals | ||
|
|
||
| - Snapshot or CRIU orchestration | ||
| - GMS/HVBM allocation ownership or metadata | ||
| - NIXL and transfer-performance optimization | ||
| - daemonization or multi-tenant policy | ||
| - portable GPU remapping | ||
| - multi-GPU checkpoint or restore | ||
| - production artifact compatibility | ||
|
|
||
| Those layers should consume or extend the verified CUDA contract only after this | ||
| standalone behavior is reproduced on the target CUDA 13.4 environment. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.