Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FBGEMM CI strict aliasing and unused var errors #3083

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/EmbeddingSpMDMAutovec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ bool EmbeddingSpMDMNBit_autovec(
return false;
}
#if _OPENMP >= 202011
constexpr int tile_size = 4;
[[maybe_unused]] constexpr int tile_size = 4;
#pragma omp tile sizes(tile_size)
#endif
for (int i = 0; i < len; ++i) {
Expand Down Expand Up @@ -571,7 +571,7 @@ bool EmbeddingSpMDM_autovec(
return false;
}

constexpr int tile_size = 4;
[[maybe_unused]] constexpr int tile_size = 4;
#if _OPENMP >= 202011
#pragma omp tile sizes(tile_size)
#endif
Expand Down Expand Up @@ -711,7 +711,7 @@ bool EmbeddingSpMDMRowWiseSparse_autovec(
return false;
}

constexpr int tile_size = 4;
[[maybe_unused]] constexpr int tile_size = 4;
#if _OPENMP >= 202011
#pragma omp tile sizes(tile_size)
#endif
Expand Down Expand Up @@ -828,10 +828,15 @@ void Float8ToFloat_ref_batch(
val_out = (inp & 0x7F) << (24 - (8 - exponent_bits));

multiplier = (127 + (127 - exponent_bias)) << 23; // 2^(127-bias)
float val_out_f = *reinterpret_cast<float*>(&val_out) *
*reinterpret_cast<float*>(&multiplier); // val_out * multiplier
val_out = *reinterpret_cast<uint32_t*>(&val_out_f) | sign;
output[i] = *reinterpret_cast<float*>(&val_out);

float* multiplier_f_ = reinterpret_cast<float*>(&multiplier);
float* val_out_f_ = reinterpret_cast<float*>(&val_out);

float val_out_f = *val_out_f_ * *multiplier_f_; // val_out * multiplier
uint32_t* val_out_ = reinterpret_cast<uint32_t*>(&val_out_f);
val_out = *val_out_ | sign;
val_out_f_ = reinterpret_cast<float*>(&val_out);
output[i] = *val_out_f_;
}
}
} // namespace
Expand Down Expand Up @@ -911,7 +916,7 @@ bool EmbeddingSpMDMFP8_autovec(
return false;
}

constexpr int tile_size = 4;
[[maybe_unused]] constexpr int tile_size = 4;
#if _OPENMP >= 202011
#pragma omp tile sizes(tile_size)
#endif
Expand Down
Loading