Skip to content

[RFC] DynamicEmb receiver-side key-to-row resolution in input_dist #552

Open

Description

@WEIXILIN0307

Motivation

Issue #459 asks to resolve keys on the receiving shard and reuse TorchRec lookup, starting with HBM row-wise sequence embeddings and eventually covering Cache/Storage. The benefit is a clearer forward boundary and an opportunity for overlap; speedup is not guaranteed.

Proposed Architecture

Before: keys → receiver completion → unique/find in lookup → DynamicEmb gather
After:  keys → receiver completion → resolve/init/pin rows → TorchRec forward
Both:   output maps → DynamicEmb backward/optimizer → publish/release
Raw:    existing raw/FIFO API retains its CUDA gather

Native split-fusion reconstruction preserves the resolver. Resolved input retains original keys, dedup maps, scores/frequencies and output context. Eligible persistent matrices are borrowed; other layouts use compact rows and EC/EBC fallback. TorchRec owns forward lookup; DynamicEmb retains optimizer, initialization, eviction and storage. Detailed contracts cover the internal fields and alternatives.

Core Invariants

Hash slots address membership/pins, physical rows address values/moments, compact rows address snapshots. Rehash must not confuse them. Replacement initializes values and optimizer state before use. When HBM insertion refuses a key, the receiver supplies a temporary initialized value and skips the persistent optimizer update. Leases survive retained backward and release once after ordered use/cancellation/GC. Storage publication matches full table/key identity and preserves complete optimizer bytes.

548's scaled FP8 values are decoded only for embedding lookup; packed FP32 state and 64-bit optimizer offsets are preserved. 557 supplies atomic counters and actual refusal reporting. A newly reproduced failure-recovery bug is fixed separately in 563: save real dirty victims, initialize accepted slots and return only failed-request hit pins before propagating refusal.

Incremental Implementation

Slice Location / prerequisite
Lifetime / adapter 559, 560, independent main bases
Refusal recovery / dependency docs 563, 562, independent
HBM → Cache → Storage fork1 → fork2 → fork3; Cache base also includes #563
Additional layouts pooled → TW-RW → hierarchy
Raw compatibility fork7, based on Storage, independent of extra layouts

Fork previews use actual parent branches and own deltas. After prerequisites merge, they become small upstream proposals. 558 is superseded by merged #557;551 remains an integration Draft, not minimal core.

Compatibility

Current-main 2995c41 integration preserves548/557 and reuses528 transport. Local tests cover native/fused RW, Cache, Host/Hybrid, Storage interfaces, supported precision/optimizer combinations, pooled layouts and single-host TW-RW. Current Docker package tags are FBGEMM 1.8/TorchRec v1.8.0-rc1; complete NGC, older releases, real NVLink/GIN and network PS remain unverified.

Validation & Performance

#551 5d9a5052a4 has 676 passed per rank in the consolidated two-GPU reference run. The follow-up evidence includes refusal regression tests and the 2.511 → 2.724 ms all-miss comparison against the prior integration. Scope audit and current test commands. Representative performance and deployment acceptance are open.

Two isolated comparisons show raw compatibility reducing raw step time 11–12.7%, Host 5.4–6.7%, Hybrid 3.7–4.1%. The measured integration still trails main by 9.1%,13.2%,13.9% and 3.6% for raw/Host/Hybrid/SparseDist; small SparseDist changes vary between runs. Evidence names measured commits and the subsequent refusal-only follow-up. 459 remains incomplete.

Open Questions

  1. Does this forward-only TorchRec boundary and staged review order match the intended ownership?
  2. Which representative workloads and safety/performance trade-offs should gate the HBM slice?
  3. Can maintainer CI/resources cover the full image and unavailable fabric/PS deployments?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions