Skip to content

Categorize TorchRec / FBGEMM TBE init and sharding as EMBEDDING (#21)#21

Closed
Chenguang-Zhu wants to merge 1 commit into
facebookresearch:mainfrom
Chenguang-Zhu:export-D103992615
Closed

Categorize TorchRec / FBGEMM TBE init and sharding as EMBEDDING (#21)#21
Chenguang-Zhu wants to merge 1 commit into
facebookresearch:mainfrom
Chenguang-Zhu:export-D103992615

Conversation

@Chenguang-Zhu

@Chenguang-Zhu Chenguang-Zhu commented May 19, 2026

Copy link
Copy Markdown
Member

Summary:

Adds two new rules:

  1. EMBEDDING name rule — frame name in:
    {_init_dmp, _shard_modules_impl, _create_shard_module, shard, apply_2d_emb_sharding, _create_lookups, create_lookup, _create_embedding_kernel, init_parameters, _init_fbgemm_regroup, _apply_split, _apply_cache_state}.

  2. EMBEDDING filename rule — filename contains any of:

    • torchrec/distributed/embedding_lookup.py
    • torchrec/distributed/embeddingbag.py
    • torchrec/distributed/batched_embedding_kernel.py
    • torchrec/distributed/embedding_sharding.py
    • torchrec/distributed/sharding/
    • fbgemm_gpu/split_table_batched_embeddings_ops_training.py
    • fbgemm_gpu/split_table_batched_embeddings_ops_training_common.py

Note: torchrec/distributed/model_parallel.py is intentionally NOT in
the filename rule because it wraps the entire forward pass of every
sharded model — including all dense activations. Init paths through it
are already covered by the _init_dmp name rule.

Order-of-rules detail: inserted before the existing "forward"
substring rule (and therefore also ahead of all PARAMETER rules) so
that names like init_parameters (which contains "param") and any
TBE init that transitively traces forward stay categorized as
EMBEDDING.

Differential Revision: D103992615

@meta-cla meta-cla Bot added the cla signed label May 19, 2026
@meta-codesync

meta-codesync Bot commented May 19, 2026

Copy link
Copy Markdown

@Chenguang-Zhu has exported this pull request. If you are a Meta employee, you can view the originating Diff in D103992615.

…bookresearch#21)

Summary:

Adds two new rules:

1. **EMBEDDING name rule** — frame name in:
   `{_init_dmp, _shard_modules_impl, _create_shard_module, shard,
     apply_2d_emb_sharding, _create_lookups, create_lookup,
     _create_embedding_kernel, init_parameters, _init_fbgemm_regroup,
     _apply_split, _apply_cache_state}`.

2. **EMBEDDING filename rule** — filename contains any of:
   - torchrec/distributed/embedding_lookup.py
   - torchrec/distributed/embeddingbag.py
   - torchrec/distributed/batched_embedding_kernel.py
   - torchrec/distributed/embedding_sharding.py
   - torchrec/distributed/sharding/
   - fbgemm_gpu/split_table_batched_embeddings_ops_training.py
   - fbgemm_gpu/split_table_batched_embeddings_ops_training_common.py

Note: `torchrec/distributed/model_parallel.py` is intentionally NOT in
the filename rule because it wraps the entire forward pass of every
sharded model — including all dense activations. Init paths through it
are already covered by the `_init_dmp` name rule.

Order-of-rules detail: inserted **before** the existing `"forward"`
substring rule (and therefore also ahead of all PARAMETER rules) so
that names like `init_parameters` (which contains "param") and any
TBE init that transitively traces forward stay categorized as
EMBEDDING.

Differential Revision: D103992615
@meta-codesync meta-codesync Bot changed the title Categorize TorchRec / FBGEMM TBE init and sharding as EMBEDDING Categorize TorchRec / FBGEMM TBE init and sharding as EMBEDDING (#21) May 19, 2026
@meta-codesync meta-codesync Bot closed this in c75845f May 19, 2026
@meta-codesync

meta-codesync Bot commented May 19, 2026

Copy link
Copy Markdown

This pull request has been merged in c75845f.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant