You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEA] Resolve key-to-index mapping in DynamicEmb row-wise input_dist #459
Is your feature request related to a problem? Please describe.
Right now key-to-slot-index resolution happens later in the DynamicEmb lookup path. If we resolve key-to-index mapping in input_dist, we will be able to reuse torchrec's lookup for dynamic use case.
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context, code examples, or references to existing implementations about the feature request here.
Hi @shijieliu, I’d like to take this on if it’s still available. I’d start with row-wise, HBM-backed sequence embeddings, resolving keys to local value-row indices after the all-to-all in input_dist. Before implementing it, I’d propose how to expose the weights to TorchRec’s lookup and preserve optimizer updates and row lifetime across prefetched batches. I’d check correctness against the existing path on A6000s before measuring performance. Does this match your intended scope, and should I coordinate with #493/#497?
Hi @Pinoeer-kingxi, thanks for your interest in our project!
I think starting with HBM-backed sequence embeddings under row-wise sharding would be a good approach.
Currently, the lookup path accesses both the hash table, which maps keys to slot indices, and the embedding table, which stores the embedding vectors. The goal is to move the key-to-index mapping into input_dist, so the lookup stage can consume the resolved slot indices directly. This would allow us to reuse TorchRec’s lookup for dynamic embeddings.
There are some implementation details you need to be cautions about. First, handle the eviction carefully. When a hash-table entry is evicted and its slot is reused, the corresponding embedding row needs to be updated or reinitialized appropriately. We would therefore also need to pass the relevant eviction information from input_dist to the lookup stage. Second, the current interface such as cache, PS also needs to adjust to accomadate this change.
Please let me know if you have any questions or would like to discuss the implementation! For this issue, I think we are expecting to make all cases, including HBM and cache/storage, refactored. But as i said, starting from hbm-backed sequence embedding under row-wise sharding would be a good start.
Activity
WEIXILIN0307 commentedon Oct 14, 2026
Hi @shijieliu, I’d like to take this on if it’s still available. I’d start with row-wise, HBM-backed sequence embeddings, resolving keys to local value-row indices after the all-to-all in input_dist. Before implementing it, I’d propose how to expose the weights to TorchRec’s lookup and preserve optimizer updates and row lifetime across prefetched batches. I’d check correctness against the existing path on A6000s before measuring performance. Does this match your intended scope, and should I coordinate with #493/#497?
shijieliu commentedon Oct 15, 2026
Hi @Pinoeer-kingxi, thanks for your interest in our project!
I think starting with HBM-backed sequence embeddings under row-wise sharding would be a good approach.
Currently, the lookup path accesses both the hash table, which maps keys to slot indices, and the embedding table, which stores the embedding vectors. The goal is to move the key-to-index mapping into input_dist, so the lookup stage can consume the resolved slot indices directly. This would allow us to reuse TorchRec’s lookup for dynamic embeddings.
There are some implementation details you need to be cautions about. First, handle the eviction carefully. When a hash-table entry is evicted and its slot is reused, the corresponding embedding row needs to be updated or reinitialized appropriately. We would therefore also need to pass the relevant eviction information from input_dist to the lookup stage. Second, the current interface such as cache, PS also needs to adjust to accomadate this change.
Please let me know if you have any questions or would like to discuss the implementation! For this issue, I think we are expecting to make all cases, including HBM and cache/storage, refactored. But as i said, starting from hbm-backed sequence embedding under row-wise sharding would be a good start.
cc @jiashuy