Fixed compilation errors / warnings with clang (#2929)

This commit is contained in:
Ilya Lavrenov 2020-11-02 11:56:38 +03:00 committed by GitHub
parent d3c2d90d7f
commit 890c8e4d38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 13 deletions

View File

@ -4,6 +4,7 @@
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#include <cmath>
#include <runtime/pwl.h> #include <runtime/pwl.h>
#include <gna_slope_scale.h> #include <gna_slope_scale.h>
@ -413,12 +414,12 @@ void make_gna_pwl(const DnnActivation fun,
y_upper = tmp; y_upper = tmp;
} }
int64_t x_lower_new = FLOAT_TO_INT32((x_lower / in_scale) / abs(pow_scale) * in_scale); int64_t x_lower_new = FLOAT_TO_INT32((x_lower / in_scale) / std::fabs(pow_scale) * in_scale);
int64_t x_upper_new = FLOAT_TO_INT32((x_upper / in_scale) / abs(pow_scale) * in_scale); int64_t x_upper_new = FLOAT_TO_INT32((x_upper / in_scale) / std::fabs(pow_scale) * in_scale);
x_lower = static_cast<int32_t>(x_lower_new); x_lower = static_cast<int32_t>(x_lower_new);
x_upper = static_cast<int32_t>(x_upper_new); x_upper = static_cast<int32_t>(x_upper_new);
if (x_lower_new < INT32_MIN) { if (x_lower_new < INT32_MIN) {
int16_t offset_lower = abs(x_lower_new - INT32_MIN) / in_scale * out_scale; int16_t offset_lower = std::abs(x_lower_new - INT32_MIN) / in_scale * out_scale;
x_lower = INT32_MIN; x_lower = INT32_MIN;
y_lower = y_lower + offset_lower; y_lower = y_lower + offset_lower;
} }

View File

@ -7,5 +7,5 @@
#include <cstdint> #include <cstdint>
#define FLOAT_TO_INT16(a) static_cast<int16_t>(((a) < 0)?((a) - 0.5):((a) + 0.5)) #define FLOAT_TO_INT16(a) static_cast<int16_t>(((a) < 0)?((a) - 0.5f):((a) + 0.5f))
#define FLOAT_TO_INT32(a) static_cast<int32_t>(((a) < 0)?((a)-0.5):((a)+0.5)) #define FLOAT_TO_INT32(a) static_cast<int32_t>(((a) < 0)?((a)-0.5f):((a)+0.5f))

View File

@ -60,10 +60,10 @@ public:
void * alloc(size_t size) noexcept override { void * alloc(size_t size) noexcept override {
return ptr; return ptr;
} }
virtual bool free(void* handle) noexcept { bool free(void* handle) noexcept override {
return true; return true;
} }
virtual void Release() noexcept { void Release() noexcept override {
delete this; delete this;
} }
}; };

View File

@ -34,7 +34,7 @@ public:
}; };
} }
JitConstants GetJitConstants(const eltwise_params& params) const; JitConstants GetJitConstants(const eltwise_params& params) const override;
protected: protected:
bool Validate(const Params& p, const optional_params& o) const override; bool Validate(const Params& p, const optional_params& o) const override;

View File

@ -24,7 +24,7 @@ class ReduceKernel_b_fs_yx_fsv16 : public ReduceKernelBase {
public: public:
ReduceKernel_b_fs_yx_fsv16() : ReduceKernelBase("reduce_gpu_b_fs_yx_fsv16") {} ReduceKernel_b_fs_yx_fsv16() : ReduceKernelBase("reduce_gpu_b_fs_yx_fsv16") {}
virtual ~ReduceKernel_b_fs_yx_fsv16() {} virtual ~ReduceKernel_b_fs_yx_fsv16() {}
virtual CommonDispatchData SetDefault(const reduce_params& params, const optional_params&) const; CommonDispatchData SetDefault(const reduce_params& params, const optional_params&) const override;
JitConstants GetJitConstants(const reduce_params& params) const override; JitConstants GetJitConstants(const reduce_params& params) const override;
KernelsData GetKernelsData(const Params& params, const optional_params& options) const override; KernelsData GetKernelsData(const Params& params, const optional_params& options) const override;
ParamsKey GetSupportedKey() const override; ParamsKey GetSupportedKey() const override;

View File

@ -24,7 +24,7 @@ class ReduceKernelRef : public ReduceKernelBase {
public: public:
ReduceKernelRef() : ReduceKernelBase("reduce_ref") {} ReduceKernelRef() : ReduceKernelBase("reduce_ref") {}
virtual ~ReduceKernelRef() {} virtual ~ReduceKernelRef() {}
virtual CommonDispatchData SetDefault(const reduce_params& params, const optional_params&) const; CommonDispatchData SetDefault(const reduce_params& params, const optional_params&) const override;
KernelsData GetKernelsData(const Params& params, const optional_params& options) const override; KernelsData GetKernelsData(const Params& params, const optional_params& options) const override;
ParamsKey GetSupportedKey() const override; ParamsKey GetSupportedKey() const override;
JitConstants GetJitConstants(const reduce_params& params) const override; JitConstants GetJitConstants(const reduce_params& params) const override;

View File

@ -50,7 +50,7 @@ public:
protected: protected:
virtual CommonDispatchData SetDefault(const space_to_depth_params& params, const optional_params&) const; virtual CommonDispatchData SetDefault(const space_to_depth_params& params, const optional_params&) const;
virtual JitConstants GetJitConstants(const space_to_depth_params& params) const; virtual JitConstants GetJitConstants(const space_to_depth_params& params) const;
virtual bool Validate(const Params& p, const optional_params& o) const; bool Validate(const Params& p, const optional_params& o) const override;
std::vector<FusedOpType> GetSupportedFusedOps() const override { std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE, return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE, FusedOpType::QUANTIZE,

View File

@ -55,7 +55,7 @@ public:
} }
std::shared_ptr<gpu_toolkit> get_context() const { return _ctx; } std::shared_ptr<gpu_toolkit> get_context() const { return _ctx; }
cl::Event get() { return _event; } cl::Event get() override { return _event; }
private: private:
std::shared_ptr<gpu_toolkit> _ctx; std::shared_ptr<gpu_toolkit> _ctx;
@ -91,7 +91,7 @@ public:
_attached = true; _attached = true;
} }
cl::Event get() { return _last_ocl_event; } cl::Event get() override { return _last_ocl_event; }
std::shared_ptr<gpu_toolkit> get_context() const { return _ctx; } std::shared_ptr<gpu_toolkit> get_context() const { return _ctx; }
private: private: