Skip to content

[FEA] Resolve key-to-index mapping in DynamicEmb row-wise input_dist #459

Open

Description

@shijieliu

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.


By submitting this issue, you agree to follow our code of conduct and our contributing guidelines.

Activity

  1. WEIXILIN0307 commented on Oct 14, 2026

    @WEIXILIN0307

    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?

  2. shijieliu commented on Oct 15, 2026

    @shijieliu
    CollaboratorAuthor

    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

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