Skip to content

Commit

Permalink
use f14 map for csr2csc (pytorch#592)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#592

Use f14 map instead of std::unordered_map

Reviewed By: xing-liu

Differential Revision: D27567292

fbshipit-source-id: 2ecc6be5423379879204a850c44732a4ce9446f3
  • Loading branch information
jspark1105 authored and facebook-github-bot committed Apr 11, 2021
1 parent 00f4892 commit c609f3c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions fbgemm_gpu/codegen/embedding_forward_split_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#include "codegen/embedding_forward_split_cpu.h"
#include "fbgemm/FbgemmEmbedding.h"
#include "fbgemm/Types.h"
#ifdef FBCODE_CAFFE2
#include "folly/container/F14Map.h"
#endif

#include <ATen/AccumulateType.h>

Expand Down Expand Up @@ -360,7 +363,11 @@ void batched_csr2csc(
for (int t = 0; t < num_tables; ++t) {
int num_non_empty_segments = 0;
if (batched_csc.weights.empty()) {
#ifdef FBCODE_CAFFE2
folly::F14FastMap<int64_t, std::vector<std::vector<int>>>
#else
std::unordered_map<int64_t, std::vector<std::vector<int>>>
#endif
non_empty_columns;
int f_begin = table_to_feature_offset[t];
int f_end = table_to_feature_offset[t + 1];
Expand Down Expand Up @@ -410,7 +417,11 @@ void batched_csr2csc(
} // for each column
} else {
// !batched_csc.weights.empty()
#ifdef FBCODE_CAFFE2
folly::F14FastMap<
#else
std::unordered_map<
#endif
int64_t,
std::vector<std::vector<std::pair<int, scalar_t>>>>
non_empty_columns;
Expand Down

0 comments on commit c609f3c

Please sign in to comment.