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
yangql
composable_kernel_onnx
Commits
54b3e73d
You need to sign in or sign up before continuing.
Commit
54b3e73d
authored
Aug 06, 2021
by
Chao Liu
Browse files
rename
parent
f6edda61
Changes
51
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
55 additions
and
56 deletions
+55
-56
external/half/include/half.hpp
external/half/include/half.hpp
+1
-2
host/CMakeLists.txt
host/CMakeLists.txt
+1
-1
host/driver_online/CMakeLists.txt
host/driver_online/CMakeLists.txt
+3
-3
host/driver_online/conv_fwd_driver_online.cpp
host/driver_online/conv_fwd_driver_online.cpp
+2
-2
host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_dlops_nchw_kcyx_nkhw.hpp
...ution_forward_implicit_gemm_v4r4_dlops_nchw_kcyx_nkhw.hpp
+1
-1
host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nchw_kcyx_nkhw.hpp
...tion_forward_implicit_gemm_v4r4_xdlops_nchw_kcyx_nkhw.hpp
+1
-1
host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nhwc_kyxc_nhwk.hpp
...tion_forward_implicit_gemm_v4r4_xdlops_nhwc_kyxc_nhwk.hpp
+1
-1
host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp
...ution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp
+1
-1
host/online_compile/CMakeLists.txt
host/online_compile/CMakeLists.txt
+13
-13
host/online_compile/addkernels/CMakeLists.txt
host/online_compile/addkernels/CMakeLists.txt
+0
-0
host/online_compile/addkernels/addkernels.cpp
host/online_compile/addkernels/addkernels.cpp
+0
-0
host/online_compile/addkernels/include_inliner.cpp
host/online_compile/addkernels/include_inliner.cpp
+0
-0
host/online_compile/addkernels/include_inliner.hpp
host/online_compile/addkernels/include_inliner.hpp
+0
-0
host/online_compile/addkernels/source_file_desc.hpp
host/online_compile/addkernels/source_file_desc.hpp
+0
-0
host/online_compile/hip_utility/binary_cache.cpp
host/online_compile/hip_utility/binary_cache.cpp
+7
-7
host/online_compile/hip_utility/exec_utils.cpp
host/online_compile/hip_utility/exec_utils.cpp
+4
-4
host/online_compile/hip_utility/handlehip.cpp
host/online_compile/hip_utility/handlehip.cpp
+9
-9
host/online_compile/hip_utility/hip_build_utils.cpp
host/online_compile/hip_utility/hip_build_utils.cpp
+5
-5
host/online_compile/hip_utility/hipoc_kernel.cpp
host/online_compile/hip_utility/hipoc_kernel.cpp
+2
-2
host/online_compile/hip_utility/hipoc_program.cpp
host/online_compile/hip_utility/hipoc_program.cpp
+4
-4
No files found.
external/half/include/half.hpp
View file @
54b3e73d
...
@@ -2404,8 +2404,7 @@ unsigned int gamma(unsigned int arg)
...
@@ -2404,8 +2404,7 @@ unsigned int gamma(unsigned int arg)
0.0114684895434781459556 }; double t = arg + 4.65, s = p[0]; for(unsigned int i=0; i<5; ++i)
0.0114684895434781459556 }; double t = arg + 4.65, s = p[0]; for(unsigned int i=0; i<5; ++i)
s += p[i+1] / (arg+i);
s += p[i+1] / (arg+i);
return std::log(s) + (arg-0.5)*std::log(t) - t;
return std::log(s) + (arg-0.5)*std::log(t) - t;
*/
static
const
f31
pi
(
0xC90FDAA2
,
1
),
*/
static
const
f31
pi
(
0xC90FDAA2
,
1
),
lbe
(
0xB8AA3B29
,
0
);
lbe
(
0xB8AA3B29
,
0
);
unsigned
int
abs
=
arg
&
0x7FFF
,
sign
=
arg
&
0x8000
;
unsigned
int
abs
=
arg
&
0x7FFF
,
sign
=
arg
&
0x8000
;
bool
bsign
=
sign
!=
0
;
bool
bsign
=
sign
!=
0
;
f31
z
(
abs
),
x
=
sign
?
(
z
+
f31
(
0x80000000
,
0
))
:
z
,
t
=
x
+
f31
(
0x94CCCCCD
,
2
),
f31
z
(
abs
),
x
=
sign
?
(
z
+
f31
(
0x80000000
,
0
))
:
z
,
t
=
x
+
f31
(
0x94CCCCCD
,
2
),
...
...
host/CMakeLists.txt
View file @
54b3e73d
add_subdirectory
(
host_tensor
)
add_subdirectory
(
host_tensor
)
add_subdirectory
(
online_compil
ation
)
add_subdirectory
(
online_compil
e
)
add_subdirectory
(
driver_offline
)
add_subdirectory
(
driver_offline
)
add_subdirectory
(
driver_online
)
add_subdirectory
(
driver_online
)
host/driver_online/CMakeLists.txt
View file @
54b3e73d
include_directories
(
BEFORE
include_directories
(
BEFORE
include
include
${
PROJECT_BINARY_DIR
}
/host/online_compil
ation
/include
${
PROJECT_BINARY_DIR
}
/host/online_compil
e
/include
${
PROJECT_SOURCE_DIR
}
/host/online_compil
ation
/include
${
PROJECT_SOURCE_DIR
}
/host/online_compil
e
/include
${
PROJECT_SOURCE_DIR
}
/host/host_tensor/include
${
PROJECT_SOURCE_DIR
}
/host/host_tensor/include
${
PROJECT_SOURCE_DIR
}
/composable_kernel/include
${
PROJECT_SOURCE_DIR
}
/composable_kernel/include
${
PROJECT_SOURCE_DIR
}
/composable_kernel/include/utility
${
PROJECT_SOURCE_DIR
}
/composable_kernel/include/utility
...
@@ -18,4 +18,4 @@ set(CONV_FWD_DRIVER_ONLINE_SOURCE conv_fwd_driver_online.cpp)
...
@@ -18,4 +18,4 @@ set(CONV_FWD_DRIVER_ONLINE_SOURCE conv_fwd_driver_online.cpp)
add_executable
(
conv_fwd_driver_online
${
CONV_FWD_DRIVER_ONLINE_SOURCE
}
)
add_executable
(
conv_fwd_driver_online
${
CONV_FWD_DRIVER_ONLINE_SOURCE
}
)
target_link_libraries
(
conv_fwd_driver_online PRIVATE host_tensor
)
target_link_libraries
(
conv_fwd_driver_online PRIVATE host_tensor
)
target_link_libraries
(
conv_fwd_driver_online PRIVATE online_compil
ation
)
target_link_libraries
(
conv_fwd_driver_online PRIVATE online_compil
e
)
host/driver_online/conv_fwd_driver_online.cpp
View file @
54b3e73d
...
@@ -39,11 +39,11 @@ int main(int argc, char* argv[])
...
@@ -39,11 +39,11 @@ int main(int argc, char* argv[])
using
size_t
=
std
::
size_t
;
using
size_t
=
std
::
size_t
;
hipStream_t
stream
;
hipStream_t
stream
;
o
lC
ompile
::
Handle
*
handle
;
o
nline_c
ompile
::
Handle
*
handle
;
MY_HIP_CHECK
(
hipStreamCreate
(
&
stream
));
MY_HIP_CHECK
(
hipStreamCreate
(
&
stream
));
handle
=
new
o
lC
ompile
::
Handle
(
stream
);
handle
=
new
o
nline_c
ompile
::
Handle
(
stream
);
constexpr
auto
I0
=
Number
<
0
>
{};
constexpr
auto
I0
=
Number
<
0
>
{};
constexpr
auto
I1
=
Number
<
1
>
{};
constexpr
auto
I1
=
Number
<
1
>
{};
...
...
host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_dlops_nchw_kcyx_nkhw.hpp
View file @
54b3e73d
...
@@ -216,7 +216,7 @@ template <typename TInWei,
...
@@ -216,7 +216,7 @@ template <typename TInWei,
typename
InLeftPads
,
typename
InLeftPads
,
typename
InRightPads
>
typename
InRightPads
>
void
online_device_dynamic_convolution_forward_implicit_gemm_v4r4_dlops_nchw_kcyx_nkhw
(
void
online_device_dynamic_convolution_forward_implicit_gemm_v4r4_dlops_nchw_kcyx_nkhw
(
o
lC
ompile
::
Handle
*
handle
,
o
nline_c
ompile
::
Handle
*
handle
,
const
InLengths
&
in_n_c_hi_wi_lengths
,
const
InLengths
&
in_n_c_hi_wi_lengths
,
const
WeiLengths
&
wei_k_c_y_x_lengths
,
const
WeiLengths
&
wei_k_c_y_x_lengths
,
const
OutLengths
&
out_n_k_ho_wo_lengths
,
const
OutLengths
&
out_n_k_ho_wo_lengths
,
...
...
host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nchw_kcyx_nkhw.hpp
View file @
54b3e73d
...
@@ -212,7 +212,7 @@ template <typename TInWei,
...
@@ -212,7 +212,7 @@ template <typename TInWei,
typename
InLeftPads
,
typename
InLeftPads
,
typename
InRightPads
>
typename
InRightPads
>
void
online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nchw_kcyx_nkhw
(
void
online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nchw_kcyx_nkhw
(
o
lC
ompile
::
Handle
*
handle
,
o
nline_c
ompile
::
Handle
*
handle
,
const
InLengths
&
in_n_c_hi_wi_lengths
,
const
InLengths
&
in_n_c_hi_wi_lengths
,
const
WeiLengths
&
wei_k_c_y_x_lengths
,
const
WeiLengths
&
wei_k_c_y_x_lengths
,
const
OutLengths
&
out_n_k_ho_wo_lengths
,
const
OutLengths
&
out_n_k_ho_wo_lengths
,
...
...
host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nhwc_kyxc_nhwk.hpp
View file @
54b3e73d
...
@@ -213,7 +213,7 @@ template <typename TInWei,
...
@@ -213,7 +213,7 @@ template <typename TInWei,
typename
InLeftPads
,
typename
InLeftPads
,
typename
InRightPads
>
typename
InRightPads
>
void
online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nhwc_kyxc_nhwk
(
void
online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nhwc_kyxc_nhwk
(
o
lC
ompile
::
Handle
*
handle
,
o
nline_c
ompile
::
Handle
*
handle
,
const
InLengths
&
in_n_hi_wi_c_lengths
,
const
InLengths
&
in_n_hi_wi_c_lengths
,
const
WeiLengths
&
wei_k_y_x_c_lengths
,
const
WeiLengths
&
wei_k_y_x_c_lengths
,
const
OutLengths
&
out_n_ho_wo_k_lengths
,
const
OutLengths
&
out_n_ho_wo_k_lengths
,
...
...
host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp
View file @
54b3e73d
...
@@ -20,7 +20,7 @@ template <typename TInWei,
...
@@ -20,7 +20,7 @@ template <typename TInWei,
typename
InLeftPads
,
typename
InLeftPads
,
typename
InRightPads
>
typename
InRightPads
>
void
online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw
(
void
online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw
(
o
lC
ompile
::
Handle
*
handle
,
o
nline_c
ompile
::
Handle
*
handle
,
const
InLengths
&
in_n_c_hi_wi_lengths
,
const
InLengths
&
in_n_c_hi_wi_lengths
,
const
WeiLengths
&
wei_k_c_y_x_lengths
,
const
WeiLengths
&
wei_k_c_y_x_lengths
,
const
OutLengths
&
out_n_k_ho_wo_lengths
,
const
OutLengths
&
out_n_k_ho_wo_lengths
,
...
...
host/online_compil
ation
/CMakeLists.txt
→
host/online_compil
e
/CMakeLists.txt
View file @
54b3e73d
...
@@ -67,10 +67,10 @@ else()
...
@@ -67,10 +67,10 @@ else()
set
(
OLC_DEBUG 0
)
set
(
OLC_DEBUG 0
)
endif
()
endif
()
configure_file
(
"
${
PROJECT_SOURCE_DIR
}
/host/online_compil
ation
/include/config.h.in"
"
${
PROJECT_BINARY_DIR
}
/host/online_compil
ation
/include/config.h"
)
configure_file
(
"
${
PROJECT_SOURCE_DIR
}
/host/online_compil
e
/include/config.h.in"
"
${
PROJECT_BINARY_DIR
}
/host/online_compil
e
/include/config.h"
)
include_directories
(
BEFORE
include_directories
(
BEFORE
${
PROJECT_BINARY_DIR
}
/host/online_compil
ation
/include
${
PROJECT_BINARY_DIR
}
/host/online_compil
e
/include
)
)
message
(
STATUS
"Hip compiler flags:
${
HIP_COMPILER_FLAGS
}
"
)
message
(
STATUS
"Hip compiler flags:
${
HIP_COMPILER_FLAGS
}
"
)
...
@@ -97,7 +97,7 @@ set(ONLINE_COMPILATION_SOURCE
...
@@ -97,7 +97,7 @@ set(ONLINE_COMPILATION_SOURCE
)
)
include_directories
(
BEFORE
include_directories
(
BEFORE
${
PROJECT_BINARY_DIR
}
/host/online_compil
ation
/include
${
PROJECT_BINARY_DIR
}
/host/online_compil
e
/include
include
include
)
)
...
@@ -152,17 +152,17 @@ add_custom_command(
...
@@ -152,17 +152,17 @@ add_custom_command(
)
)
## the library target
## the library target
add_library
(
online_compil
ation
SHARED
${
ONLINE_COMPILATION_SOURCE
}
)
add_library
(
online_compil
e
SHARED
${
ONLINE_COMPILATION_SOURCE
}
)
target_include_directories
(
online_compil
ation
PRIVATE
${
CMAKE_CURRENT_SOURCE_DIR
}
/online_compil
ation
/include/
)
target_include_directories
(
online_compil
e
PRIVATE
${
CMAKE_CURRENT_SOURCE_DIR
}
/online_compil
e
/include/
)
target_include_directories
(
online_compil
ation
PRIVATE
${
PROJECT_BINARY_DIR
}
)
target_include_directories
(
online_compil
e
PRIVATE
${
PROJECT_BINARY_DIR
}
)
target_include_directories
(
online_compil
ation
PRIVATE
${
PROJECT_SOURCE_DIR
}
/external/half/include/
)
target_include_directories
(
online_compil
e
PRIVATE
${
PROJECT_SOURCE_DIR
}
/external/half/include/
)
target_link_libraries
(
online_compil
ation
PRIVATE hip::device
)
target_link_libraries
(
online_compil
e
PRIVATE hip::device
)
target_link_libraries
(
online_compil
ation
INTERFACE hip::host
)
target_link_libraries
(
online_compil
e
INTERFACE hip::host
)
target_link_libraries
(
online_compil
ation
PRIVATE Boost::filesystem
)
target_link_libraries
(
online_compil
e
PRIVATE Boost::filesystem
)
target_compile_features
(
online_compil
ation
PUBLIC
)
target_compile_features
(
online_compil
e
PUBLIC
)
set_target_properties
(
online_compil
ation
PROPERTIES POSITION_INDEPENDENT_CODE ON
)
set_target_properties
(
online_compil
e
PROPERTIES POSITION_INDEPENDENT_CODE ON
)
install
(
TARGETS online_compil
ation
LIBRARY DESTINATION lib
)
install
(
TARGETS online_compil
e
LIBRARY DESTINATION lib
)
host/online_compil
ation
/addkernels/CMakeLists.txt
→
host/online_compil
e
/addkernels/CMakeLists.txt
View file @
54b3e73d
File moved
host/online_compil
ation
/addkernels/addkernels.cpp
→
host/online_compil
e
/addkernels/addkernels.cpp
View file @
54b3e73d
File moved
host/online_compil
ation
/addkernels/include_inliner.cpp
→
host/online_compil
e
/addkernels/include_inliner.cpp
View file @
54b3e73d
File moved
host/online_compil
ation
/addkernels/include_inliner.hpp
→
host/online_compil
e
/addkernels/include_inliner.hpp
View file @
54b3e73d
File moved
host/online_compil
ation
/addkernels/source_file_desc.hpp
→
host/online_compil
e
/addkernels/source_file_desc.hpp
View file @
54b3e73d
File moved
host/online_compil
ation
/hip_utility/binary_cache.cpp
→
host/online_compil
e
/hip_utility/binary_cache.cpp
View file @
54b3e73d
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
#include <fstream>
#include <fstream>
#include <iostream>
#include <iostream>
namespace
o
lC
ompile
{
namespace
o
nline_c
ompile
{
OLC_DECLARE_ENV_VAR
(
OLC_DISABLE_CACHE
)
OLC_DECLARE_ENV_VAR
(
OLC_DISABLE_CACHE
)
OLC_DECLARE_ENV_VAR
(
HOME
)
OLC_DECLARE_ENV_VAR
(
HOME
)
...
@@ -62,14 +62,14 @@ boost::filesystem::path GetCachePath()
...
@@ -62,14 +62,14 @@ boost::filesystem::path GetCachePath()
return
user_path
;
return
user_path
;
}
}
static
bool
IsCacheDisabled
()
{
return
o
lC
ompile
::
IsEnabled
(
OLC_DISABLE_CACHE
{});
}
static
bool
IsCacheDisabled
()
{
return
o
nline_c
ompile
::
IsEnabled
(
OLC_DISABLE_CACHE
{});
}
boost
::
filesystem
::
path
boost
::
filesystem
::
path
GetCacheFile
(
const
std
::
string
&
device
,
const
std
::
string
&
name
,
const
std
::
string
&
args
)
GetCacheFile
(
const
std
::
string
&
device
,
const
std
::
string
&
name
,
const
std
::
string
&
args
)
{
{
// std::string filename = (is_kernel_str ? o
lC
ompile::md5(name) : name) + ".o";
// std::string filename = (is_kernel_str ? o
nline_c
ompile::md5(name) : name) + ".o";
std
::
string
filename
=
name
+
".o"
;
std
::
string
filename
=
name
+
".o"
;
return
GetCachePath
()
/
o
lC
ompile
::
md5
(
device
+
":"
+
args
)
/
filename
;
return
GetCachePath
()
/
o
nline_c
ompile
::
md5
(
device
+
":"
+
args
)
/
filename
;
}
}
boost
::
filesystem
::
path
LoadBinary
(
const
TargetProperties
&
target
,
boost
::
filesystem
::
path
LoadBinary
(
const
TargetProperties
&
target
,
...
@@ -77,7 +77,7 @@ boost::filesystem::path LoadBinary(const TargetProperties& target,
...
@@ -77,7 +77,7 @@ boost::filesystem::path LoadBinary(const TargetProperties& target,
const
std
::
string
&
name
,
const
std
::
string
&
name
,
const
std
::
string
&
args
)
const
std
::
string
&
args
)
{
{
if
(
o
lC
ompile
::
IsCacheDisabled
())
if
(
o
nline_c
ompile
::
IsCacheDisabled
())
return
{};
return
{};
(
void
)
num_cu
;
(
void
)
num_cu
;
...
@@ -97,7 +97,7 @@ void SaveBinary(const boost::filesystem::path& binary_path,
...
@@ -97,7 +97,7 @@ void SaveBinary(const boost::filesystem::path& binary_path,
const
std
::
string
&
name
,
const
std
::
string
&
name
,
const
std
::
string
&
args
)
const
std
::
string
&
args
)
{
{
if
(
o
lC
ompile
::
IsCacheDisabled
())
if
(
o
nline_c
ompile
::
IsCacheDisabled
())
{
{
boost
::
filesystem
::
remove
(
binary_path
);
boost
::
filesystem
::
remove
(
binary_path
);
}
}
...
@@ -109,4 +109,4 @@ void SaveBinary(const boost::filesystem::path& binary_path,
...
@@ -109,4 +109,4 @@ void SaveBinary(const boost::filesystem::path& binary_path,
}
}
}
}
}
// namespace o
lC
ompile
}
// namespace o
nline_c
ompile
host/online_compil
ation
/hip_utility/exec_utils.cpp
→
host/online_compil
e
/hip_utility/exec_utils.cpp
View file @
54b3e73d
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
#include <sys/wait.h>
#include <sys/wait.h>
#endif // __linux__
#endif // __linux__
namespace
o
lC
ompile
{
namespace
o
nline_c
ompile
{
namespace
exec
{
namespace
exec
{
int
Run
(
const
std
::
string
&
p
,
std
::
istream
*
in
,
std
::
ostream
*
out
)
int
Run
(
const
std
::
string
&
p
,
std
::
istream
*
in
,
std
::
ostream
*
out
)
...
@@ -53,7 +53,7 @@ int Run(const std::string& p, std::istream* in, std::ostream* out)
...
@@ -53,7 +53,7 @@ int Run(const std::string& p, std::istream* in, std::ostream* out)
OLC_MANAGE_PTR
(
FILE
*
,
pclose
)
pipe
{
popen
(
p
.
c_str
(),
file_mode
)};
OLC_MANAGE_PTR
(
FILE
*
,
pclose
)
pipe
{
popen
(
p
.
c_str
(),
file_mode
)};
if
(
!
pipe
)
if
(
!
pipe
)
throw
std
::
runtime_error
(
"o
lC
ompile::exec::Run(): popen("
+
p
+
", "
+
file_mode
+
throw
std
::
runtime_error
(
"o
nline_c
ompile::exec::Run(): popen("
+
p
+
", "
+
file_mode
+
") failed"
);
") failed"
);
if
(
redirect_stdin
||
redirect_stdout
)
if
(
redirect_stdin
||
redirect_stdout
)
...
@@ -74,7 +74,7 @@ int Run(const std::string& p, std::istream* in, std::ostream* out)
...
@@ -74,7 +74,7 @@ int Run(const std::string& p, std::istream* in, std::ostream* out)
buffer
[
in
->
gcount
()]
=
0
;
buffer
[
in
->
gcount
()]
=
0
;
if
(
fputs
(
buffer
.
data
(),
pipe
.
get
())
==
EOF
)
if
(
fputs
(
buffer
.
data
(),
pipe
.
get
())
==
EOF
)
throw
std
::
runtime_error
(
"o
lC
ompile::exec::Run(): fputs() failed"
);
throw
std
::
runtime_error
(
"o
nline_c
ompile::exec::Run(): fputs() failed"
);
}
}
}
}
}
}
...
@@ -90,4 +90,4 @@ int Run(const std::string& p, std::istream* in, std::ostream* out)
...
@@ -90,4 +90,4 @@ int Run(const std::string& p, std::istream* in, std::ostream* out)
}
}
}
// namespace exec
}
// namespace exec
}
// namespace o
lC
ompile
}
// namespace o
nline_c
ompile
host/online_compil
ation
/hip_utility/handlehip.cpp
→
host/online_compil
e
/hip_utility/handlehip.cpp
View file @
54b3e73d
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
OLC_DECLARE_ENV_VAR
(
OLC_DEVICE_CU
)
OLC_DECLARE_ENV_VAR
(
OLC_DEVICE_CU
)
namespace
o
lC
ompile
{
namespace
o
nline_c
ompile
{
std
::
size_t
GetAvailableMemory
()
std
::
size_t
GetAvailableMemory
()
{
{
...
@@ -182,24 +182,24 @@ KernelInvoke Handle::Run(Kernel k) const { return k.Invoke(this->GetStream()); }
...
@@ -182,24 +182,24 @@ KernelInvoke Handle::Run(Kernel k) const { return k.Invoke(this->GetStream()); }
Program
Handle
::
LoadProgram
(
const
std
::
string
&
program_name
,
std
::
string
params
)
const
Program
Handle
::
LoadProgram
(
const
std
::
string
&
program_name
,
std
::
string
params
)
const
{
{
if
((
!
o
lC
ompile
::
EndsWith
(
program_name
,
".mlir-cpp"
))
&&
if
((
!
o
nline_c
ompile
::
EndsWith
(
program_name
,
".mlir-cpp"
))
&&
(
!
o
lC
ompile
::
EndsWith
(
program_name
,
".mlir"
)))
(
!
o
nline_c
ompile
::
EndsWith
(
program_name
,
".mlir"
)))
{
{
params
+=
" -mcpu="
+
this
->
GetTargetProperties
().
Name
();
params
+=
" -mcpu="
+
this
->
GetTargetProperties
().
Name
();
}
}
auto
hsaco
=
o
lC
ompile
::
LoadBinary
(
auto
hsaco
=
o
nline_c
ompile
::
LoadBinary
(
this
->
GetTargetProperties
(),
this
->
GetMaxComputeUnits
(),
program_name
,
params
);
this
->
GetTargetProperties
(),
this
->
GetMaxComputeUnits
(),
program_name
,
params
);
if
(
hsaco
.
empty
())
if
(
hsaco
.
empty
())
{
{
auto
p
=
HIPOCProgram
{
program_name
,
params
,
this
->
GetTargetProperties
()};
auto
p
=
HIPOCProgram
{
program_name
,
params
,
this
->
GetTargetProperties
()};
auto
path
=
o
lC
ompile
::
GetCachePath
()
/
boost
::
filesystem
::
unique_path
();
auto
path
=
o
nline_c
ompile
::
GetCachePath
()
/
boost
::
filesystem
::
unique_path
();
if
(
p
.
IsCodeObjectInMemory
())
if
(
p
.
IsCodeObjectInMemory
())
o
lC
ompile
::
WriteFile
(
p
.
GetCodeObjectBlob
(),
path
);
o
nline_c
ompile
::
WriteFile
(
p
.
GetCodeObjectBlob
(),
path
);
else
else
boost
::
filesystem
::
copy_file
(
p
.
GetCodeObjectPathname
(),
path
);
boost
::
filesystem
::
copy_file
(
p
.
GetCodeObjectPathname
(),
path
);
o
lC
ompile
::
SaveBinary
(
path
,
this
->
GetTargetProperties
(),
program_name
,
params
);
o
nline_c
ompile
::
SaveBinary
(
path
,
this
->
GetTargetProperties
(),
program_name
,
params
);
return
p
;
return
p
;
}
}
...
@@ -245,7 +245,7 @@ std::size_t Handle::GetGlobalMemorySize() const
...
@@ -245,7 +245,7 @@ std::size_t Handle::GetGlobalMemorySize() const
std
::
size_t
Handle
::
GetMaxComputeUnits
()
const
std
::
size_t
Handle
::
GetMaxComputeUnits
()
const
{
{
int
result
;
int
result
;
const
char
*
const
num_cu
=
o
lC
ompile
::
GetStringEnv
(
OLC_DEVICE_CU
{});
const
char
*
const
num_cu
=
o
nline_c
ompile
::
GetStringEnv
(
OLC_DEVICE_CU
{});
if
(
num_cu
!=
nullptr
&&
strlen
(
num_cu
)
>
0
)
if
(
num_cu
!=
nullptr
&&
strlen
(
num_cu
)
>
0
)
{
{
return
boost
::
lexical_cast
<
std
::
size_t
>
(
num_cu
);
return
boost
::
lexical_cast
<
std
::
size_t
>
(
num_cu
);
...
@@ -282,4 +282,4 @@ std::ostream& Handle::Print(std::ostream& os) const
...
@@ -282,4 +282,4 @@ std::ostream& Handle::Print(std::ostream& os) const
return
os
;
return
os
;
}
}
}
// namespace o
lC
ompile
}
// namespace o
nline_c
ompile
host/online_compil
ation
/hip_utility/hip_build_utils.cpp
→
host/online_compil
e
/hip_utility/hip_build_utils.cpp
View file @
54b3e73d
...
@@ -45,7 +45,7 @@ OLC_DECLARE_ENV_VAR(OLC_DEBUG_HIP_DUMP)
...
@@ -45,7 +45,7 @@ OLC_DECLARE_ENV_VAR(OLC_DEBUG_HIP_DUMP)
#define OLC_HIP_COMPILER "/opt/rocm/llvm/bin/clang++"
#define OLC_HIP_COMPILER "/opt/rocm/llvm/bin/clang++"
namespace
o
lC
ompile
{
namespace
o
nline_c
ompile
{
bool
IsHccCompiler
()
bool
IsHccCompiler
()
{
{
...
@@ -155,12 +155,12 @@ static boost::filesystem::path HipBuildImpl(boost::optional<TmpDir>& tmp_dir,
...
@@ -155,12 +155,12 @@ static boost::filesystem::path HipBuildImpl(boost::optional<TmpDir>& tmp_dir,
params
+=
" -mllvm -amdgpu-function-calls=false"
;
params
+=
" -mllvm -amdgpu-function-calls=false"
;
}
}
if
(
o
lC
ompile
::
IsEnabled
(
OLC_DEBUG_HIP_VERBOSE
{}))
if
(
o
nline_c
ompile
::
IsEnabled
(
OLC_DEBUG_HIP_VERBOSE
{}))
{
{
params
+=
" -v"
;
params
+=
" -v"
;
}
}
if
(
o
lC
ompile
::
IsEnabled
(
OLC_DEBUG_HIP_DUMP
{}))
if
(
o
nline_c
ompile
::
IsEnabled
(
OLC_DEBUG_HIP_DUMP
{}))
{
{
if
(
IsHccCompiler
())
if
(
IsHccCompiler
())
{
{
...
@@ -247,7 +247,7 @@ static external_tool_version_t HipCompilerVersionImpl()
...
@@ -247,7 +247,7 @@ static external_tool_version_t HipCompilerVersionImpl()
break
;
break
;
std
::
stringstream
out
;
std
::
stringstream
out
;
if
(
o
lC
ompile
::
exec
::
Run
(
path
+
" --version"
,
nullptr
,
&
out
)
!=
0
)
if
(
o
nline_c
ompile
::
exec
::
Run
(
path
+
" --version"
,
nullptr
,
&
out
)
!=
0
)
break
;
break
;
std
::
string
line
;
std
::
string
line
;
...
@@ -343,4 +343,4 @@ bool operator<=(const external_tool_version_t& lhs, const external_tool_version_
...
@@ -343,4 +343,4 @@ bool operator<=(const external_tool_version_t& lhs, const external_tool_version_
return
!
(
lhs
>
rhs
);
return
!
(
lhs
>
rhs
);
}
}
}
// namespace o
lC
ompile
}
// namespace o
nline_c
ompile
host/online_compil
ation
/hip_utility/hipoc_kernel.cpp
→
host/online_compil
e
/hip_utility/hipoc_kernel.cpp
View file @
54b3e73d
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#include <chrono>
#include <chrono>
#include <thread>
#include <thread>
namespace
o
lC
ompile
{
namespace
o
nline_c
ompile
{
void
HIPOCKernelInvoke
::
run
(
void
*
args
,
std
::
size_t
size
)
const
void
HIPOCKernelInvoke
::
run
(
void
*
args
,
std
::
size_t
size
)
const
{
{
...
@@ -81,4 +81,4 @@ HIPOCKernelInvoke HIPOCKernel::Invoke(hipStream_t stream,
...
@@ -81,4 +81,4 @@ HIPOCKernelInvoke HIPOCKernel::Invoke(hipStream_t stream,
{
{
return
HIPOCKernelInvoke
{
stream
,
fun
,
ldims
,
gdims
,
name
,
callback
};
return
HIPOCKernelInvoke
{
stream
,
fun
,
ldims
,
gdims
,
name
,
callback
};
}
}
}
// namespace o
lC
ompile
}
// namespace o
nline_c
ompile
host/online_compil
ation
/hip_utility/hipoc_program.cpp
→
host/online_compil
e
/hip_utility/hipoc_program.cpp
View file @
54b3e73d
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
#include <unistd.h>
#include <unistd.h>
namespace
o
lC
ompile
{
namespace
o
nline_c
ompile
{
static
hipModulePtr
CreateModule
(
const
boost
::
filesystem
::
path
&
hsaco_file
)
static
hipModulePtr
CreateModule
(
const
boost
::
filesystem
::
path
&
hsaco_file
)
{
{
...
@@ -89,7 +89,7 @@ void HIPOCProgramImpl::BuildCodeObjectInFile(std::string& params,
...
@@ -89,7 +89,7 @@ void HIPOCProgramImpl::BuildCodeObjectInFile(std::string& params,
this
->
dir
.
emplace
(
filename
);
this
->
dir
.
emplace
(
filename
);
hsaco_file
=
dir
->
path
/
(
filename
+
".o"
);
hsaco_file
=
dir
->
path
/
(
filename
+
".o"
);
if
(
o
lC
ompile
::
EndsWith
(
filename
,
".cpp"
))
if
(
o
nline_c
ompile
::
EndsWith
(
filename
,
".cpp"
))
{
{
hsaco_file
=
HipBuild
(
dir
,
filename
,
src
,
params
,
target
);
hsaco_file
=
HipBuild
(
dir
,
filename
,
src
,
params
,
target
);
}
}
...
@@ -104,7 +104,7 @@ void HIPOCProgramImpl::BuildCodeObject(std::string params)
...
@@ -104,7 +104,7 @@ void HIPOCProgramImpl::BuildCodeObject(std::string params)
{
{
std
::
string
filename
=
program
;
std
::
string
filename
=
program
;
if
(
o
lC
ompile
::
EndsWith
(
filename
,
".cpp"
))
if
(
o
nline_c
ompile
::
EndsWith
(
filename
,
".cpp"
))
{
{
params
+=
" -Wno-everything"
;
params
+=
" -Wno-everything"
;
}
}
...
@@ -136,4 +136,4 @@ std::string HIPOCProgram::GetCodeObjectBlob() const
...
@@ -136,4 +136,4 @@ std::string HIPOCProgram::GetCodeObjectBlob() const
bool
HIPOCProgram
::
IsCodeObjectInMemory
()
const
{
return
!
impl
->
binary
.
empty
();
};
bool
HIPOCProgram
::
IsCodeObjectInMemory
()
const
{
return
!
impl
->
binary
.
empty
();
};
}
// namespace o
lC
ompile
}
// namespace o
nline_c
ompile
Prev
1
2
3
Next
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