Repository navigation
Comparing changes
Open a pull request
base repository: NVIDIA/recsys-examples
base: v26.05
head repository: NVIDIA/recsys-examples
compare: v26.06
- 9 commits
- 61 files changed
- 6 contributors
Commits on Jun 17, 2026
-
fix(dynamicemb): size HostVMMTensor mapping to need, grow via mremap (#…
…425) HostVMMTensor reserved the entire machine's physical RAM as an anonymous mmap for every host tensor, intending it as a VA window that extend() would grow into in place. With many tables (e.g. the test_alignment suite), these multi-TB reservations accumulate and exhaust the process virtual address space, so mmap eventually fails with ENOMEM even for tiny tensors: RuntimeError: mmap virtual memory failed (size=2164192202752 bytes): Cannot allocate memory Map only the bytes actually backed (page-aligned) and grow the mapping on demand in extend() via mremap(MREMAP_MAYMOVE). Relocation is safe: callers rebuild value-buffer pointers after extend() per the get_table_ptrs() contract. Robustness: - restore_to_size() centralizes rollback: on any failure after the mapping has grown (mremap/mlock/cudaHostRegister/cudaHostGetDevicePointer), drop the CUDA registration, shrink the mapping back, and re-register, leaving the object consistent (m_size == m_reserved == old size) and safe to reuse/retry. - Record the grown extent (m_reserved) immediately after a successful mremap so the destructor's munmap always covers the whole mapping (no tail leak). - Free the mmap'd + mlocked buffer if CUDA registration fails in the constructor (the destructor does not run on a failed construction). - Treat madvise(MADV_WILLNEED) as the advisory hint it is: non-fatal in both the constructor and extend() (memset + mlock are the real fault-in/pin), warning with errno instead of aborting or silently ignoring it. - Destructor is best-effort (never throws); add _GNU_SOURCE for mremap and include errno/size in the mmap error message. Fixes the host path of test/unit_tests/test_alignment.py; verified passing at WORLD_SIZE=1/4/8 plus the test_vmm_tensor.py extend stress test. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2550a9c - Browse repository at this point
Copy the full SHA 2550a9cView commit details
Commits on Jun 30, 2026
-
fix(dynamicemb): correct optimizer-state layout in padded-buffer upda…
…te (#426) * fix(dynamicemb): correct optimizer-state layout in padded-buffer update (#419) The contiguous padded-buffer optimizer kernels (StorageMode.DEFAULT / HybridStorage without caching) assumed each optimizer state occupied the full max_emb_dim width. For tables with dim < max_emb_dim the Adam velocity (v) slot fell inside the kernel's momentum (m) region and was updated with the beta1 rule instead of beta2, corrupting v; the embedding update also read uninitialized padding as v. Make the padded-buffer kernels layout-aware: optimizer states start at a fixed max_emb_dim offset with per-row dim. Add OptimizierInput.state_offset (flat-table path keeps state_offset == dim; padded path uses max_emb_dim) and thread per-row table_ids/table_emb_dims through the padded-buffer update path (CUDA kernels, pybind, optimizer.py, and the backward caller). Add test/unit_tests/test_padded_buffer_optimizer.py covering Adam with mixed embedding dims. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(dynamicemb): get per-table emb dims via Storage.embedding_dims() in padded update The #419 fix referenced storage._state.table_emb_dims in the padded-buffer backward path, but HybridStorage has no _state (it uses _hbm/_host tiers), raising AttributeError under StorageMode.DEFAULT with HybridStorage (e.g. test_lfu_scores). Add a Storage.embedding_dims(on_device=False) interface returning per-table embedding dims as an int64 tensor (CPU via table_emb_dims_cpu without a device sync, or the existing CUDA tensor). Implemented by DynamicEmbStorage (_state) and HybridStorage (_hbm tier, which produces the value buffer in find()). Backward now calls storage.embedding_dims(on_device=True) instead of reaching into a storage-specific attribute. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(dynamicemb): pass per-table all_dims_vec4 to padded-buffer optimizer kernels The padded-buffer host functions derived all_dims_vec4 from emb_dim % 4 (max_emb_dim only). After switching the kernels to per-row edim, a table whose edim is not a multiple of 4 but routed through the vec4 kernel (because max_emb_dim is) would have its m_vec.store spill past the m region into v with the beta1 rule — the same corruption #419 fixes. Only manifests with a vec4-aligned max_emb_dim plus a non-aligned table dim. Thread the per-table-correct flag (state.all_dims_vec4, which checks every dim and value_dim) into the four *_update_for_padded_buffer host functions / pybind args / optimizer.py wrappers, exposed via a new Storage.all_dims_vec4() interface (DynamicEmbStorage._state, HybridStorage._hbm). Parametrize the regression tests over an aligned mix [8,4] (vec4 path) and a misaligned mix [8,6] (scalar path). Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(dynamicemb): validate table_ids/table_emb_dims are CUDA tensors in padded update The four padded-buffer host functions checked grads/values with TORCH_CHECK but not the table_ids/table_emb_dims tensors added for the #419 fix. A CPU tensor passed accidentally (e.g. embedding_dims(on_device=False)) would be dereferenced as device memory inside the kernel, causing an opaque illegal-memory-access at runtime. Add explicit TORCH_CHECK(...is_cuda()) for a clear error at the entry point. Co-Authored-By: Claude Opus 4.8 <[email protected]> * docs(test): clarify padded-buffer value-stride comment The '# adam state = 2 * max_emb_dim' comment could read as if each optimizer slot holds max_emb_dim live values. Clarify that the row stride is emb + m + v (each slot reserved max_emb_dim wide) while only the row's own edim values are live per slot, matching the module layout diagram. Co-Authored-By: Claude Opus 4.8 <[email protected]> * style: drop redundant pass after docstring in Storage abstract methods pre-commit (autoflake) removes the pass following the docstring in the new embedding_dims/all_dims_vec4 abstract methods; the docstring is a valid body. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(dynamicemb): implement embedding_dims/all_dims_vec4 in PyDictStorage test ref The new Storage abstract methods were not implemented on PyDictStorage (the pure-Python reference Storage in test_batched_dynamic_embedding_tables_v2.py), so every test using it failed to instantiate the abstract class. Implement both from its existing _emb_dims/_value_dims. Co-Authored-By: Claude Opus 4.8 <[email protected]> * perf(dynamicemb): return persistent host tensor from Storage.embedding_dims embedding_dims(on_device=False) previously built a fresh CPU tensor each call. Add a persistent table_emb_dims_host tensor on DynamicEmbTableState (built once in create_table_state) and return it; on_device=True returns the existing GPU table_emb_dims. table_emb_dims_cpu stays a List[int] for the per-table int lookups. PyDictStorage gets equivalent persistent _emb_dims_dev/_emb_dims_host members. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 5dc46a2 - Browse repository at this point
Copy the full SHA 5dc46a2View commit details
Commits on Jul 7, 2026
-
Configuration menu - View commit details
-
Copy full SHA for f69725b - Browse repository at this point
Copy the full SHA f69725bView commit details
Commits on Jul 10, 2026
-
Configuration menu - View commit details
-
Copy full SHA for e49f9cc - Browse repository at this point
Copy the full SHA e49f9ccView commit details -
Update FBGEMM for Blackwell HSTU attention (#431)
* Update FBGEMM for Blackwell HSTU attention * Constrain quack-kernels version in Dockerfile * Update FBGEMM submodule for recsys-examples v26.06 * bench(hstu): add phase-selective CUDA graph profiling * bench(hstu): eagerly initialize CUDA events * Update FBGEMM submodule to recsys examples 26.06 * bench(hstu): report P10 performance with timing percentiles * Add HSTU attention benchmark heatmaps
Configuration menu - View commit details
-
Copy full SHA for a8781db - Browse repository at this point
Copy the full SHA a8781dbView commit details -
* optimization: slot_mapping D2H * the latency analysis for optimized slot_mapping * optimization: bulk D2H + vectorized slot expand (v2) Replace per-seq page_ids D2H and numpy expand with one bulk kv_indices/kv_indptr copy and torch CPU broadcast; drop loop内全量 slot D2H. Add ex1 v2 profiling results (3-run mean) vs baseline and v1. * optimization_2: as_batch * baseline vs. slotmapping + as_batch * rebase main and support ssd * Clean pr * Refine FLEXKV_CPU_BREAKDOWN doc Remove text code-fence wrapper for the pipeline steps, drop the denominator note, and move the slot_mapping_optimization + as_batch perf summary out of the README (to be kept in the PR description).
Configuration menu - View commit details
-
Copy full SHA for e88284d - Browse repository at this point
Copy the full SHA e88284dView commit details -
Recsys-FlexKV Inference benchmark (#429)
* Recsys-FlexKV three scenarios inference benchmark * benchmark and ablation * Remove layerwise inference benchmark from PR429. Keep non-layerwise benchmark cleanup improvements (FlexKV client shutdown and scenario1 offload drain) while moving layerwise benchmark and inference integration to PR #428. * Consolidate FlexKV onboard benchmark mode. Use --only-onboard to select the onboard-only benchmark path and add configurable request batch size support while removing the duplicate benchmark entry point. * fix
Configuration menu - View commit details
-
Copy full SHA for e59a876 - Browse repository at this point
Copy the full SHA e59a876View commit details
Commits on Jul 14, 2026
-
Feat/support incremental dump for LFU (#432)
* feat(dynamicemb): support incremental_dump for LFU via LruLfu score policy Add a `need_incremental_dump` table option. For LFU tables it stores a per-key last-access timestamp alongside the frequency using a new compound `LruLfu` ScorePolicy that occupies two AoS score words per key: - word 0: last-access timestamp (device global timer) — used only to select keys for time-based incremental dump - word 1: access frequency — drives eviction (unchanged LFU semantics) incremental_dump for such tables reuses the TIMESTAMP flow, thresholding on the timestamp word and returning device_timestamp(). CUDA: Bucket/Table carry num_scores; AoS score accessor scores(iter,k); ScorePolicy<LruLfu>::update writes both words; reduce() gets a 2-score path that ranks by the frequency word; insert() clears the whole block on evict; export/count take a score_index. Bindings thread num_scores/score_index. Default num_scores=1 keeps the single-score path byte-identical. Python: scored_hashtable decouples score-word count from spec count (score_policy_num_scores); key_value_table builds a single LruLfu spec for LFU+need_incremental_dump; batched returns device_timestamp() for such tables. Known follow-ups: rehash/dump/load move scores with single-column semantics (loses the LruLfu frequency); NO_EVICTION+need_incremental_dump is rejected; overflow-table timestamps not stamped on lookup-found. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(dynamicemb): preserve LruLfu scores across rehash Table growth (_expand_tables_impl) re-inserted keys with a single-value ASSIGN, which only restores the leading score word. For the LruLfu (timestamp, frequency) layout this reset every key's frequency to 0 on each rehash, breaking LFU eviction. Add a copy_score_blocks CUDA kernel that copies all score words for aligned (src_slot, dst_slot) key pairs between two tables, reusing the AoS Bucket::scores(iter,k) accessor (no duplicated layout math). Rehash now calls it after re-insert when num_scores > 1, restoring both the timestamp and the frequency exactly. Single-score tables are unaffected (guarded on num_scores). Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(dynamicemb): preserve LruLfu multi-word scores across dump/load Dump the full [N, num_scores] score block and restore it on load, so the LFU frequency (word 1) survives save/load, not just the timestamp (word 0). Adds gather_score_blocks/scatter_score_blocks kernels; DynamicEmbStorage dump/load handle multi-word; HybridStorage multi-word dump/load guarded as a follow-up. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(dynamicemb): maintain overflow-table scores (incl. LruLfu) The overflow buffer never wrote scores on insert or training lookup (only a CONST read existed); eviction there is counter-based. So overflow entries had unmaintained scores for all modes, and LruLfu's timestamp/frequency were wrong for keys living in overflow. Now: - lookup found-in-overflow (non-CONST): lock the slot and apply the score policy (stamp timestamp / accumulate frequency; both words for LruLfu). - insert_and_evict overflow Insert/Evict: clear the score block (fresh) then write via the policy; Assign updates under lock. Eviction stays counter-based; single-score modes now also get correct overflow scores (previously garbage). Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(dynamicemb): lookup returns frequency (not timestamp) for LruLfu The CONST lookup path returned *scores(iter) == word0, which for LruLfu is the timestamp, not the LFU score. Read the reduction score instead (scores(iter, num_scores-1) == frequency for LruLfu, word0 otherwise), for both the main-table and overflow CONST paths. The non-CONST path already returns the frequency via update(). Single-score modes are unchanged. Co-Authored-By: Claude Opus 4.8 <[email protected]> * test(dynamicemb): cover LruLfu logic (policy, eviction, gather/scatter/copy, incremental re-touch) Add table-level test_lru_lfu.py (registered in the runner): - frequency accumulation on insert/lookup; CONST lookup returns frequency (word1), not the timestamp (word0) - eviction ranks by frequency (2-score reduce): hot keys survive - gather->scatter and copy_score_blocks round-trips preserve both words Add batched-level test_lfu_incremental_dump_retouch: re-accessed keys are re-dumped, untouched keys are not, and an idle window dumps nothing (caching on/off). Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(dynamicemb): count LruLfu score words in load validation; add storage tests _validate_load_meta compared the score-file word count against num_keys, but a multi-word layout (LruLfu = timestamp+frequency) stores num_scores words per key; compare against num_keys * num_scores instead. Caught by the new DynamicEmbStorage dump/load round-trip test. Tests (test_lru_lfu.py): add storage-level dump/load round-trip and rehash (_expand_tables_impl) integration tests asserting both score words are preserved; make the eviction test robust (hot set well below capacity) and avoid unsupported uint64 arange. Verified on EOS H100: 7 passed (table-level) + 18 passed (incremental incl. TIMESTAMP/STEP/CUSTOMIZED regression). Co-Authored-By: Claude Opus 4.8 <[email protected]> * refactor(dynamicemb): fold LruLfu policy selection into get_score_policy Remove the redundant score_specs list/dataclass field (the single score spec always comes from the policy; multi-word LruLfu layout is derived via score_policy_num_scores). Move need_incremental_dump policy selection into get_score_policy(), which returns the LRU_LFU spec directly for LFU and keeps the unsupported-strategy guard. create_table_state collapses to one call plus incremental_score_name = score_policy.name. Co-Authored-By: Claude Opus 4.8 <[email protected]> * refactor(dynamicemb): name LruLfu score spec "lru_lfu" + black formatting The compound LruLfu ScoreSpec name maps to word 0 (score_index 0) -- the timestamp column incremental_dump thresholds on -- not the frequency word, so "lru_lfu" reads truer than "frequency". Also apply black to the touched files. Co-Authored-By: Claude Opus 4.8 <[email protected]> * test(dynamicemb): cover LFU + need_incremental_dump in end-to-end score test Thread need_incremental_dump through create_model/apply_dmp and add a --need-incremental-dump flag to test_lfu_scores.py. In LruLfu mode the exported score is a 2-word block [timestamp, frequency]; take the reduction (last) word so the existing frequency-vs-true-count validation proves the extra timestamp word does not corrupt LFU semantics through the full torchrec/storage stack. Guard against caching/HybridStorage (multi-word checkpoints are a follow-up) and run the new variant storage-only in test_lfu_scores.sh. Co-Authored-By: Claude Opus 4.8 <[email protected]> * docs(dynamicemb): correct need_incremental_dump supported-strategy scope The docstring claimed STEP/CUSTOMIZED/NO_EVICTION add a timestamp column, but get_score_policy rejects them with NotImplementedError -- need_incremental_dump is supported only for TIMESTAMP (no-op, already a timestamp) and LFU (the compound LruLfu two-word policy). Align the docstring with the code. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(dynamicemb): validate LruLfu load score shape with ValueError, not assert The multi-word load path is the only shape guard before scatter_score_blocks forwards the tensor to the CUDA kernel (which does no validation). An assert is stripped by `python -O`, so a malformed checkpoint (e.g. a 1-D score tensor) could silently cause wrong/out-of-bounds device writes. Raise ValueError instead, and also check the row count (size(0) == num keys), matching the _validate_load_meta style. Co-Authored-By: Claude Opus 4.8 <[email protected]> * docs(dynamicemb): fix memory_usage() score-layout comment (AoS, not SoA) The comment described the multi-score region as SoA ([col0 block][col1 block]), but the scores(iter, k) accessor computes iter * num_scores_ + k -- an AoS layout where each key's score words are contiguous. Correct the comment so a developer deriving pointer arithmetic for a new multi-score op gets the right formula. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(dynamicemb): forward num_scores from erase() to the C++ kernel erase() called table_erase without num_scores, so it fell back to the pybind default of 1. For a LruLfu table (num_scores=2) that mis-sizes the per-slot stride (total_size = key + digest + num_scores*score), giving wrong bucket_bytes / num_buckets and corrupting bucket-stride arithmetic -- erase then probes the wrong slots. Forward self.num_scores_. (Incidental: black collapses one adjacent signature line.) Co-Authored-By: Claude Opus 4.8 <[email protected]> * feat(dynamicemb): support tuple score_strategy, remove need_incremental_dump Replace the `need_incremental_dump` flag with a compound `score_strategy` tuple. `score_strategy` now accepts either a single DynamicEmbScoreStrategy or a tuple; only (TIMESTAMP, LFU) is supported for now (in either order), mapping to the existing LruLfu two-word score policy. The tuple order is the logical order checkpoints are written in; the on-device physical layout stays fixed, and dump/load reorder score columns via a logical<->physical permutation, so both orders behave identically at runtime and differ only in checkpoint column order. A one-element tuple (X,) is normalized to the single strategy X. - config: normalize_score_strategy + helpers (eviction / timestamp-column / physical-order / dump+load permutation); validate in __post_init__; drop the need_incremental_dump field and its grouped_key entry - key_value_table: get_score_policy handles the tuple; dump reorders physical-> logical in export_keys_values_iter, load reorders logical->physical - incremental_dump: time-based only when the strategy carries a TIMESTAMP column (single TIMESTAMP or a compound including it); otherwise thresholds on the absolute score value (documented in code + DynamicEmb_APIs.md) - shard/batched: eviction/LFU checks route through the new helpers - tests/docs: convert need_incremental_dump usage to the tuple; add (LFU, TIMESTAMP) reversed-order dump/load round-trip with checkpoint column check; update score_strategy type annotations; --need-incremental-dump test flag now selects the compound (TIMESTAMP, LFU) strategy Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * test(dynamicemb): fix checkpoint column-order check in LruLfu round-trip The (TIMESTAMP,LFU)/(LFU,TIMESTAMP) dump/load round-trip test paired the dumped score file with keys from a *separate* export_keys_values scan, which is a distinct iteration and need not reproduce the dump's row order -> misaligned key->frequency mapping (even the identity ts_first case failed). Read the keys from the dumped `keys` file instead, which is written in lockstep with the `score` file, so rows are aligned. Verified on H100: 8 passed. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * feat(dynamicemb): export ScoreStrategy; rename test flag --need-incremental-dump -> --lru-lfu - Export the ScoreStrategy type alias from the top-level dynamicemb package (import + __all__) so users can annotate the now-Union-typed score_strategy as `from dynamicemb import ScoreStrategy`. - Rename the test_lfu_scores CLI flag --need-incremental-dump to --lru-lfu (and its var/messages) to match the underlying LruLfu compound policy; the removed need_incremental_dump name no longer appears anywhere. Update test_lfu_scores.sh. Verified on H100: `from dynamicemb import ScoreStrategy` imports; lfu_scores smoke passes with --lru-lfu. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(dynamicemb): allow score_strategy=None in normalize_score_strategy None is a pre-existing sentinel used by the planner / sharding path for non-DynamicEmb (plain TorchRec) tables (shard/embedding.py guards on `score_strategy is not None`). The new __post_init__ validation rejected None with TypeError, breaking test_distributed_dynamicemb.py's get_planner which passes score_strategy=None for use_dynamicembs=False tables. Pass None through unchanged and annotate the field Optional[ScoreStrategy] to match. Missed earlier because test_distributed_dynamicemb.py (torchrun) was not in the first GPU run. Now verified on H100: test_distributed_dynamicemb 15/15, test_lru_lfu 8/8, incremental_dump 18/18, hybrid_storage_export all pass. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>Configuration menu - View commit details
-
Copy full SHA for 87e35c0 - Browse repository at this point
Copy the full SHA 87e35c0View commit details -
Configuration menu - View commit details
-
Copy full SHA for bdf16e3 - Browse repository at this point
Copy the full SHA bdf16e3View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v26.05...v26.06