Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
a99859d9
Commit
a99859d9
authored
Aug 02, 2019
by
Sang Ik Lee
Committed by
Scott Cyphers
Aug 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve pragma usage. (#3355)
parent
2765573c
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
72 additions
and
24 deletions
+72
-24
log.cpp
src/ngraph/log.cpp
+4
-0
constant.cpp
src/ngraph/op/constant.cpp
+8
-4
constant.hpp
src/ngraph/op/constant.hpp
+2
-2
constant_folding.cpp
src/ngraph/pass/constant_folding.cpp
+4
-4
batch_norm.cpp
src/ngraph/runtime/cpu/builder/batch_norm.cpp
+14
-6
cpu_fusion.cpp
src/ngraph/runtime/cpu/pass/cpu_fusion.cpp
+4
-0
gcpu_executable.cpp
src/ngraph/runtime/generic_cpu/gcpu_executable.cpp
+4
-0
gcpu_executable.hpp
src/ngraph/runtime/generic_cpu/gcpu_executable.hpp
+2
-2
intelgpu_backend.cpp
src/ngraph/runtime/intelgpu/intelgpu_backend.cpp
+2
-2
int_executable.cpp
src/ngraph/runtime/interpreter/int_executable.cpp
+4
-0
int_executable.hpp
src/ngraph/runtime/interpreter/int_executable.hpp
+2
-2
equal.hpp
src/ngraph/runtime/reference/equal.hpp
+4
-0
not_equal.hpp
src/ngraph/runtime/reference/not_equal.hpp
+4
-0
topk.hpp
src/ngraph/runtime/reference/topk.hpp
+4
-0
serializer.cpp
src/ngraph/serializer.cpp
+2
-2
bfloat16.cpp
src/ngraph/type/bfloat16.cpp
+4
-0
float16.cpp
src/ngraph/type/float16.cpp
+4
-0
No files found.
src/ngraph/log.cpp
View file @
a99859d9
...
...
@@ -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
);
}
...
...
src/ngraph/op/constant.cpp
View file @
a99859d9
...
...
@@ -52,7 +52,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"
...
...
@@ -79,7 +79,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
;
...
...
@@ -89,7 +89,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"
...
...
@@ -177,7 +177,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
...
...
@@ -285,9 +285,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
:
...
...
@@ -322,7 +324,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
;
}
...
...
src/ngraph/op/constant.hpp
View file @
a99859d9
...
...
@@ -293,7 +293,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"
...
...
@@ -342,7 +342,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
}
...
...
src/ngraph/pass/constant_folding.cpp
View file @
a99859d9
...
...
@@ -795,7 +795,7 @@ 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)
)
#if
defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8
)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
...
...
@@ -835,7 +835,7 @@ shared_ptr<op::Constant> fold_constant_convert_helper0(shared_ptr<op::Constant>
case
element
:
:
Type_t
::
u64
:
return
fold_constant_convert_helper1
<
TI
,
uint64_t
>
(
constant
,
output_element_type
);
}
#if
!(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8)
)
#if
defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8
)
#pragma GCC diagnostic pop
#endif
}
...
...
@@ -850,7 +850,7 @@ static shared_ptr<op::Constant> fold_constant_convert(shared_ptr<op::Constant> c
return
constant
;
}
#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"
...
...
@@ -890,7 +890,7 @@ static shared_ptr<op::Constant> fold_constant_convert(shared_ptr<op::Constant> c
case
element
:
:
Type_t
::
u64
:
return
fold_constant_convert_helper0
<
uint64_t
>
(
constant
,
output_element_type
);
}
#if
!(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8)
)
#if
defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8
)
#pragma GCC diagnostic pop
#endif
}
...
...
src/ngraph/runtime/cpu/builder/batch_norm.cpp
View file @
a99859d9
...
...
@@ -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
]],
...
...
src/ngraph/runtime/cpu/pass/cpu_fusion.cpp
View file @
a99859d9
...
...
@@ -1154,14 +1154,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
)
...
...
src/ngraph/runtime/generic_cpu/gcpu_executable.cpp
View file @
a99859d9
...
...
@@ -141,8 +141,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
:
...
...
@@ -164,7 +166,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
)
{
...
...
src/ngraph/runtime/generic_cpu/gcpu_executable.hpp
View file @
a99859d9
...
...
@@ -194,7 +194,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"
...
...
@@ -1378,7 +1378,7 @@ private:
break
;
}
default
:
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
}
...
...
src/ngraph/runtime/intelgpu/intelgpu_backend.cpp
View file @
a99859d9
...
...
@@ -460,7 +460,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"
...
...
@@ -2098,7 +2098,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
}
...
...
src/ngraph/runtime/interpreter/int_executable.cpp
View file @
a99859d9
...
...
@@ -160,8 +160,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
:
...
...
@@ -183,7 +185,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
)
{
...
...
src/ngraph/runtime/interpreter/int_executable.hpp
View file @
a99859d9
...
...
@@ -211,7 +211,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"
...
...
@@ -1461,7 +1461,7 @@ private:
case
OP_TYPEID
:
:
DynPad
:
case
OP_TYPEID
:
:
Tile
:
default
:
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
}
...
...
src/ngraph/runtime/reference/equal.hpp
View file @
a99859d9
...
...
@@ -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
src/ngraph/runtime/reference/not_equal.hpp
View file @
a99859d9
...
...
@@ -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
src/ngraph/runtime/reference/topk.hpp
View file @
a99859d9
...
...
@@ -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
;
}
...
...
src/ngraph/serializer.cpp
View file @
a99859d9
...
...
@@ -526,7 +526,7 @@ static shared_ptr<ngraph::Function>
{
args
.
push_back
(
node_map
.
at
(
name
));
}
#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"
...
...
@@ -1599,7 +1599,7 @@ static shared_ptr<ngraph::Function>
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
...
...
src/ngraph/type/bfloat16.cpp
View file @
a99859d9
...
...
@@ -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
...
...
src/ngraph/type/float16.cpp
View file @
a99859d9
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment