@@ -91,7 +91,7 @@ template <
91
91
bool THREAD_LOCAL = false >
92
92
class GenEmbeddingSpMDMLookup {
93
93
public:
94
- GenEmbeddingSpMDMLookup () {}
94
+ GenEmbeddingSpMDMLookup () = default ;
95
95
typename ReturnFunctionSignature<
96
96
inType,
97
97
indxType,
@@ -235,15 +235,15 @@ GenEmbeddingSpMDMLookup<
235
235
offsetType,
236
236
outType,
237
237
ROWWISE_SPARSE>::jit_embedding_kernel {
238
- bool is_8bit_in = std::is_same <inType, uint8_t >::value ;
239
- bool is_16bit_in = std::is_same <inType, uint16_t >::value ;
240
- bool is_16bit_out = std::is_same <outType, uint16_t >::value ;
238
+ bool is_8bit_in = std::is_same_v <inType, uint8_t >;
239
+ bool is_16bit_in = std::is_same_v <inType, uint16_t >;
240
+ bool is_16bit_out = std::is_same_v <outType, uint16_t >;
241
241
bool is_fp16_in = is_16bit_in && !is_bf16_in;
242
242
bool is_fp16_out = is_16bit_out && !is_bf16_out;
243
243
244
244
// TODO: Make this tunable
245
245
int pref_dist = prefetch;
246
- bool areIndices64b = std::is_same <indxType, int64_t >::value ;
246
+ bool areIndices64b = std::is_same_v <indxType, int64_t >;
247
247
248
248
asmjit::CodeHolder code;
249
249
code.init (runtime ().environment ());
@@ -410,7 +410,7 @@ GenEmbeddingSpMDMLookup<
410
410
constexpr int NUM_VEC_REG = simd_info<instSet>::NUM_VEC_REGS;
411
411
int unroll_factor = NUM_VEC_REG;
412
412
413
- typedef typename simd_info<instSet>::vec_reg_t vec_reg_t ;
413
+ using vec_reg_t = typename simd_info<instSet>::vec_reg_t ;
414
414
415
415
int num_vec_regs_per_block = (block_size + vlen - 1 ) / vlen;
416
416
int remainder = block_size % vlen;
@@ -862,7 +862,7 @@ GenEmbeddingSpMDMLookup<
862
862
a->vmulps (out_vreg, out_vreg, vlen_inv_vreg);
863
863
}
864
864
865
- if (std::is_same <outType, float >::value ) {
865
+ if (std::is_same_v <outType, float >) {
866
866
if (remainder && vec_idx + v == num_vec_regs_per_block - 1 ) {
867
867
if (instSet == inst_set_t ::avx2) {
868
868
a->vmaskmovps (dst_addr, mask_vreg, out_vreg.ymm ());
@@ -1042,7 +1042,7 @@ typename EmbeddingSpMDMKernelSignature<inType, indxType, offsetType, outType>::
1042
1042
output_stride = block_size;
1043
1043
}
1044
1044
if (input_stride == -1 ) {
1045
- if (std::is_same <inType, uint8_t >::value ) {
1045
+ if (std::is_same_v <inType, uint8_t >) {
1046
1046
const auto scale_bias_offset =
1047
1047
2 * (scale_bias_last ? sizeof (float ) : sizeof (uint16_t ));
1048
1048
input_stride = block_size + scale_bias_offset;
@@ -1057,10 +1057,9 @@ typename EmbeddingSpMDMKernelSignature<inType, indxType, offsetType, outType>::
1057
1057
throw std::runtime_error (" Failed to initialize cpuinfo!" );
1058
1058
}
1059
1059
const inst_set_t isa = fbgemmInstructionSet ();
1060
- if ((std::is_same<inType, float >::value ||
1061
- std::is_same<inType, uint16_t >::value) &&
1060
+ if ((std::is_same_v<inType, float > || std::is_same_v<inType, uint16_t >) &&
1062
1061
block_size == 1 && isYmm (isa) && output_stride == block_size &&
1063
- input_stride == block_size && std::is_same <outType, float >::value &&
1062
+ input_stride == block_size && std::is_same_v <outType, float > &&
1064
1063
!is_asmjit_disabled ()) {
1065
1064
return [=](int64_t output_size,
1066
1065
int64_t index_size,
@@ -1352,7 +1351,7 @@ GenerateEmbeddingSpMDMRowWiseSparse(
1352
1351
bool use_offsets) {
1353
1352
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
1354
1353
int64_t input_stride = block_size;
1355
- if (std::is_same <inType, uint8_t >::value ) {
1354
+ if (std::is_same_v <inType, uint8_t >) {
1356
1355
const auto scale_bias_offset = 2 * sizeof (float );
1357
1356
input_stride = block_size + scale_bias_offset;
1358
1357
}
0 commit comments