Skip to content

Commit

Permalink
More fixes related to MSVC build (pytorch#240)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#240

For pytorch#150

Reviewed By: jspark1105

Differential Revision: D19324136

fbshipit-source-id: 24c2eeeafc905588c6db5b4aa5c20c2d5ef56351
  • Loading branch information
dskhudia authored and facebook-github-bot committed Jan 13, 2020
1 parent 483a32c commit 28f8049
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions include/fbgemm/QuantUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ FBGEMM_API void ChooseRequantizationMultiplier(
// TODO: T26263653 fix signed-integer-overflow undefined behavior
template <typename T1, typename T2 = std::uint8_t>
NO_SANITIZE("signed-integer-overflow")
FBGEMM_API T2 clamp(T1 src, int precision, bool is_signed = false) {
T2 clamp(T1 src, int precision, bool is_signed = false) {
std::int32_t min = is_signed ? -(1LL << (precision - 1)) : 0;
std::int32_t max =
is_signed ? ((1LL << (precision - 1)) - 1) : (1LL << precision) - 1;
Expand All @@ -49,7 +49,7 @@ FBGEMM_API T2 clamp(T1 src, int precision, bool is_signed = false) {
/// Quantize src using zero_point and scale, clamp to the specified precision,
/// and convert it to type T
template <typename T>
FBGEMM_API T Quantize(
T Quantize(
float src,
std::int32_t zero_point,
float scale,
Expand All @@ -63,7 +63,7 @@ FBGEMM_API T Quantize(
}

template <typename T>
FBGEMM_API T Quantize(float src, const TensorQuantizationParams& qparams) {
T Quantize(float src, const TensorQuantizationParams& qparams) {
return Quantize<T>(src, qparams.zero_point, qparams.scale, qparams.precision);
}

Expand Down Expand Up @@ -109,12 +109,12 @@ FBGEMM_API void QuantizeGroupwise(
T* dst);

template <typename T>
FBGEMM_API float Dequantize(T src, const TensorQuantizationParams& qparams) {
float Dequantize(T src, const TensorQuantizationParams& qparams) {
return qparams.scale * (src - qparams.zero_point);
}

template <typename T>
FBGEMM_API void Dequantize(
void Dequantize(
const T* src,
float* dst,
int len,
Expand All @@ -131,7 +131,7 @@ FBGEMM_API std::int64_t
SaturatingRoundingMulWithShift(std::int32_t a, std::int32_t b, int right_shift);

template <typename T>
FBGEMM_API T Requantize(
T Requantize(
std::int32_t src, // int32 input before requantization
std::int32_t zero_point,
std::int32_t multiplier,
Expand All @@ -145,7 +145,7 @@ FBGEMM_API T Requantize(
}

template <typename T>
FBGEMM_API T RequantizeFixedPoint(
T RequantizeFixedPoint(
std::int32_t src, // int32 input before requantization
const RequantizationParams& params) {
return Requantize<T>(
Expand All @@ -167,7 +167,7 @@ FBGEMM_API void RequantizeFixedPoint(
// Requantization (with floats)

template <typename T>
FBGEMM_API T Requantize(
T Requantize(
std::int32_t src, // int32 input before requantization
std::int32_t zero_point,
float multiplier,
Expand All @@ -178,7 +178,7 @@ FBGEMM_API T Requantize(
}

template <typename T>
FBGEMM_API T Requantize(
T Requantize(
std::int32_t src, // int32 input before requantization
const RequantizationParams& params) {
return Requantize<T>(
Expand Down
4 changes: 2 additions & 2 deletions include/fbgemm/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ FBGEMM_API thread_type_t fbgemmGetThreadPartition(
int n_align = 64);

template <int SIZE, typename T = std::int32_t>
FBGEMM_API std::string arrayToString(const std::array<T, SIZE>& inp) {
std::string arrayToString(const std::array<T, SIZE>& inp) {
std::string out = "[";
for (int i = 0; i < SIZE; ++i) {
out += std::to_string(inp[i]);
Expand All @@ -255,7 +255,7 @@ FBGEMM_API std::string arrayToString(const std::array<T, SIZE>& inp) {
}

template <typename accT = std::int32_t>
FBGEMM_API bool isValidBlockingFactor(BlockingFactors* param) {
bool isValidBlockingFactor(BlockingFactors* param) {
constexpr bool is_32bit = std::is_same<accT, int32_t>::value;
constexpr bool is_16bit = std::is_same<accT, int16_t>::value;
static const auto iset = fbgemmInstructionSet();
Expand Down

0 comments on commit 28f8049

Please sign in to comment.