Add Python enum configs and KJT builder for enrichment (#5464)#5464
Closed
EddyLXJ wants to merge 3 commits into
Closed
Add Python enum configs and KJT builder for enrichment (#5464)#5464EddyLXJ wants to merge 3 commits into
EddyLXJ wants to merge 3 commits into
Conversation
Contributor
EddyLXJ
added a commit
to EddyLXJ/torchrec
that referenced
this pull request
Mar 10, 2026
…3850) Summary: X-link: pytorch/FBGEMM#5464 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Differential Revision: D95883280
ed4e4aa to
81602bc
Compare
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 10, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/torchrec
that referenced
this pull request
Mar 10, 2026
…3850) Summary: X-link: pytorch/FBGEMM#5464 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Differential Revision: D95883280
81602bc to
2436c1e
Compare
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 10, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 10, 2026
Summary: Pull Request resolved: pytorch#5464 X-link: meta-pytorch/torchrec#3850 X-link: https://github.com/facebookresearch/FBGEMM/pull/2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Differential Revision: D95883280
2436c1e to
d25f528
Compare
EddyLXJ
added a commit
to EddyLXJ/torchrec
that referenced
this pull request
Mar 10, 2026
…3850) Summary: X-link: pytorch/FBGEMM#5464 Pull Request resolved: meta-pytorch#3850 X-link: https://github.com/facebookresearch/FBGEMM/pull/2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Differential Revision: D95883280
d25f528 to
dabc8b3
Compare
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 10, 2026
Summary: Pull Request resolved: pytorch#5464 X-link: meta-pytorch/torchrec#3850 X-link: https://github.com/facebookresearch/FBGEMM/pull/2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/torchrec
that referenced
this pull request
Mar 10, 2026
…3850) Summary: X-link: pytorch/FBGEMM#5464 Pull Request resolved: meta-pytorch#3850 X-link: https://github.com/facebookresearch/FBGEMM/pull/2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 10, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 11, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 11, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/torchrec
that referenced
this pull request
Mar 12, 2026
…3850) Summary: X-link: pytorch/FBGEMM#5464 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 12, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
dabc8b3 to
97c3f0c
Compare
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 12, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/torchrec
that referenced
this pull request
Mar 12, 2026
…3850) Summary: X-link: pytorch/FBGEMM#5464 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 12, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
97c3f0c to
353a4a9
Compare
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 12, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 12, 2026
Summary: Pull Request resolved: pytorch#5464 X-link: meta-pytorch/torchrec#3850 X-link: https://github.com/facebookresearch/FBGEMM/pull/2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
353a4a9 to
416d311
Compare
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 12, 2026
Summary: Pull Request resolved: pytorch#5464 X-link: meta-pytorch/torchrec#3850 X-link: https://github.com/facebookresearch/FBGEMM/pull/2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
416d311 to
24f61c7
Compare
EddyLXJ
added a commit
to EddyLXJ/torchrec
that referenced
this pull request
Mar 12, 2026
…3850) Summary: X-link: pytorch/FBGEMM#5464 Pull Request resolved: meta-pytorch#3850 X-link: https://github.com/facebookresearch/FBGEMM/pull/2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 13, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 13, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/torchrec
that referenced
this pull request
Mar 13, 2026
…3850) Summary: X-link: pytorch/FBGEMM#5464 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
24f61c7 to
39cfd2f
Compare
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 13, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 13, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 13, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 16, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
39cfd2f to
8e86c2d
Compare
EddyLXJ
added a commit
to EddyLXJ/torchrec
that referenced
this pull request
Mar 16, 2026
…3850) Summary: X-link: pytorch/FBGEMM#5464 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/torchrec
that referenced
this pull request
Mar 16, 2026
…3850) Summary: X-link: pytorch/FBGEMM#5464 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
Summary: X-link: facebookresearch/FBGEMM#2437 CONTEXT: cudaStreamAddCallback holds the CUDA driver mutex during callback execution, blocking other threads from making CUDA API calls (e.g., NCCL kernel launches on other streams). This causes latency when multiple CUDA streams operate concurrently. WHAT: Migrate all cudaStreamAddCallback call sites to cudaLaunchHostFunc which does not hold the CUDA driver mutex during execution. - Renamed cuda_callback_func to cuda_host_func with simplified signature (removed stream and status params) - Updated all 7 call sites across kv_db_table_batched_embeddings.cpp and ssd_scratch_pad_indices_queue.cpp - Updated documentation to reflect the new API and its concurrency benefits Reviewed By: zlzhao1104, emlin Differential Revision: D95879076
…ytorch#5463) Summary: X-link: facebookresearch/FBGEMM#2438 CONTEXT: DRAM KV embedding cache currently only stores cached embeddings without enrichment from external sources. This limits the cache's ability to leverage pre-trained embeddings or external knowledge sources like IGR (Identity Graph Resolution) data from Laser, resulting in cold-start issues and lower quality for sparse features. WHAT: This diff introduces a configurable enrichment system that asynchronously fetches embeddings from external sources (e.g., IGR via Laser) to populate the DRAM cache for missing IDs. - Added Python configuration layer: EnrichmentPolicy NamedTuple in split_table_batched_embeddings_ops_common.py with fields for enrichment_type, provider_name, client_id, enrichment_dim, and response_format - Added C++ configuration layer: EnrichmentConfig TorchScript custom class in enrichment_config.h with EnrichmentType enum and EnrichmentResponseFormat enum - Implemented IGR enrichment infrastructure in new igr_enrichment.h: LaserClient initialization, async coroutine-based Laser queries, generic thrift parsing, and tensor preparation utilities - Added enrichment orchestration in DramKVEmbeddingCache: dedicated laser_executor_ thread pool (4 threads), pause/resume mechanism for laser writes to yield to forward/backward passes, rate limiting via pending_laser_requests_ counter - Implemented enrichment_query_id() in training.py: runs on dedicated enrichment_query_stream CUDA stream, performs deduplication on linearized indices, async D2H copy of query IDs - Added zero-weight detection and invalidation logic: detects cache slots with all-zero weights during prefetch/flush, invalidates L1 cache state for zero-weight rows to trigger re-fetch - Updated BUCK dependencies: added laser/client, thrift protocol, and folly/io:iobuf Reviewed By: emlin Differential Revision: D95873233
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
8e86c2d to
b093ce4
Compare
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 16, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/FBGEMM-1
that referenced
this pull request
Mar 16, 2026
Summary: X-link: meta-pytorch/torchrec#3850 X-link: facebookresearch/FBGEMM#2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
EddyLXJ
added a commit
to EddyLXJ/torchrec
that referenced
this pull request
Mar 16, 2026
…3850) Summary: X-link: pytorch/FBGEMM#5464 Pull Request resolved: meta-pytorch#3850 X-link: https://github.com/facebookresearch/FBGEMM/pull/2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280
meta-codesync Bot
pushed a commit
to meta-pytorch/torchrec
that referenced
this pull request
Mar 16, 2026
Summary: X-link: pytorch/FBGEMM#5464 Pull Request resolved: #3850 X-link: https://github.com/facebookresearch/FBGEMM/pull/2439 CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries. WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility. - Added EnrichmentType enum (IGR_LASER_EMBEDDING, IGR_LASER_SID) and EnrichmentResponseFormat enum (JSON, THRIFT_FLOAT, THRIFT_INT64) in split_table_batched_embeddings_ops_common.py - Updated EnrichmentPolicy to use enum types instead of strings - Added enrichment_policy field to KVZCHTBEConfig for config propagation - Convert enum values to int when passing to C++ TorchScript layer in training.py - Added build_embedding_cache_write_kjt() in kvzch_utils.py to extract hashed/unhashed feature pairs from KJT and encode unhashed IDs as float32 weights for enrichment queries - Wired enrichment_policy through batched_embedding_kernel.py to KVZCHParams Reviewed By: zlzhao1104 Differential Revision: D95883280 fbshipit-source-id: 0fcc5b071769a1aa36b5a0354f53406a7ff19e0c
Contributor
|
This pull request has been merged in 2cb38c0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
X-link: meta-pytorch/torchrec#3850
X-link: https://github.com/facebookresearch/FBGEMM/pull/2439
CONTEXT: The enrichment configuration in EnrichmentPolicy uses raw strings for enrichment_type and response_format, which is error-prone and lacks type safety. Additionally, there is no utility to extract unhashed IDs from KJT features for enrichment queries.
WHAT: Strengthen enrichment configuration with Python enums and add a KJT builder utility.
Reviewed By: zlzhao1104
Differential Revision: D95883280