Skip to content

Commit

Permalink
remove EmbeddingSpMDM4BitKernelSignature (pytorch#257)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#257

We can just reuse EmbeddingSpMDMKernelSignature

Reviewed By: jianyuh

Differential Revision: D19460537

fbshipit-source-id: bf757bc8ad3f692589af85ba4a522b826e7c3a1b
  • Loading branch information
jspark1105 authored and facebook-github-bot committed Jan 21, 2020
1 parent a22e6b8 commit ab4da8f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 31 deletions.
16 changes: 1 addition & 15 deletions include/fbgemm/FbgemmEmbedding.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,7 @@ FBGEMM_API bool EmbeddingSpMDM(
bool is_weight_positional = false);

template <typename IndexType>
class EmbeddingSpMDM4BitKernelSignature {
public:
using Type = std::function<bool(
std::int64_t output_size,
std::int64_t index_size,
std::int64_t data_size,
const std::uint8_t* input,
const IndexType* indices,
const int* lengths,
const float* weights, // optional, can be null for non-weighted sum
float* out)>;
};

template <typename IndexType>
FBGEMM_API typename EmbeddingSpMDM4BitKernelSignature<IndexType>::Type
FBGEMM_API typename EmbeddingSpMDMKernelSignature<std::uint8_t, IndexType>::Type
GenerateEmbeddingSpMDM4Bit(
const std::int64_t block_size,
bool has_weight,
Expand Down
34 changes: 18 additions & 16 deletions src/EmbeddingSpMDM4Bit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ GenEmbeddingSpMDM4BitLookup<indxType>::getOrCreate(
} // namespace

template <typename indxType>
typename EmbeddingSpMDM4BitKernelSignature<indxType>::Type
typename EmbeddingSpMDMKernelSignature<std::uint8_t, indxType>::Type
GenerateEmbeddingSpMDM4Bit(
const std::int64_t block_size,
bool has_weight,
Expand Down Expand Up @@ -648,21 +648,23 @@ bool EmbeddingSpMDM4Bit(
out);
}

template typename EmbeddingSpMDM4BitKernelSignature<std::int64_t>::Type
GenerateEmbeddingSpMDM4Bit<std::int64_t>(
const std::int64_t block_size,
bool has_weight,
bool normalize_by_lengths,
int prefetch,
bool is_weight_positional);

template typename EmbeddingSpMDM4BitKernelSignature<std::int32_t>::Type
GenerateEmbeddingSpMDM4Bit<std::int32_t>(
const std::int64_t block_size,
bool has_weight,
bool normalize_by_lengths,
int prefetch,
bool is_weight_positional);
template
typename EmbeddingSpMDMKernelSignature<std::uint8_t, std::int64_t>::Type
GenerateEmbeddingSpMDM4Bit<std::int64_t>(
const std::int64_t block_size,
bool has_weight,
bool normalize_by_lengths,
int prefetch,
bool is_weight_positional);

template
typename EmbeddingSpMDMKernelSignature<std::uint8_t, std::int32_t>::Type
GenerateEmbeddingSpMDM4Bit<std::int32_t>(
const std::int64_t block_size,
bool has_weight,
bool normalize_by_lengths,
int prefetch,
bool is_weight_positional);

template bool EmbeddingSpMDM4Bit(
const std::int64_t block_size,
Expand Down

0 comments on commit ab4da8f

Please sign in to comment.