mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #2865] [RFC]: TENT Transfer Intent API v1 and Cross-Language Compatibility #743
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#743
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @catyans on GitHub (Jul 12, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/2865
Summary
This RFC proposes a stable TENT Transfer Intent API v1 and explicit semantic parity across the C++, C, pybind, and high-level Python interfaces.
TENT already has the core intent fields in its internal C++
Request:prioritydeadline_nspolicy_nametransport_hintintent_typeHowever, these fields were added incrementally and are not exposed consistently:
Requestcontains all fields.tent_request_tcurrently containspriorityandtransport_hint, but notdeadline_ns,policy_name, orintent_type.The RFC defines what an application is allowed to request and how TENT interprets that request. It does not define how TENT constructs an Execution Plan (#2863), how QoS is enforced (#2856), or how operators inspect the result (#2864).
The first implementation milestone should add a versioned C request ABI, shared validation/normalization, and cross-language compatibility tests. It must not change default runtime scheduling behavior.
Motivation
The TENT roadmap in #1058 calls for a clean declarative API where users express what data should move and the runtime selects the path. The existing fields are a strong foundation, but an API is not stable merely because fields exist in a C++ struct.
1. Cross-language behavior is incomplete
The current C API converts only the fields present in
tent_request_t. A C caller cannot express the same intent as a C++ or pybind caller. This makes connector behavior depend on the language binding rather than on the request semantics.2. The existing C struct is not safely extensible as an array ABI
tent_submit()accepts an array of fixed-sizetent_request_t. Appending fields changes the array stride expected by a newly compiled library. A new library reading a request array produced by an old binary can step beyond the old element boundary. Zero-initialization alone does not solve binary layout/stride compatibility.The current struct must remain supported. A new versioned request entry and submission API are required instead of silently extending the old array ABI.
3. Zero-initialization does not provide a safe priority default
The current C API requires zero-initialization.
transport_hint=0correctly meansUNSPEC, butpriority=0currently meansHIGH. A caller that only zero-initializes the struct therefore requests the highest priority unintentionally.Transfer Intent API v1 should use
UNSPEC=0for every optional enum exposed through the new C ABI. The old API retains its existing behavior for compatibility.4. Deadline clock semantics are not explicit enough
deadline_nsis an absolutesteady_clocktimestamp. It is meaningful when the caller and TENT runtime share the local monotonic clock domain, but it must not be serialized unchanged to another host or process boundary whose clock origin is not guaranteed to match.Connectors need one documented rule for local submission and a separate rule for any future remote service API.
5. Requested policy is not authorization
An application-provided priority, policy name, or transport hint must not automatically grant access to reserved resources, a high-priority QP pool, or an otherwise forbidden backend. The API must distinguish requested intent from the effective authorized policy resolved by #2856.
6. Unknown values need predictable behavior
Rolling upgrades can produce new callers with old runtimes or old callers with new runtimes. Unknown intent enums, request versions, flags, and optional fields require explicit strict/compatibility behavior. Silent integer casting is not a stable contract.
Goals
tent_submit().UNSPEC=0.deadline_ns.Non-goals
tent_request_tandtent_submit()API.Transfer Intent v1 semantic model
A Transfer Intent is caller-provided metadata attached to one logical transfer request.
The runtime normalizes and validates the request before policy resolution:
Field semantics
intent_typeStandard values:
Rules:
INTENT_UNSPECpreserves compatibility behavior.STAGING_INTERNAL; it is reserved for TENT-generated internal work unless an explicitly trusted internal API is used;INTENT_UNSPEC, but must record the downgrade in explain/metrics;Recommended upper-layer mapping:
FOREGROUND_GETBACKGROUND_PREFETCHMIGRATIONCHECKPOINTWEIGHT_LOADINGSTAGING_INTERNALThe table is a semantic default, not a requirement that every framework use the same internal operation names.
requested_priorityThe new public C ABI should distinguish “unspecified” from “highest priority”:
Internal C++ priority values may be converted without renumbering them initially.
Rules:
UNSPECmeans derive the effective priority from the matched contract/default;tent_request_t.priority=0remains HIGH for compatibility, but the legacy API should be documented as unable to express UNSPEC.deadline_nsRules for local API v1:
0means no deadline;clock_gettime(CLOCK_MONOTONIC, ...)or a provided helper;time.monotonic_ns()or a provided helper;now + budgetmust fail validation or saturate through a documented helper;A raw absolute monotonic timestamp must not cross a host boundary. If a future remote TENT service API transports intent, it should send a remaining deadline budget plus measurement/receive timestamps and convert it into the receiver's local clock domain. That wire protocol is outside v1.
Suggested helpers:
policy_nameRules:
NULLmeans no explicitly requested named policy;transport_hintThe semantics should remain consistent with #2339:
TRANSPORT_UNSPECfollows policy selection;flagsv1 should reserve a bounded flags field for request-semantic modifiers that can be safely ignored only when explicitly documented.
Rules:
flags=0until the first flag is standardized;Requested versus effective intent
The API exposes the caller's request. TENT derives the effective policy:
The normalized requested intent and effective policy should both be observable through #2864/#2863 explain output. They must not be conflated in public metrics labels with unbounded cardinality.
Proposed binary-safe C ABI
The legacy API remains unchanged:
Transfer Intent v1 should add a new immutable versioned entry rather than append fields to
tent_request_t.Illustrative layout:
Because requests are submitted as an array, the runtime must know the caller's element stride. One possible generic ABI is:
The header can provide a type-safe inline wrapper:
This design allows the runtime to advance by the caller-provided stride and validate
struct_sizeinstead of assuming the library's compile-time struct size. A future v2 can use a new schema/version without changing legacytent_submit().Alternative ABI designs are welcome, but they must pass the binary compatibility cases below. Simply appending fields to the existing array element is not sufficient.
C ABI validation
For every entry:
entry_strideis at least the minimum size for the declared schema;struct_sizeis withinentry_strideand the supported bounds;ABI discovery
Suggested query functions:
The exact names can change, but callers need a supported way to distinguish “symbol unavailable”, “schema unsupported”, and “request invalid”.
C++ API
C++
Requestremains the internal native representation initially. Add shared normalization/validation helpers so C++, C, and Python do not implement separate semantics.Possible API:
All submit paths, including notification variants, must call the same normalization logic.
The RFC does not require immediately renaming
Request::prioritytorequested_priority, but documentation and explain output must state that it is a requested value before contract resolution.Python APIs
pybind
IntentType,RequestedPriority, andTransportTypeenums;deadline_after_ns()or accept a duration helper that converts locally;High-level declarative Python API
#2541 defines source/destination endpoint ergonomics. This RFC should not replace that work. The high-level API should forward an optional intent object or equivalent keyword fields into the same normalized model:
Python must not invent different fallback or authorization semantics.
Connector contract
Connectors should map their business operation to an intent before submitting to TENT.
Recommended behavior:
intent_type;policy_nameonly when configured/authorized;transport_hintfor explicit testing or a well-defined backend requirement, not as the default routing mechanism;The first implementation milestone does not require modifying SGLang or vLLM. Connector PRs should follow after the API and compatibility tests stabilize.
Strict and compatibility modes
Suggested behavior:
intent_typeINTENT_UNSPECand record downgradeUNSPECand record downgradeCompatibility mode must never reinterpret bytes from an unknown struct layout.
Error reporting
The new API should distinguish at least:
Returning only
-1makes connector fallback unsafe. The first PR may keep the existing return type if necessary, but should provide a thread-safe status-detail query or a new result structure before connector adoption. This should align with, not preempt, any future general Transfer Outcome/Error Contract.Compatibility and rollout
Existing callers
tent_request_tlayout is unchanged.tent_submit()andtent_submit_notif()behavior is unchanged.New callers
tent_request_v1_tandtent_submit_v1();Runtime behavior
Request;INTENT_UNSPEC, no policy, no deadline, and no transport hint preserve existing behavior;Proposed PR sequence
PR1: Semantic contract and shared normalization
PR2: Versioned C ABI
tent_request_v1_t, schema discovery, stride-safe submission, and notification equivalent.PR3: pybind and high-level Python parity
PR4: Explain and observability
Later connector PRs
Validation plan
Semantic tests
STAGING_INTERNALrejected for untrusted public submission;C ABI compatibility matrix
Cross-language parity
For a shared table of request vectors, C++, C, pybind, and high-level Python must produce the same normalized intent or the same validation category.
The test corpus should include:
Real-cluster validation
On two H20/RoCE nodes:
transport_hintremains inside the policy allowlist;The API itself should add no per-slice work. Measure submit throughput and plan/validation time; transfer throughput/P99 should remain unchanged for equivalent normalized requests.
Expected benefits and claims boundary
This RFC should provide:
It does not claim better SLO attainment, fairness, or throughput by itself. Those depend on QoS enforcement, Admission, receiver credits, and Execution Plan integration. The initial value is interface correctness and compatibility.
Relationship to existing work
IntentTypevocabulary already merged into C++/pybind.deadline_nsand deadline-aware Admission semantics; clarify the public clock contract.policy_namesemantics.transport_hintsemantics.Open questions
tent_request_tarray ABI should remain frozen and a new stride-aware v1 submission API should be added?struct_size + entry_stride + schema_versionthe preferred C ABI, or should each immutable request version use a distinct exported submission function forever?UNSPEC=0, HIGH=1, MEDIUM=2, LOW=3enum while converting to existing internal values?deadline_ns, or also a relativedeadline_budget_nshelper/field?STAGING_INTERNALallowed only through a private/internal API?policy_nameuse?Before submitting a new issue...
@github-actions[bot] commented on GitHub (Jul 12, 2026):
Thanks for opening this issue, @catyans!
18214026A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide
@catyans commented on GitHub (Jul 12, 2026):
Small implementation-backed feasibility experiment on 2026-07-13 using the intent-policy binding branch at
65ee26f8.Environment: Lingjun H20
lingjun-099, Linux 5.10.134, 192-vCPU Xeon Platinum 8575C host, GCC 13.3, Release,USE_TENT=ON,USE_CUDA=OFF.Results:
tent_transport_selector_test+tent_intent_type_test: 2/2 passed;Conclusion: a normalized
intent_typeis already viable as a stable selection input without embedding application vocabulary in transport backends. This is evidence for the normalization/policy-binding seam, not yet for the full RFC: C/Python field parity, unknown-value forward compatibility, requested/effective provenance serialization and connector round trips still need dedicated ABI/compatibility tests before API v1 can be called complete.@github-actions[bot] commented on GitHub (Oct 11, 2026):
This issue has had no activity for 90 days and will be closed in 7 days if there is no further activity. Please comment or react if it should stay open.
@github-actions[bot] commented on GitHub (Oct 19, 2026):
Closing due to 3 months of inactivity. If this is still relevant, please comment and we can reopen.