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
3562da83
Commit
3562da83
authored
Apr 18, 2018
by
Louis Feng
Committed by
Robert Kimball
Apr 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added clang compiler vector report and handle errors from argument parsing. (#876)
parent
9d57eee5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
compiler.cpp
src/ngraph/codegen/compiler.cpp
+18
-6
compiler.hpp
src/ngraph/codegen/compiler.hpp
+1
-0
No files found.
src/ngraph/codegen/compiler.cpp
View file @
3562da83
...
...
@@ -125,6 +125,7 @@ codegen::StaticCompiler::StaticCompiler()
:
m_precompiled_header_valid
(
false
)
,
m_debuginfo_enabled
((
std
::
getenv
(
"NGRAPH_COMPILER_DEBUGINFO_ENABLE"
)
!=
nullptr
))
,
m_enable_diag_output
((
std
::
getenv
(
"NGRAPH_COMPILER_DIAG_ENABLE"
)
!=
nullptr
))
,
m_enable_pass_report
((
std
::
getenv
(
"NGRAPH_COMPILER_REPORT_ENABLE"
)
!=
nullptr
))
,
m_source_name
(
"code.cpp"
)
{
initialize
();
...
...
@@ -147,7 +148,11 @@ void codegen::StaticCompiler::initialize()
// This is for both Eigen strong and weak inlines
args
.
push_back
(
"-mllvm"
);
args
.
push_back
(
"-inline-threshold=1000000"
);
if
(
m_enable_pass_report
)
{
args
.
push_back
(
"-Rpass-analysis=loop-vectorize"
);
args
.
push_back
(
"-Rpass=loop-vectorize"
);
}
// Prevent Eigen from using any LGPL3 code
args
.
push_back
(
"-DEIGEN_MPL2_ONLY"
);
...
...
@@ -157,10 +162,17 @@ void codegen::StaticCompiler::initialize()
diag_options
->
ShowCarets
=
false
;
diag_options
->
ShowFixits
=
false
;
IntrusiveRefCntPtr
<
DiagnosticIDs
>
diag_id
(
new
DiagnosticIDs
());
DiagnosticsEngine
diag_engine
(
diag_id
,
&*
diag_options
);
// create a diagnosetic buffer for errors caused by argument parsing
TextDiagnosticBuffer
*
diag_buffer
=
new
TextDiagnosticBuffer
();
DiagnosticsEngine
diag_engine
(
diag_id
,
&*
diag_options
,
diag_buffer
);
// Create and initialize CompilerInstance
m_compiler
=
std
::
unique_ptr
<
CompilerInstance
>
(
new
CompilerInstance
());
// Initialize CompilerInvocation
CompilerInvocation
::
CreateFromArgs
(
m_compiler
->
getInvocation
(),
&
args
[
0
],
&
args
[
0
]
+
args
.
size
(),
diag_engine
);
DiagnosticConsumer
*
diag_consumer
;
if
(
m_enable_diag_output
)
{
...
...
@@ -170,12 +182,9 @@ void codegen::StaticCompiler::initialize()
{
diag_consumer
=
new
IgnoringDiagConsumer
();
}
// Create diagnostics after compiler invocation is created, otherwise report outputs do not get generated.
m_compiler
->
createDiagnostics
(
diag_consumer
);
// Initialize CompilerInvocation
CompilerInvocation
::
CreateFromArgs
(
m_compiler
->
getInvocation
(),
&
args
[
0
],
&
args
[
0
]
+
args
.
size
(),
diag_engine
);
configure_search_path
();
// Language options
...
...
@@ -213,6 +222,9 @@ void codegen::StaticCompiler::initialize()
// Enable various target features
auto
&
TO
=
m_compiler
->
getInvocation
().
getTargetOpts
();
TO
.
CPU
=
sys
::
getHostCPUName
();
// Flush out any errors from clang/llvm arg parsing.
diag_buffer
->
FlushDiagnostics
(
m_compiler
->
getDiagnostics
());
}
codegen
::
StaticCompiler
::~
StaticCompiler
()
...
...
src/ngraph/codegen/compiler.hpp
View file @
3562da83
...
...
@@ -88,6 +88,7 @@ private:
bool
m_precompiled_header_valid
;
bool
m_debuginfo_enabled
;
bool
m_enable_diag_output
;
bool
m_enable_pass_report
;
std
::
string
m_source_name
;
std
::
vector
<
std
::
string
>
m_extra_search_path_list
;
std
::
string
m_pch_path
;
...
...
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