Repository navigation
Refactor test for alignment; add get_sharded_table_capacity - #348
Conversation
5b45946 to
c89d3eb
Compare
Greptile SummaryThis PR refactors
Confidence Score: 4/5Safe to merge after fixing the duplicate test entry in unit_test.sh; all other changes are correct. One P1 defect: the duplicate test_hybrid_storage_export.sh entry in unit_test.sh causes that script to run twice in every CI pass, wasting resources. All other changes — the API rename, planner refactor, and new parametric tests — are logically correct and well-structured. corelib/dynamicemb/test/unit_test.sh — duplicate FWD_BWD_TEST_FILES entry at line 12. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["get_sharded_table_capacity(config, world_size, bucket_capacity)"]
B["_sharded_table_bucket_layout(config, world_size, bucket_capacity)"]
C{bucket_capacity == MAX_BUCKET_CAPACITY?}
D["return (1, align(shard_rows, BUCKET_ALIGNMENT))"]
E{bucket_capacity valid & aligned?}
F["ValueError"]
G["table_cap = align(shard_rows, bucket_capacity)\nnum_buckets = table_cap // bucket_capacity\nreturn (num_buckets, bucket_capacity)"]
H["return num_buckets * effective_bucket"]
A --> B
B --> C
C -- Yes --> D
C -- No --> E
E -- No --> F
E -- Yes --> G
D --> H
G --> H
I["_prepare_dynemb_table_options (planner)"]
I --> B
B --> J["opts.bucket_capacity = effective_bucket\nopts.max_capacity = num_buckets x effective_bucket\nopts.local_hbm = ceil(global_hbm / world_size)"]
K["get_table_value_bytes"]
K --> A
A --> L["total_rows = capacity_per_rank x world_size\nbytes = element_size x (dim + optim_dim) x total_rows"]
Reviews (6): Last reviewed commit: "Fix initialization error thron by DataLo..." | Re-trigger Greptile |
a655b60 to
bc8ea10
Compare
Rewrite test/unit_tests/test_alignment.py: drop memory-report helpers and ad-hoc theory vs DMP comparison; add pytest-parametric checks for planner options (max_capacity, local_hbm) vs get_sharded_table_capacity/get_table_value_bytes, and cache/storage value tensor shapes vs hashtable metadata. Invoke via test/unit_tests/test_alignment.sh; unit_test.sh calls the shell wrapper. API: replace public get_sharded_table_shape with get_sharded_table_capacity; introduce internal _sharded_table_bucket_layout for planner; update get_table_value_bytes, docs, and call sites. Made-with: Cursor
bc8ea10 to
797387d
Compare
* dynamicemb: refactor test_alignment; add get_sharded_table_capacity Rewrite test/unit_tests/test_alignment.py: drop memory-report helpers and ad-hoc theory vs DMP comparison; add pytest-parametric checks for planner options (max_capacity, local_hbm) vs get_sharded_table_capacity/get_table_value_bytes, and cache/storage value tensor shapes vs hashtable metadata. Invoke via test/unit_tests/test_alignment.sh; unit_test.sh calls the shell wrapper. API: replace public get_sharded_table_shape with get_sharded_table_capacity; introduce internal _sharded_table_bucket_layout for planner; update get_table_value_bytes, docs, and call sites. Made-with: Cursor * Enhance test_alignment.sh * use get_sharded_table_capacity in example.py * Fix initialization error thron by DataLoader by avoiding CUDA context clone
* dynamicemb: refactor test_alignment; add get_sharded_table_capacity Rewrite test/unit_tests/test_alignment.py: drop memory-report helpers and ad-hoc theory vs DMP comparison; add pytest-parametric checks for planner options (max_capacity, local_hbm) vs get_sharded_table_capacity/get_table_value_bytes, and cache/storage value tensor shapes vs hashtable metadata. Invoke via test/unit_tests/test_alignment.sh; unit_test.sh calls the shell wrapper. API: replace public get_sharded_table_shape with get_sharded_table_capacity; introduce internal _sharded_table_bucket_layout for planner; update get_table_value_bytes, docs, and call sites. Made-with: Cursor * Enhance test_alignment.sh * use get_sharded_table_capacity in example.py * Fix initialization error thron by DataLoader by avoiding CUDA context clone
Rewrite test/unit_tests/test_alignment.py: drop memory-report helpers and ad-hoc theory vs DMP comparison; add pytest-parametric checks for planner options (max_capacity, local_hbm) vs get_sharded_table_capacity/get_table_value_bytes, and cache/storage value tensor shapes vs hashtable metadata. Invoke via test/unit_tests/test_alignment.sh; unit_test.sh calls the shell wrapper.
API: replace public get_sharded_table_shape with get_sharded_table_capacity; introduce internal _sharded_table_bucket_layout for planner; update get_table_value_bytes, docs, and call sites.
Made-with: Cursor
Description
Checklist