Skip to content

Commit b83a755

Browse files
MatzeBfacebook-github-bot
authored andcommitted
Fix weights pointer not moving in idx==-1 shortcut (pytorch#4199)
Summary: Pull Request resolved: pytorch#4199 X-link: facebookresearch/FBGEMM#1274 This fixes the weights pointer not correctly advancing when taking the loop shortcut when an input `idx == -1`. Reviewed By: Nicoshev Differential Revision: D75489926 fbshipit-source-id: 45c956df353ab6772bfd19cf7c527d867abc5e19
1 parent 0064436 commit b83a755

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/EmbeddingSpMDMAutovec.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ static bool ALWAYS_INLINE EmbeddingSpMDM8Bit_autovec(
202202
if (!scale_bias_last && idx == -1) {
203203
// When scale_bias_last == false, assume this is for table batched
204204
// embedding (TBE) that can get -1 for pruned rows.
205+
weights_addr++;
205206
continue;
206207
}
207208
return false;
@@ -693,6 +694,7 @@ static bool ALWAYS_INLINE EmbeddingSpMDMRowWiseSparse_autovec(
693694
}
694695
IndexType idx = compressed_indices_table[uncompressed_idx];
695696
if (idx == -1) {
697+
weights_addr++;
696698
continue;
697699
}
698700
// if (idx < 0 || idx >= compressed_data_size) {
@@ -758,6 +760,7 @@ static bool ALWAYS_INLINE EmbeddingSpMDMRowWiseSparse_autovec(
758760
}
759761
IndexType idx = compressed_indices_table[uncompressed_idx];
760762
if (idx == -1) {
763+
weights_addr++;
761764
continue;
762765
}
763766

0 commit comments

Comments
 (0)