Repository navigation
[bugfix] fix hang issue when fed empty batch - #342
Conversation
Greptile SummaryThis PR removes the
Confidence Score: 5/5Safe to merge — removes a well-understood faulty early-exit that caused distributed hangs and index misalignment. The change is a focused one-block removal. It fixes the primary hang by ensuring symmetric CUDA kernel execution across all ranks, and simultaneously eliminates two secondary bugs (missing frequency_counters append and dtype inconsistency for reverse_idx in the empty path). No new logic is introduced. All remaining CUDA functions are documented as asynchronous and naturally handle zero-element inputs. No P0/P1 issues found. No files require special attention.
|
| Filename | Overview |
|---|---|
| corelib/dynamicemb/dynamicemb/shard/embedding.py | Removes the empty-batch early-exit in _dedup_indices, ensuring all ranks execute the same CUDA operations and fixing frequency_counters index misalignment when LFU/admit strategy is active. |
Sequence Diagram
sequenceDiagram
participant Caller
participant _dedup_indices
participant expand_table_ids_cuda
participant segmented_unique_cuda
participant compute_dedup_lengths_cuda
Caller->>_dedup_indices: input_feature (any batch size)
Note over _dedup_indices: Old code: if num_elements==0 → continue (skip CUDA ops)<br/>New code: always proceed
_dedup_indices->>expand_table_ids_cuda: offsets, d_table_offset, table_num, local_batchsize, num_elements
expand_table_ids_cuda-->>_dedup_indices: table_ids
_dedup_indices->>segmented_unique_cuda: indices, table_ids, table_num, input_frequencies
segmented_unique_cuda-->>_dedup_indices: num_uniques, unique_keys, reverse_idx, table_offsets, freq_counters
_dedup_indices->>compute_dedup_lengths_cuda: table_offsets, d_table_offset, table_num, local_batchsize, total_B
compute_dedup_lengths_cuda-->>_dedup_indices: new_lengths, new_offsets
_dedup_indices->>_dedup_indices: ctx.input_features.append(input_feature)
_dedup_indices->>_dedup_indices: ctx.reverse_indices.append(reverse_idx)
_dedup_indices->>_dedup_indices: ctx.frequency_counters.append(frequency_counters) [if LFU/admit]
_dedup_indices-->>Caller: features_by_shards (dedup_features)
Reviews (2): Last reviewed commit: "Remove empty input handling in embedding..." | Re-trigger Greptile
|
@shijieliu please take a look |
|
hi @gameofdimension thanks for your contribution! We will try to reproduce this issue first and merge after verify. |
|
@shijieliu this PR fix the [issue](https://github.com/NVIDIA/recsys-examples/issues/341fix issue #341) indeed, I think it can be merged. |
Removed handling for empty input in embedding processing.
fix issue #341
Description
Checklist