Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
ad056b1f
Unverified
Commit
ad056b1f
authored
Mar 28, 2022
by
Paul Fultz II
Committed by
GitHub
Mar 28, 2022
Browse files
Use ccache for runtime compilation (#1131)
* Use ccache for runtime compilation
parent
c73c0dae
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
1 deletion
+25
-1
src/compile_src.cpp
src/compile_src.cpp
+8
-1
src/include/migraphx/compile_src.hpp
src/include/migraphx/compile_src.hpp
+1
-0
src/targets/gpu/CMakeLists.txt
src/targets/gpu/CMakeLists.txt
+6
-0
src/targets/gpu/compile_hip.cpp
src/targets/gpu/compile_hip.cpp
+10
-0
No files found.
src/compile_src.cpp
View file @
ad056b1f
...
...
@@ -34,7 +34,14 @@ std::vector<char> src_compiler::compile(const std::vector<src_file>& srcs) const
params
+=
" -o "
+
out
;
td
.
execute
(
compiler
,
params
);
if
(
not
launcher
.
empty
())
{
td
.
execute
(
launcher
,
compiler
+
" "
+
params
);
}
else
{
td
.
execute
(
compiler
,
params
);
}
auto
out_path
=
td
.
path
/
out
;
if
(
not
fs
::
exists
(
out_path
))
...
...
src/include/migraphx/compile_src.hpp
View file @
ad056b1f
...
...
@@ -23,6 +23,7 @@ struct src_compiler
std
::
string
compiler
=
"c++"
;
std
::
string
flags
=
""
;
std
::
string
output
=
""
;
std
::
string
launcher
=
""
;
std
::
function
<
fs
::
path
(
fs
::
path
)
>
process
=
nullptr
;
std
::
vector
<
char
>
compile
(
const
std
::
vector
<
src_file
>&
srcs
)
const
;
};
...
...
src/targets/gpu/CMakeLists.txt
View file @
ad056b1f
...
...
@@ -331,6 +331,12 @@ target_compile_definitions(migraphx_gpu PRIVATE
"-DMIGRAPHX_EXTRACT_KERNEL=
${
MIGRAPHX_EXTRACT_KERNEL
}
"
"-DMIGRAPHX_USE_HIPRTC=0"
)
if
(
DEFINED CMAKE_CXX_COMPILER_LAUNCHER
)
execute_process
(
COMMAND which
${
CMAKE_CXX_COMPILER_LAUNCHER
}
OUTPUT_VARIABLE MIGRAPHX_HIP_COMPILER_LAUNCHER
)
string
(
STRIP
"
${
MIGRAPHX_HIP_COMPILER_LAUNCHER
}
"
MIGRAPHX_HIP_COMPILER_LAUNCHER
)
target_compile_definitions
(
migraphx_gpu PRIVATE
"-DMIGRAPHX_HIP_COMPILER_LAUNCHER=
${
MIGRAPHX_HIP_COMPILER_LAUNCHER
}
"
)
endif
()
endif
()
# Check miopen find mode api
...
...
src/targets/gpu/compile_hip.cpp
View file @
ad056b1f
...
...
@@ -178,6 +178,12 @@ bool is_hip_clang_compiler()
return
result
;
}
bool
has_compiler_launcher
()
{
static
const
auto
result
=
fs
::
exists
(
MIGRAPHX_STRINGIZE
(
MIGRAPHX_HIP_COMPILER_LAUNCHER
));
return
result
;
}
std
::
vector
<
std
::
vector
<
char
>>
compile_hip_src
(
const
std
::
vector
<
src_file
>&
srcs
,
std
::
string
params
,
const
std
::
string
&
arch
)
{
...
...
@@ -210,6 +216,10 @@ compile_hip_src(const std::vector<src_file>& srcs, std::string params, const std
src_compiler
compiler
;
compiler
.
flags
=
params
;
compiler
.
compiler
=
MIGRAPHX_STRINGIZE
(
MIGRAPHX_HIP_COMPILER
);
#ifdef MIGRAPHX_HIP_COMPILER_LAUNCHER
if
(
has_compiler_launcher
())
compiler
.
launcher
=
MIGRAPHX_STRINGIZE
(
MIGRAPHX_HIP_COMPILER_LAUNCHER
);
#endif
if
(
is_hcc_compiler
())
compiler
.
process
=
[
&
](
const
fs
::
path
&
obj_path
)
->
fs
::
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