Skip to content

Commit 3df231b

Browse files
q10meta-codesync[bot]
authored andcommitted
Convert ops_common.py to re-export shell (#5794)
Summary: Pull Request resolved: #5794 Convert split_table_batched_embeddings_ops_common.py from a 528-line module defining all TBE common types to a ~60-line re-export shell that imports from the canonical locations: - Core types (EmbeddingLocation, PoolingMode, etc.) from fbgemm_gpu.tbe.config - Cache types (CacheAlgorithm, CacheState) from fbgemm_gpu.tbe.cache.cache_config - SSD types (EvictionPolicy, KVZCHParams, etc.) from fbgemm_gpu.tbe.ssd.ssd_config Infrastructure changes: - Create lightweight :tbe_cache_config and :tbe_ssd_config BUCK targets - Remove cache_config.py/ssd_config.py from their parent ops targets' srcs - Add get_new_embedding_location() to tbe/config/embedding_config.py All existing import paths continue to work unchanged. Reviewed By: henrylhtsang Differential Revision: D103477971 fbshipit-source-id: cf18816bdc8d42e0d839595b584058854de64760
1 parent 07767a8 commit 3df231b

23 files changed

Lines changed: 152 additions & 592 deletions

fbgemm_gpu/fbgemm_gpu/sparse_ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
# fmt:skip
1616
from fbgemm_gpu.split_embedding_configs import SparseType
17-
from fbgemm_gpu.split_table_batched_embeddings_ops_common import PoolingMode
17+
from fbgemm_gpu.tbe.config import PoolingMode
1818
from fbgemm_gpu.utils.loader import load_torch_module
1919

2020
try:

fbgemm_gpu/fbgemm_gpu/split_embedding_configs.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
import torch
1515

1616
# fmt:skip
17-
from fbgemm_gpu.split_table_batched_embeddings_ops_common import (
18-
EmbeddingLocation,
19-
SplitState,
20-
)
17+
from fbgemm_gpu.tbe.config import EmbeddingLocation, SplitState
2118

2219

2320
def pad4(value: int) -> int:

fbgemm_gpu/fbgemm_gpu/split_embedding_inference_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
QuantizationConfig,
2121
SparseType,
2222
)
23-
from fbgemm_gpu.split_table_batched_embeddings_ops_common import EmbeddingLocation
2423
from fbgemm_gpu.split_table_batched_embeddings_ops_inference import (
2524
IntNBitTableBatchedEmbeddingBagsCodegen,
2625
)
2726
from fbgemm_gpu.split_table_batched_embeddings_ops_training import (
2827
ComputeDevice,
2928
SplitTableBatchedEmbeddingBagsCodegen,
3029
)
30+
from fbgemm_gpu.tbe.config import EmbeddingLocation
3131
from fbgemm_gpu.tbe.utils import quantize_embs
3232
from torch import Tensor # usort:skip
3333

fbgemm_gpu/fbgemm_gpu/split_table_batched_embeddings_ops.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,6 @@
1818
# fbgemm_gpu.split_table_batched_embeddings_ops_training
1919

2020
from fbgemm_gpu.split_embedding_configs import EmbOptimType as OptimType, SparseType
21-
from fbgemm_gpu.split_table_batched_embeddings_ops_common import (
22-
BoundsCheckMode,
23-
CacheAlgorithm,
24-
CacheState,
25-
DEFAULT_SCALE_BIAS_SIZE_IN_BYTES,
26-
EmbeddingLocation,
27-
PoolingMode,
28-
RecordCacheMetrics,
29-
round_up,
30-
SplitState,
31-
)
3221
from fbgemm_gpu.split_table_batched_embeddings_ops_inference import (
3322
align_to_cacheline,
3423
IntNBitTableBatchedEmbeddingBagsCodegen,
@@ -48,6 +37,16 @@
4837
TailIdThreshold,
4938
WeightDecayMode,
5039
)
40+
from fbgemm_gpu.tbe.cache import CacheAlgorithm, CacheState
41+
from fbgemm_gpu.tbe.config import (
42+
BoundsCheckMode,
43+
DEFAULT_SCALE_BIAS_SIZE_IN_BYTES,
44+
EmbeddingLocation,
45+
PoolingMode,
46+
RecordCacheMetrics,
47+
round_up,
48+
SplitState,
49+
)
5150

5251
try:
5352
if torch.version.hip:

0 commit comments

Comments
 (0)