Unverified Commit c00d70b7 authored by Scott Cyphers's avatar Scott Cyphers Committed by GitHub

Merge branch 'master' into cyphers/plaidwin

parents 1eac5a70 5c298a4a
......@@ -187,7 +187,7 @@ mlir::Type MLIRCompiler::get_mlir_type(const descriptor::Tensor* tensor)
// Converts an nGraph element type into an MLIR type.
mlir::Type MLIRCompiler::get_mlir_type(const element::Type& type)
{
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -215,7 +215,7 @@ mlir::Type MLIRCompiler::get_mlir_type(const element::Type& type)
NGRAPH_CHECK(false, "Unreachable");
return mlir::Type();
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
}
......
......@@ -24,7 +24,7 @@ using namespace ngraph;
std::ostream& reduction::operator<<(std::ostream& out, const reduction::Type& obj)
{
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -36,7 +36,7 @@ std::ostream& reduction::operator<<(std::ostream& out, const reduction::Type& ob
case reduction::Type::MIN: out << "MIN"; break;
case reduction::Type::MAX: out << "MAX"; break;
}
#if !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8)
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
return out;
......
......@@ -87,7 +87,7 @@ namespace ngraph
}
decltype(MLSL::RT_SUM) mlsl_reduce_type;
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -101,7 +101,7 @@ namespace ngraph
case reduction::Type::MIN: mlsl_reduce_type = MLSL::RT_MIN; break;
case reduction::Type::MAX: mlsl_reduce_type = MLSL::RT_MAX; break;
}
#if !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8)
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
......
......@@ -99,7 +99,7 @@ namespace ngraph
}
decltype(MPI_SUM) mpi_reduce_type;
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -111,7 +111,7 @@ namespace ngraph
case reduction::Type::MIN: mpi_reduce_type = MPI_MIN; break;
case reduction::Type::MAX: mpi_reduce_type = MPI_MAX; break;
}
#if !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8)
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
......@@ -176,7 +176,7 @@ namespace ngraph
MPI_Datatype ngraph_type_to_mpi_type(element::Type_t& n_type)
{
MPI_Datatype m_type = MPI_FLOAT;
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -199,7 +199,7 @@ namespace ngraph
case element::Type_t::undefined:
case element::Type_t::dynamic: throw std::runtime_error("unsupported type");
}
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
return m_type;
......
......@@ -105,12 +105,16 @@ void ngraph::LogPrintf(const char* fmt, ...)
va_start(args1, fmt);
va_list args2;
va_copy(args2, args1);
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#endif
std::vector<char> buf(1 + std::vsnprintf(nullptr, 0, fmt, args1));
va_end(args1);
std::vsnprintf(buf.data(), buf.size(), fmt, args2);
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
va_end(args2);
get_distributed_interface()->log_print(get_timestamp(), buf);
}
......
......@@ -54,7 +54,7 @@ op::Constant::~Constant()
string op::Constant::convert_value_to_string(size_t index) const
{
string rc;
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -81,7 +81,7 @@ string op::Constant::convert_value_to_string(size_t index) const
case element::Type_t::undefined: throw runtime_error("unsupported type");
case element::Type_t::dynamic: throw runtime_error("unsupported type");
}
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
return rc;
......@@ -91,7 +91,7 @@ vector<string> op::Constant::get_value_strings() const
{
vector<string> rc;
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -179,7 +179,7 @@ vector<string> op::Constant::get_value_strings() const
case element::Type_t::undefined: throw runtime_error("unsupported type");
case element::Type_t::dynamic: throw runtime_error("unsupported type");
}
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
......@@ -287,9 +287,11 @@ static bool test_bitwise_identical(const op::Constant* constant)
bool op::Constant::are_all_data_elements_bitwise_identical() const
{
bool rc = false;
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
#endif
switch (get_element_type().get_type_enum())
{
case element::Type_t::boolean:
......@@ -324,7 +326,9 @@ bool op::Constant::are_all_data_elements_bitwise_identical() const
case element::Type_t::undefined:
case element::Type_t::dynamic: break;
}
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
return rc;
}
......
......@@ -284,7 +284,7 @@ namespace ngraph
{
throw std::runtime_error("Constant initializer does not match shape");
}
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -333,7 +333,7 @@ namespace ngraph
case element::Type_t::undefined: throw std::runtime_error("unsupported type");
case element::Type_t::dynamic: throw std::runtime_error("unsupported type");
}
#if !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8)
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
}
......
......@@ -214,7 +214,7 @@ void op::Range::validate_and_infer_types()
PartialShape result_shape;
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -240,7 +240,7 @@ void op::Range::validate_and_infer_types()
this, false, "Internal nGraph error: unsupported element type: ", result_et);
break;
}
#if !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8)
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
......
......@@ -1509,6 +1509,11 @@ template <typename TI>
shared_ptr<op::Constant> fold_constant_convert_helper0(shared_ptr<op::Constant> constant,
const element::Type& output_element_type)
{
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
#endif
switch (output_element_type.get_type_enum())
{
case element::Type_t::undefined:
......@@ -1546,6 +1551,9 @@ shared_ptr<op::Constant> fold_constant_convert_helper0(shared_ptr<op::Constant>
}
NGRAPH_UNREACHABLE("Unexpected switch case");
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
}
static shared_ptr<op::Constant> fold_constant_convert(shared_ptr<op::Constant> constant,
......@@ -1558,6 +1566,11 @@ static shared_ptr<op::Constant> fold_constant_convert(shared_ptr<op::Constant> c
return constant;
}
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
#endif
switch (input_element_type.get_type_enum())
{
case element::Type_t::undefined:
......@@ -1595,6 +1608,9 @@ static shared_ptr<op::Constant> fold_constant_convert(shared_ptr<op::Constant> c
}
NGRAPH_UNREACHABLE("Unexpected switch case");
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
}
void pass::ConstantFolding::construct_constant_convert()
......@@ -1677,6 +1693,11 @@ static shared_ptr<op::Constant> fold_constant_reverse(shared_ptr<op::Constant> c
{
auto& input_element_type = constant->get_output_element_type(0);
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
#endif
switch (input_element_type.get_type_enum())
{
case element::Type_t::undefined:
......@@ -1710,6 +1731,10 @@ static shared_ptr<op::Constant> fold_constant_reverse(shared_ptr<op::Constant> c
}
NGRAPH_UNREACHABLE("Unexpected switch case");
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
}
void pass::ConstantFolding::construct_constant_reverse()
......
......@@ -385,7 +385,7 @@ void pass::DynElimination::construct_range()
std::shared_ptr<op::Constant> replacement;
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -434,7 +434,7 @@ void pass::DynElimination::construct_range()
NGRAPH_CHECK(false, "Internal nGraph error: unsupported element type: ", et);
break;
}
#if !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8)
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
......
......@@ -49,14 +49,18 @@ namespace ngraph
auto out0_buffer_index = external_function->get_buffer_index(out[0].get_name());
// Kill clang diagnostics bug
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-braces"
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-braces"
#endif
array<size_t, 2> weight_sizes{
args[0].get_size() * args[0].get_element_type().size(),
args[1].get_size() * args[1].get_element_type().size()};
#pragma GCC diagnostic pop
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
shared_ptr<uint8_t> stacked_weights(new uint8_t[weight_sizes[0] + weight_sizes[1]],
std::default_delete<uint8_t[]>());
......@@ -396,14 +400,18 @@ namespace ngraph
auto out2_buffer_index = external_function->get_buffer_index(out[2].get_name());
// Kill clang diagnostics bug
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-braces"
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-braces"
#endif
array<size_t, 2> weight_sizes{
args[0].get_size() * args[0].get_element_type().size(),
args[1].get_size() * args[1].get_element_type().size()};
#pragma GCC diagnostic pop
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
shared_ptr<uint8_t> stacked_weights(new uint8_t[weight_sizes[0] + weight_sizes[1]],
std::default_delete<uint8_t[]>());
shared_ptr<uint8_t> stacked_dweights(new uint8_t[weight_sizes[0] + weight_sizes[1]],
......
......@@ -1348,14 +1348,18 @@ void ngraph::runtime::cpu::pass::CPUFusion::construct_leaky_relu()
auto alpha_vec = alpha_const_op->get_vector<float>();
for (auto val : alpha_vec)
{
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
if (val != alpha_vec[0])
{
NGRAPH_DEBUG << "alpha is not a singular constant";
return false;
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
}
if (alpha_vec[0] < 0)
......
......@@ -160,8 +160,10 @@ bool runtime::gcpu::GCPUExecutable::call(const vector<shared_ptr<runtime::Tensor
// get op type
element::Type type;
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-enum"
#endif
switch (type_id)
{
case OP_TYPEID::Convert:
......@@ -183,7 +185,9 @@ bool runtime::gcpu::GCPUExecutable::call(const vector<shared_ptr<runtime::Tensor
case OP_TYPEID::TopK: type = op->get_output_element_type(1); break;
default: type = op->get_output_element_type(0); break;
}
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
if (m_performance_counters_enabled)
{
......
......@@ -217,7 +217,7 @@ private:
// We want to check that every OP_TYPEID enumeration is included in the list.
// These GCC flags enable compile-time checking so that if an enumeration
// is not in the list an error is generated.
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -1613,7 +1613,7 @@ private:
case OP_TYPEID::Tile:
case OP_TYPEID::DynReplaceSlice:
throw unsupported_op("Unsupported op '" + node.description() + "'");
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
}
......
......@@ -464,7 +464,7 @@ shared_ptr<runtime::Executable>
// We want to check that every OP_TYPEID enumeration is included in the list.
// These GCC flags enable compile-time checking so that if an enumeration
// is not in the list an error is generated.
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -2111,7 +2111,7 @@ shared_ptr<runtime::Executable>
throw unsupported_op("Unsupported op '" + op->description() +
"' in IntelGPU back end.");
}
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
}
......
......@@ -164,8 +164,10 @@ bool runtime::interpreter::INTExecutable::call(const vector<shared_ptr<runtime::
// get op type
element::Type type;
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-enum"
#endif
switch (type_id)
{
case OP_TYPEID::Convert:
......@@ -187,7 +189,9 @@ bool runtime::interpreter::INTExecutable::call(const vector<shared_ptr<runtime::
case OP_TYPEID::TopK: type = op->get_output_element_type(1); break;
default: type = op->get_output_element_type(0); break;
}
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
if (m_performance_counters_enabled)
{
......
......@@ -229,7 +229,7 @@ private:
// We want to check that every OP_TYPEID enumeration is included in the list.
// These GCC flags enable compile-time checking so that if an enumeration
// is not in the list an error is generated.
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -1622,7 +1622,7 @@ private:
case OP_TYPEID::Tile:
case OP_TYPEID::DynReplaceSlice:
throw unsupported_op("Unsupported op '" + node.description() + "'");
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
}
......
......@@ -16,8 +16,10 @@
#pragma once
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
#include <cstddef>
......@@ -42,4 +44,6 @@ namespace ngraph
}
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
......@@ -16,8 +16,10 @@
#pragma once
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
#include <cstddef>
......@@ -42,4 +44,6 @@ namespace ngraph
}
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
......@@ -35,13 +35,17 @@ namespace ngraph
{
// this is intentional to be able to compare floats directly
// without using relative or absolute tolerance
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
if (std::get<0>(a) == std::get<0>(b))
{
return std::get<1>(a) < std::get<1>(b);
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
return a > b;
}
......
......@@ -723,7 +723,7 @@ shared_ptr<Node> JSONDeserializer::deserialize_node(json node_js)
vector<json> control_deps_inputs = get_value<vector<json>>(node_js, "control_deps");
vector<string> node_outputs = get_value<vector<string>>(node_js, "outputs");
OutputVectorHelper args(deserialize_output_vector(node_js["inputs"]));
#if !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8)
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -1927,7 +1927,7 @@ shared_ptr<Node> JSONDeserializer::deserialize_node(json node_js)
throw runtime_error(ss.str());
}
}
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
......
......@@ -75,10 +75,14 @@ size_t bfloat16::size() const
bool bfloat16::operator==(const bfloat16& other) const
{
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
return (static_cast<float>(*this) == static_cast<float>(other));
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
}
bool bfloat16::operator<(const bfloat16& other) const
......
......@@ -97,10 +97,14 @@ size_t float16::size() const
bool float16::operator==(const float16& other) const
{
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
return (static_cast<float>(*this) == static_cast<float>(other));
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
}
bool float16::operator<(const float16& other) const
......
......@@ -80,7 +80,7 @@ void set_denormals_flush_to_zero()
void random_init(shared_ptr<runtime::Tensor> tensor)
{
element::Type et = tensor->get_element_type();
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -104,7 +104,7 @@ void random_init(shared_ptr<runtime::Tensor> tensor)
case element::Type_t::f16:
default: throw runtime_error("unsupported type");
}
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
}
......
......@@ -48,7 +48,7 @@ static void test_allreduce_common(reduction::Type reduce_type)
auto a = backend->create_tensor(element::f32, shape);
auto result = backend->create_tensor(element::f32, shape);
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
......@@ -84,7 +84,7 @@ static void test_allreduce_common(reduction::Type reduce_type)
v[i] = i + 2;
}
}
#if !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8)
#if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment