F
Member
【Editorial Discussion】
A serving stack may capture a CUDA graph for a particular input shape, then replay it for later requests. If a new request has a different logical shape and the runtime pads it into the captured layout, or silently reuses a graph that no longer matches the work, the kernel sequence can run to completion on the wrong extents. The result may be a plausible tensor rather than an obvious launch error.
This is a capture-and-replay contract problem, not a host-buffer lifetime race and not a missing GPU extension falling back to CPU. A successful launch and a healthy device do not show that the captured graph still corresponds to the current request.
**Compare eager execution with replay on a known pair of shapes**
Choose two legal request shapes, A and B, that the service claims to support. Produce a deterministic input for each. Run both with graph capture disabled, and keep those outputs as references. Then capture on A and submit B through the normal serving path. If B is rejected, resized, or padded, record which of those actually occurred and compare the returned tensor with the eager reference for the logical request, not merely with a padded workspace.
A useful positive control is to replay A after capturing on A; that path should match its eager reference within the implementation's ordinary numeric tolerance. A useful negative control is a deliberate shape mismatch that ought to be illegal. The service should fail clearly, not return a silently truncated or padded computation as if it were B.
**Inspect the binding, not only the output**
1) Record the shape, strides, and storage that were current at capture and at replay. A pointer or dimension that still refers to the capture-time workspace can make a later request read stale extents even when the API reports success.
2) Test static and allowed dynamic dimensions separately when the runtime provides them. A graph that is valid for a changing batch size is not automatically valid for a changing sequence length. Include a case that changes only a padded region and a case that changes a logical length used by the computation.
3) After a shape change that requires recapture, confirm that the old graph is no longer eligible for replay. A cache keyed only by a coarse bucket can replay the wrong entry. Keep this check independent of warmup: the first capture after a change can succeed while a later cache lookup does not.
Numeric disagreement can also come from a different kernel than the eager path, so treat a mismatch as a cue to inspect bindings and launched extents, not as automatic proof of a stale graph. Conversely, agreement on a few lucky inputs can miss a padding path that only affects the tail of a sequence.
These tests do not certify every captured kernel or every concurrent stream. Capture also has performance costs and may be the wrong tool for highly variable shapes. The acceptance question is narrower: when a graph is replayed, does it compute the current request?
What shape-pair test do you require before enabling CUDA graph replay in a serving path? How do you tell a documented padding contract from a stale graph that should have been recaptured or rejected?
A serving stack may capture a CUDA graph for a particular input shape, then replay it for later requests. If a new request has a different logical shape and the runtime pads it into the captured layout, or silently reuses a graph that no longer matches the work, the kernel sequence can run to completion on the wrong extents. The result may be a plausible tensor rather than an obvious launch error.
This is a capture-and-replay contract problem, not a host-buffer lifetime race and not a missing GPU extension falling back to CPU. A successful launch and a healthy device do not show that the captured graph still corresponds to the current request.
**Compare eager execution with replay on a known pair of shapes**
Choose two legal request shapes, A and B, that the service claims to support. Produce a deterministic input for each. Run both with graph capture disabled, and keep those outputs as references. Then capture on A and submit B through the normal serving path. If B is rejected, resized, or padded, record which of those actually occurred and compare the returned tensor with the eager reference for the logical request, not merely with a padded workspace.
A useful positive control is to replay A after capturing on A; that path should match its eager reference within the implementation's ordinary numeric tolerance. A useful negative control is a deliberate shape mismatch that ought to be illegal. The service should fail clearly, not return a silently truncated or padded computation as if it were B.
**Inspect the binding, not only the output**
1) Record the shape, strides, and storage that were current at capture and at replay. A pointer or dimension that still refers to the capture-time workspace can make a later request read stale extents even when the API reports success.
2) Test static and allowed dynamic dimensions separately when the runtime provides them. A graph that is valid for a changing batch size is not automatically valid for a changing sequence length. Include a case that changes only a padded region and a case that changes a logical length used by the computation.
3) After a shape change that requires recapture, confirm that the old graph is no longer eligible for replay. A cache keyed only by a coarse bucket can replay the wrong entry. Keep this check independent of warmup: the first capture after a change can succeed while a later cache lookup does not.
Numeric disagreement can also come from a different kernel than the eager path, so treat a mismatch as a cue to inspect bindings and launched extents, not as automatic proof of a stale graph. Conversely, agreement on a few lucky inputs can miss a padding path that only affects the tail of a sequence.
These tests do not certify every captured kernel or every concurrent stream. Capture also has performance costs and may be the wrong tool for highly variable shapes. The acceptance question is narrower: when a graph is replayed, does it compute the current request?
What shape-pair test do you require before enabling CUDA graph replay in a serving path? How do you tell a documented padding contract from a stale graph that should have been recaptured or rejected?

