From 54b3e73d17b8594cb779cea2f0a53d55e832044d Mon Sep 17 00:00:00 2001 From: Chao Liu Date: Fri, 6 Aug 2021 18:07:15 +0000 Subject: [PATCH 1/4] rename --- external/half/include/half.hpp | 3 +-- host/CMakeLists.txt | 2 +- host/driver_online/CMakeLists.txt | 6 ++--- host/driver_online/conv_fwd_driver_online.cpp | 4 +-- ...mplicit_gemm_v4r4_dlops_nchw_kcyx_nkhw.hpp | 2 +- ...plicit_gemm_v4r4_xdlops_nchw_kcyx_nkhw.hpp | 2 +- ...plicit_gemm_v4r4_xdlops_nhwc_kyxc_nhwk.hpp | 2 +- ...mplicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp | 2 +- .../CMakeLists.txt | 26 +++++++++---------- .../addkernels/CMakeLists.txt | 0 .../addkernels/addkernels.cpp | 0 .../addkernels/include_inliner.cpp | 0 .../addkernels/include_inliner.hpp | 0 .../addkernels/source_file_desc.hpp | 0 .../hip_utility/binary_cache.cpp | 14 +++++----- .../hip_utility/exec_utils.cpp | 8 +++--- .../hip_utility/handlehip.cpp | 18 ++++++------- .../hip_utility/hip_build_utils.cpp | 10 +++---- .../hip_utility/hipoc_kernel.cpp | 4 +-- .../hip_utility/hipoc_program.cpp | 8 +++--- .../hip_utility/kernel_build_params.cpp | 4 +-- .../hip_utility/kernel_cache.cpp | 4 +-- .../hip_utility/logger.cpp | 6 ++--- .../hip_utility/md5.cpp | 4 +-- .../hip_utility/target_properties.cpp | 6 ++--- .../hip_utility/tmp_dir.cpp | 8 +++--- .../include/binary_cache.hpp | 4 +-- .../include/config.h.in | 0 .../include/env.hpp | 10 +++---- .../include/exec_utils.hpp | 4 +-- .../include/handle.hpp | 4 +-- .../include/hipCheck.hpp | 0 .../include/hip_build_utils.hpp | 6 ++--- .../include/hipoc_kernel.hpp | 4 +-- .../include/hipoc_program.hpp | 4 +-- .../include/hipoc_program_impl.hpp | 4 +-- .../include/kernel.hpp | 4 +-- .../include/kernel_build_params.hpp | 4 +-- .../include/kernel_cache.hpp | 4 +-- .../include/logger.hpp | 4 +-- .../include/manage_ptr.hpp | 6 ++--- .../include/md5.hpp | 4 +-- .../include/op_kernel_args.hpp | 0 .../include/simple_hash.hpp | 4 +-- .../include/stringutils.hpp | 4 +-- .../include/target_properties.hpp | 4 +-- .../include/tmp_dir.hpp | 4 +-- .../include/write_file.hpp | 4 +-- .../kernel.cpp.in | 4 +-- .../kernel_includes.cpp.in | 4 +-- .../kernels_batch.cpp.in | 0 51 files changed, 118 insertions(+), 119 deletions(-) rename host/{online_compilation => online_compile}/CMakeLists.txt (83%) rename host/{online_compilation => online_compile}/addkernels/CMakeLists.txt (100%) rename host/{online_compilation => online_compile}/addkernels/addkernels.cpp (100%) rename host/{online_compilation => online_compile}/addkernels/include_inliner.cpp (100%) rename host/{online_compilation => online_compile}/addkernels/include_inliner.hpp (100%) rename host/{online_compilation => online_compile}/addkernels/source_file_desc.hpp (100%) rename host/{online_compilation => online_compile}/hip_utility/binary_cache.cpp (89%) rename host/{online_compilation => online_compile}/hip_utility/exec_utils.cpp (91%) rename host/{online_compilation => online_compile}/hip_utility/handlehip.cpp (93%) rename host/{online_compilation => online_compile}/hip_utility/hip_build_utils.cpp (97%) rename host/{online_compilation => online_compile}/hip_utility/hipoc_kernel.cpp (98%) rename host/{online_compilation => online_compile}/hip_utility/hipoc_program.cpp (96%) rename host/{online_compilation => online_compile}/hip_utility/kernel_build_params.cpp (97%) rename host/{online_compilation => online_compile}/hip_utility/kernel_cache.cpp (98%) rename host/{online_compilation => online_compile}/hip_utility/logger.cpp (88%) rename host/{online_compilation => online_compile}/hip_utility/md5.cpp (99%) rename host/{online_compilation => online_compile}/hip_utility/target_properties.cpp (96%) rename host/{online_compilation => online_compile}/hip_utility/tmp_dir.cpp (90%) rename host/{online_compilation => online_compile}/include/binary_cache.hpp (97%) rename host/{online_compilation => online_compile}/include/config.h.in (100%) rename host/{online_compilation => online_compile}/include/env.hpp (92%) rename host/{online_compilation => online_compile}/include/exec_utils.hpp (96%) rename host/{online_compilation => online_compile}/include/handle.hpp (98%) rename host/{online_compilation => online_compile}/include/hipCheck.hpp (100%) rename host/{online_compilation => online_compile}/include/hip_build_utils.hpp (96%) rename host/{online_compilation => online_compile}/include/hipoc_kernel.hpp (99%) rename host/{online_compilation => online_compile}/include/hipoc_program.hpp (97%) rename host/{online_compilation => online_compile}/include/hipoc_program_impl.hpp (97%) rename host/{online_compilation => online_compile}/include/kernel.hpp (96%) rename host/{online_compilation => online_compile}/include/kernel_build_params.hpp (98%) rename host/{online_compilation => online_compile}/include/kernel_cache.hpp (98%) rename host/{online_compilation => online_compile}/include/logger.hpp (84%) rename host/{online_compilation => online_compile}/include/manage_ptr.hpp (93%) rename host/{online_compilation => online_compile}/include/md5.hpp (66%) rename host/{online_compilation => online_compile}/include/op_kernel_args.hpp (100%) rename host/{online_compilation => online_compile}/include/simple_hash.hpp (96%) rename host/{online_compilation => online_compile}/include/stringutils.hpp (98%) rename host/{online_compilation => online_compile}/include/target_properties.hpp (97%) rename host/{online_compilation => online_compile}/include/tmp_dir.hpp (87%) rename host/{online_compilation => online_compile}/include/write_file.hpp (94%) rename host/{online_compilation => online_compile}/kernel.cpp.in (97%) rename host/{online_compilation => online_compile}/kernel_includes.cpp.in (97%) rename host/{online_compilation => online_compile}/kernels_batch.cpp.in (100%) diff --git a/external/half/include/half.hpp b/external/half/include/half.hpp index b698aac39f..25f543881f 100644 --- a/external/half/include/half.hpp +++ b/external/half/include/half.hpp @@ -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) s += p[i+1] / (arg+i); return std::log(s) + (arg-0.5)*std::log(t) - t; -*/ static const f31 pi(0xC90FDAA2, 1), - lbe(0xB8AA3B29, 0); +*/ static const f31 pi(0xC90FDAA2, 1), lbe(0xB8AA3B29, 0); unsigned int abs = arg & 0x7FFF, sign = arg & 0x8000; bool bsign = sign != 0; f31 z(abs), x = sign ? (z + f31(0x80000000, 0)) : z, t = x + f31(0x94CCCCCD, 2), diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index c9779398a6..26739efe34 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -1,4 +1,4 @@ add_subdirectory(host_tensor) -add_subdirectory(online_compilation) +add_subdirectory(online_compile) add_subdirectory(driver_offline) add_subdirectory(driver_online) diff --git a/host/driver_online/CMakeLists.txt b/host/driver_online/CMakeLists.txt index 2ae05e0ba5..152eb270e3 100644 --- a/host/driver_online/CMakeLists.txt +++ b/host/driver_online/CMakeLists.txt @@ -1,7 +1,7 @@ include_directories(BEFORE include - ${PROJECT_BINARY_DIR}/host/online_compilation/include - ${PROJECT_SOURCE_DIR}/host/online_compilation/include + ${PROJECT_BINARY_DIR}/host/online_compile/include + ${PROJECT_SOURCE_DIR}/host/online_compile/include ${PROJECT_SOURCE_DIR}/host/host_tensor/include ${PROJECT_SOURCE_DIR}/composable_kernel/include ${PROJECT_SOURCE_DIR}/composable_kernel/include/utility @@ -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}) target_link_libraries(conv_fwd_driver_online PRIVATE host_tensor) -target_link_libraries(conv_fwd_driver_online PRIVATE online_compilation) +target_link_libraries(conv_fwd_driver_online PRIVATE online_compile) diff --git a/host/driver_online/conv_fwd_driver_online.cpp b/host/driver_online/conv_fwd_driver_online.cpp index c91f76fa24..29609d5474 100644 --- a/host/driver_online/conv_fwd_driver_online.cpp +++ b/host/driver_online/conv_fwd_driver_online.cpp @@ -39,11 +39,11 @@ int main(int argc, char* argv[]) using size_t = std::size_t; hipStream_t stream; - olCompile::Handle* handle; + online_compile::Handle* handle; MY_HIP_CHECK(hipStreamCreate(&stream)); - handle = new olCompile::Handle(stream); + handle = new online_compile::Handle(stream); constexpr auto I0 = Number<0>{}; constexpr auto I1 = Number<1>{}; diff --git a/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_dlops_nchw_kcyx_nkhw.hpp b/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_dlops_nchw_kcyx_nkhw.hpp index 628bb6d96d..06412fba0b 100644 --- a/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_dlops_nchw_kcyx_nkhw.hpp +++ b/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_dlops_nchw_kcyx_nkhw.hpp @@ -216,7 +216,7 @@ template void online_device_dynamic_convolution_forward_implicit_gemm_v4r4_dlops_nchw_kcyx_nkhw( - olCompile::Handle* handle, + online_compile::Handle* handle, const InLengths& in_n_c_hi_wi_lengths, const WeiLengths& wei_k_c_y_x_lengths, const OutLengths& out_n_k_ho_wo_lengths, diff --git a/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nchw_kcyx_nkhw.hpp b/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nchw_kcyx_nkhw.hpp index 1e213b92e1..61ce41fe84 100644 --- a/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nchw_kcyx_nkhw.hpp +++ b/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nchw_kcyx_nkhw.hpp @@ -212,7 +212,7 @@ template void online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nchw_kcyx_nkhw( - olCompile::Handle* handle, + online_compile::Handle* handle, const InLengths& in_n_c_hi_wi_lengths, const WeiLengths& wei_k_c_y_x_lengths, const OutLengths& out_n_k_ho_wo_lengths, diff --git a/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nhwc_kyxc_nhwk.hpp b/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nhwc_kyxc_nhwk.hpp index 8eed1a9934..57724c7612 100644 --- a/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nhwc_kyxc_nhwk.hpp +++ b/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nhwc_kyxc_nhwk.hpp @@ -213,7 +213,7 @@ template void online_device_dynamic_convolution_forward_implicit_gemm_v4r4_xdlops_nhwc_kyxc_nhwk( - olCompile::Handle* handle, + online_compile::Handle* handle, const InLengths& in_n_hi_wi_c_lengths, const WeiLengths& wei_k_y_x_c_lengths, const OutLengths& out_n_ho_wo_k_lengths, diff --git a/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp b/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp index 260c94ee0e..36c874c97b 100644 --- a/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp +++ b/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp @@ -20,7 +20,7 @@ template void online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw( - olCompile::Handle* handle, + online_compile::Handle* handle, const InLengths& in_n_c_hi_wi_lengths, const WeiLengths& wei_k_c_y_x_lengths, const OutLengths& out_n_k_ho_wo_lengths, diff --git a/host/online_compilation/CMakeLists.txt b/host/online_compile/CMakeLists.txt similarity index 83% rename from host/online_compilation/CMakeLists.txt rename to host/online_compile/CMakeLists.txt index 02f6795308..1b66703fcd 100644 --- a/host/online_compilation/CMakeLists.txt +++ b/host/online_compile/CMakeLists.txt @@ -67,10 +67,10 @@ else() set(OLC_DEBUG 0) endif() -configure_file("${PROJECT_SOURCE_DIR}/host/online_compilation/include/config.h.in" "${PROJECT_BINARY_DIR}/host/online_compilation/include/config.h") +configure_file("${PROJECT_SOURCE_DIR}/host/online_compile/include/config.h.in" "${PROJECT_BINARY_DIR}/host/online_compile/include/config.h") include_directories(BEFORE - ${PROJECT_BINARY_DIR}/host/online_compilation/include + ${PROJECT_BINARY_DIR}/host/online_compile/include ) message(STATUS "Hip compiler flags: ${HIP_COMPILER_FLAGS}") @@ -97,7 +97,7 @@ set(ONLINE_COMPILATION_SOURCE ) include_directories(BEFORE - ${PROJECT_BINARY_DIR}/host/online_compilation/include + ${PROJECT_BINARY_DIR}/host/online_compile/include include ) @@ -152,17 +152,17 @@ add_custom_command( ) ## the library target -add_library(online_compilation SHARED ${ONLINE_COMPILATION_SOURCE}) +add_library(online_compile SHARED ${ONLINE_COMPILATION_SOURCE}) -target_include_directories(online_compilation PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/online_compilation/include/) -target_include_directories(online_compilation PRIVATE ${PROJECT_BINARY_DIR}) -target_include_directories(online_compilation PRIVATE ${PROJECT_SOURCE_DIR}/external/half/include/) +target_include_directories(online_compile PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/online_compile/include/) +target_include_directories(online_compile PRIVATE ${PROJECT_BINARY_DIR}) +target_include_directories(online_compile PRIVATE ${PROJECT_SOURCE_DIR}/external/half/include/) -target_link_libraries(online_compilation PRIVATE hip::device) -target_link_libraries(online_compilation INTERFACE hip::host) -target_link_libraries(online_compilation PRIVATE Boost::filesystem) +target_link_libraries(online_compile PRIVATE hip::device) +target_link_libraries(online_compile INTERFACE hip::host) +target_link_libraries(online_compile PRIVATE Boost::filesystem) -target_compile_features(online_compilation PUBLIC) -set_target_properties(online_compilation PROPERTIES POSITION_INDEPENDENT_CODE ON) +target_compile_features(online_compile PUBLIC) +set_target_properties(online_compile PROPERTIES POSITION_INDEPENDENT_CODE ON) -install(TARGETS online_compilation LIBRARY DESTINATION lib) +install(TARGETS online_compile LIBRARY DESTINATION lib) diff --git a/host/online_compilation/addkernels/CMakeLists.txt b/host/online_compile/addkernels/CMakeLists.txt similarity index 100% rename from host/online_compilation/addkernels/CMakeLists.txt rename to host/online_compile/addkernels/CMakeLists.txt diff --git a/host/online_compilation/addkernels/addkernels.cpp b/host/online_compile/addkernels/addkernels.cpp similarity index 100% rename from host/online_compilation/addkernels/addkernels.cpp rename to host/online_compile/addkernels/addkernels.cpp diff --git a/host/online_compilation/addkernels/include_inliner.cpp b/host/online_compile/addkernels/include_inliner.cpp similarity index 100% rename from host/online_compilation/addkernels/include_inliner.cpp rename to host/online_compile/addkernels/include_inliner.cpp diff --git a/host/online_compilation/addkernels/include_inliner.hpp b/host/online_compile/addkernels/include_inliner.hpp similarity index 100% rename from host/online_compilation/addkernels/include_inliner.hpp rename to host/online_compile/addkernels/include_inliner.hpp diff --git a/host/online_compilation/addkernels/source_file_desc.hpp b/host/online_compile/addkernels/source_file_desc.hpp similarity index 100% rename from host/online_compilation/addkernels/source_file_desc.hpp rename to host/online_compile/addkernels/source_file_desc.hpp diff --git a/host/online_compilation/hip_utility/binary_cache.cpp b/host/online_compile/hip_utility/binary_cache.cpp similarity index 89% rename from host/online_compilation/hip_utility/binary_cache.cpp rename to host/online_compile/hip_utility/binary_cache.cpp index f2f47a1a31..b899d1e296 100644 --- a/host/online_compilation/hip_utility/binary_cache.cpp +++ b/host/online_compile/hip_utility/binary_cache.cpp @@ -35,7 +35,7 @@ #include #include -namespace olCompile { +namespace online_compile { OLC_DECLARE_ENV_VAR(OLC_DISABLE_CACHE) OLC_DECLARE_ENV_VAR(HOME) @@ -62,14 +62,14 @@ boost::filesystem::path GetCachePath() return user_path; } -static bool IsCacheDisabled() { return olCompile::IsEnabled(OLC_DISABLE_CACHE{}); } +static bool IsCacheDisabled() { return online_compile::IsEnabled(OLC_DISABLE_CACHE{}); } boost::filesystem::path GetCacheFile(const std::string& device, const std::string& name, const std::string& args) { - // std::string filename = (is_kernel_str ? olCompile::md5(name) : name) + ".o"; + // std::string filename = (is_kernel_str ? online_compile::md5(name) : name) + ".o"; std::string filename = name + ".o"; - return GetCachePath() / olCompile::md5(device + ":" + args) / filename; + return GetCachePath() / online_compile::md5(device + ":" + args) / filename; } 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& args) { - if(olCompile::IsCacheDisabled()) + if(online_compile::IsCacheDisabled()) return {}; (void)num_cu; @@ -97,7 +97,7 @@ void SaveBinary(const boost::filesystem::path& binary_path, const std::string& name, const std::string& args) { - if(olCompile::IsCacheDisabled()) + if(online_compile::IsCacheDisabled()) { boost::filesystem::remove(binary_path); } @@ -109,4 +109,4 @@ void SaveBinary(const boost::filesystem::path& binary_path, } } -} // namespace olCompile +} // namespace online_compile diff --git a/host/online_compilation/hip_utility/exec_utils.cpp b/host/online_compile/hip_utility/exec_utils.cpp similarity index 91% rename from host/online_compilation/hip_utility/exec_utils.cpp rename to host/online_compile/hip_utility/exec_utils.cpp index 60168c1a54..ec305783f1 100644 --- a/host/online_compilation/hip_utility/exec_utils.cpp +++ b/host/online_compile/hip_utility/exec_utils.cpp @@ -38,7 +38,7 @@ #include #endif // __linux__ -namespace olCompile { +namespace online_compile { namespace exec { 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)}; if(!pipe) - throw std::runtime_error("olCompile::exec::Run(): popen(" + p + ", " + file_mode + + throw std::runtime_error("online_compile::exec::Run(): popen(" + p + ", " + file_mode + ") failed"); if(redirect_stdin || redirect_stdout) @@ -74,7 +74,7 @@ int Run(const std::string& p, std::istream* in, std::ostream* out) buffer[in->gcount()] = 0; if(fputs(buffer.data(), pipe.get()) == EOF) - throw std::runtime_error("olCompile::exec::Run(): fputs() failed"); + throw std::runtime_error("online_compile::exec::Run(): fputs() failed"); } } } @@ -90,4 +90,4 @@ int Run(const std::string& p, std::istream* in, std::ostream* out) } } // namespace exec -} // namespace olCompile +} // namespace online_compile diff --git a/host/online_compilation/hip_utility/handlehip.cpp b/host/online_compile/hip_utility/handlehip.cpp similarity index 93% rename from host/online_compilation/hip_utility/handlehip.cpp rename to host/online_compile/hip_utility/handlehip.cpp index f403b040f4..843957b4ad 100644 --- a/host/online_compilation/hip_utility/handlehip.cpp +++ b/host/online_compile/hip_utility/handlehip.cpp @@ -50,7 +50,7 @@ OLC_DECLARE_ENV_VAR(OLC_DEVICE_CU) -namespace olCompile { +namespace online_compile { std::size_t GetAvailableMemory() { @@ -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 { - if((!olCompile::EndsWith(program_name, ".mlir-cpp")) && - (!olCompile::EndsWith(program_name, ".mlir"))) + if((!online_compile::EndsWith(program_name, ".mlir-cpp")) && + (!online_compile::EndsWith(program_name, ".mlir"))) { params += " -mcpu=" + this->GetTargetProperties().Name(); } - auto hsaco = olCompile::LoadBinary( + auto hsaco = online_compile::LoadBinary( this->GetTargetProperties(), this->GetMaxComputeUnits(), program_name, params); if(hsaco.empty()) { auto p = HIPOCProgram{program_name, params, this->GetTargetProperties()}; - auto path = olCompile::GetCachePath() / boost::filesystem::unique_path(); + auto path = online_compile::GetCachePath() / boost::filesystem::unique_path(); if(p.IsCodeObjectInMemory()) - olCompile::WriteFile(p.GetCodeObjectBlob(), path); + online_compile::WriteFile(p.GetCodeObjectBlob(), path); else boost::filesystem::copy_file(p.GetCodeObjectPathname(), path); - olCompile::SaveBinary(path, this->GetTargetProperties(), program_name, params); + online_compile::SaveBinary(path, this->GetTargetProperties(), program_name, params); return p; } @@ -245,7 +245,7 @@ std::size_t Handle::GetGlobalMemorySize() const std::size_t Handle::GetMaxComputeUnits() const { int result; - const char* const num_cu = olCompile::GetStringEnv(OLC_DEVICE_CU{}); + const char* const num_cu = online_compile::GetStringEnv(OLC_DEVICE_CU{}); if(num_cu != nullptr && strlen(num_cu) > 0) { return boost::lexical_cast(num_cu); @@ -282,4 +282,4 @@ std::ostream& Handle::Print(std::ostream& os) const return os; } -} // namespace olCompile +} // namespace online_compile diff --git a/host/online_compilation/hip_utility/hip_build_utils.cpp b/host/online_compile/hip_utility/hip_build_utils.cpp similarity index 97% rename from host/online_compilation/hip_utility/hip_build_utils.cpp rename to host/online_compile/hip_utility/hip_build_utils.cpp index e73c345937..99b786e606 100644 --- a/host/online_compilation/hip_utility/hip_build_utils.cpp +++ b/host/online_compile/hip_utility/hip_build_utils.cpp @@ -45,7 +45,7 @@ OLC_DECLARE_ENV_VAR(OLC_DEBUG_HIP_DUMP) #define OLC_HIP_COMPILER "/opt/rocm/llvm/bin/clang++" -namespace olCompile { +namespace online_compile { bool IsHccCompiler() { @@ -155,12 +155,12 @@ static boost::filesystem::path HipBuildImpl(boost::optional& tmp_dir, params += " -mllvm -amdgpu-function-calls=false"; } - if(olCompile::IsEnabled(OLC_DEBUG_HIP_VERBOSE{})) + if(online_compile::IsEnabled(OLC_DEBUG_HIP_VERBOSE{})) { params += " -v"; } - if(olCompile::IsEnabled(OLC_DEBUG_HIP_DUMP{})) + if(online_compile::IsEnabled(OLC_DEBUG_HIP_DUMP{})) { if(IsHccCompiler()) { @@ -247,7 +247,7 @@ static external_tool_version_t HipCompilerVersionImpl() break; std::stringstream out; - if(olCompile::exec::Run(path + " --version", nullptr, &out) != 0) + if(online_compile::exec::Run(path + " --version", nullptr, &out) != 0) break; std::string line; @@ -343,4 +343,4 @@ bool operator<=(const external_tool_version_t& lhs, const external_tool_version_ return !(lhs > rhs); } -} // namespace olCompile +} // namespace online_compile diff --git a/host/online_compilation/hip_utility/hipoc_kernel.cpp b/host/online_compile/hip_utility/hipoc_kernel.cpp similarity index 98% rename from host/online_compilation/hip_utility/hipoc_kernel.cpp rename to host/online_compile/hip_utility/hipoc_kernel.cpp index 41fcd92c94..a07d736ac1 100644 --- a/host/online_compilation/hip_utility/hipoc_kernel.cpp +++ b/host/online_compile/hip_utility/hipoc_kernel.cpp @@ -34,7 +34,7 @@ #include #include -namespace olCompile { +namespace online_compile { void HIPOCKernelInvoke::run(void* args, std::size_t size) const { @@ -81,4 +81,4 @@ HIPOCKernelInvoke HIPOCKernel::Invoke(hipStream_t stream, { return HIPOCKernelInvoke{stream, fun, ldims, gdims, name, callback}; } -} // namespace olCompile +} // namespace online_compile diff --git a/host/online_compilation/hip_utility/hipoc_program.cpp b/host/online_compile/hip_utility/hipoc_program.cpp similarity index 96% rename from host/online_compilation/hip_utility/hipoc_program.cpp rename to host/online_compile/hip_utility/hipoc_program.cpp index d2ea1fcb0c..81e03b72ab 100644 --- a/host/online_compilation/hip_utility/hipoc_program.cpp +++ b/host/online_compile/hip_utility/hipoc_program.cpp @@ -39,7 +39,7 @@ #include -namespace olCompile { +namespace online_compile { static hipModulePtr CreateModule(const boost::filesystem::path& hsaco_file) { @@ -89,7 +89,7 @@ void HIPOCProgramImpl::BuildCodeObjectInFile(std::string& params, this->dir.emplace(filename); hsaco_file = dir->path / (filename + ".o"); - if(olCompile::EndsWith(filename, ".cpp")) + if(online_compile::EndsWith(filename, ".cpp")) { hsaco_file = HipBuild(dir, filename, src, params, target); } @@ -104,7 +104,7 @@ void HIPOCProgramImpl::BuildCodeObject(std::string params) { std::string filename = program; - if(olCompile::EndsWith(filename, ".cpp")) + if(online_compile::EndsWith(filename, ".cpp")) { params += " -Wno-everything"; } @@ -136,4 +136,4 @@ std::string HIPOCProgram::GetCodeObjectBlob() const bool HIPOCProgram::IsCodeObjectInMemory() const { return !impl->binary.empty(); }; -} // namespace olCompile +} // namespace online_compile diff --git a/host/online_compilation/hip_utility/kernel_build_params.cpp b/host/online_compile/hip_utility/kernel_build_params.cpp similarity index 97% rename from host/online_compilation/hip_utility/kernel_build_params.cpp rename to host/online_compile/hip_utility/kernel_build_params.cpp index f9474796bc..e37974b1a3 100644 --- a/host/online_compilation/hip_utility/kernel_build_params.cpp +++ b/host/online_compile/hip_utility/kernel_build_params.cpp @@ -31,7 +31,7 @@ #include #include -namespace olCompile { +namespace online_compile { static std::string GenerateDefines(const std::vector& options, const std::string& prefix) @@ -63,4 +63,4 @@ static std::string GenerateDefines(const std::vector& opti return JoinStrings(strs, " "); } -} // namespace olCompile +} // namespace online_compile diff --git a/host/online_compilation/hip_utility/kernel_cache.cpp b/host/online_compile/hip_utility/kernel_cache.cpp similarity index 98% rename from host/online_compilation/hip_utility/kernel_cache.cpp rename to host/online_compile/hip_utility/kernel_cache.cpp index fff57c194e..dceb8de94e 100644 --- a/host/online_compilation/hip_utility/kernel_cache.cpp +++ b/host/online_compile/hip_utility/kernel_cache.cpp @@ -46,7 +46,7 @@ #include #include -namespace olCompile { +namespace online_compile { const std::vector& KernelCache::GetKernels(const std::string& algorithm, const std::string& network_config) @@ -151,4 +151,4 @@ void KernelCache::ClearKernels(const std::string& algorithm, const std::string& KernelCache::KernelCache() {} -} // namespace olCompile +} // namespace online_compile diff --git a/host/online_compilation/hip_utility/logger.cpp b/host/online_compile/hip_utility/logger.cpp similarity index 88% rename from host/online_compilation/hip_utility/logger.cpp rename to host/online_compile/hip_utility/logger.cpp index e8d31562a5..d84bb20908 100644 --- a/host/online_compilation/hip_utility/logger.cpp +++ b/host/online_compile/hip_utility/logger.cpp @@ -5,7 +5,7 @@ using namespace std; -namespace olCompile { +namespace online_compile { #if OLC_DEBUG static LogLevel defLevel = LogLevel::Info2; @@ -27,7 +27,7 @@ string LogLevelString(LogLevel level) ostream& fdt_log(LogLevel level, const char* header, const char* content) { - if(level > olCompile::defLevel) + if(level > online_compile::defLevel) { return (cerr); }; @@ -40,4 +40,4 @@ ostream& fdt_log(LogLevel level, const char* header, const char* content) ostream& fdt_log() { return (cerr); }; void fdt_log_flush() { cerr << endl; } -}; // namespace olCompile +}; // namespace online_compile diff --git a/host/online_compilation/hip_utility/md5.cpp b/host/online_compile/hip_utility/md5.cpp similarity index 99% rename from host/online_compilation/hip_utility/md5.cpp rename to host/online_compile/hip_utility/md5.cpp index ad31292ea7..24166decba 100644 --- a/host/online_compilation/hip_utility/md5.cpp +++ b/host/online_compile/hip_utility/md5.cpp @@ -298,7 +298,7 @@ static void MD5_Final(unsigned char* result, MD5_CTX* ctx) memset(ctx, 0, sizeof(*ctx)); } -namespace olCompile { +namespace online_compile { std::string md5(std::string s) { @@ -316,4 +316,4 @@ std::string md5(std::string s) return sout.str(); } -} // namespace olCompile +} // namespace online_compile diff --git a/host/online_compilation/hip_utility/target_properties.cpp b/host/online_compile/hip_utility/target_properties.cpp similarity index 96% rename from host/online_compilation/hip_utility/target_properties.cpp rename to host/online_compile/hip_utility/target_properties.cpp index 1d2bdef1c1..1de2852c91 100644 --- a/host/online_compilation/hip_utility/target_properties.cpp +++ b/host/online_compile/hip_utility/target_properties.cpp @@ -32,7 +32,7 @@ OLC_DECLARE_ENV_VAR(OLC_DEBUG_ENFORCE_DEVICE) -namespace olCompile { +namespace online_compile { static std::string GetDeviceNameFromMap(const std::string& in) { @@ -53,7 +53,7 @@ static std::string GetDeviceNameFromMap(const std::string& in) {"10.3.0 Sienna_Cichlid 18", "gfx1030"}, }; - const char* const p_asciz = olCompile::GetStringEnv(OLC_DEBUG_ENFORCE_DEVICE{}); + const char* const p_asciz = online_compile::GetStringEnv(OLC_DEBUG_ENFORCE_DEVICE{}); if(p_asciz != nullptr && strlen(p_asciz) > 0) return {p_asciz}; @@ -116,4 +116,4 @@ void TargetProperties::InitDbId() dbId += "_xnack"; } -} // namespace olCompile +} // namespace online_compile diff --git a/host/online_compilation/hip_utility/tmp_dir.cpp b/host/online_compile/hip_utility/tmp_dir.cpp similarity index 90% rename from host/online_compilation/hip_utility/tmp_dir.cpp rename to host/online_compile/hip_utility/tmp_dir.cpp index 6e5de6935d..bdef7cad06 100644 --- a/host/online_compilation/hip_utility/tmp_dir.cpp +++ b/host/online_compile/hip_utility/tmp_dir.cpp @@ -31,7 +31,7 @@ OLC_DECLARE_ENV_VAR(OLC_DEBUG_SAVE_TEMP_DIR) -namespace olCompile { +namespace online_compile { void SystemCmd(std::string cmd) { @@ -43,7 +43,7 @@ void SystemCmd(std::string cmd) TmpDir::TmpDir(std::string prefix) : path(boost::filesystem::temp_directory_path() / - boost::filesystem::unique_path("olCompile-" + prefix + "-%%%%-%%%%-%%%%-%%%%")) + boost::filesystem::unique_path("online_compile-" + prefix + "-%%%%-%%%%-%%%%-%%%%")) { boost::filesystem::create_directories(this->path); } @@ -57,10 +57,10 @@ void TmpDir::Execute(std::string exe, std::string args) const TmpDir::~TmpDir() { - if(!olCompile::IsEnabled(OLC_DEBUG_SAVE_TEMP_DIR{})) + if(!online_compile::IsEnabled(OLC_DEBUG_SAVE_TEMP_DIR{})) { boost::filesystem::remove_all(this->path); } } -} // namespace olCompile +} // namespace online_compile diff --git a/host/online_compilation/include/binary_cache.hpp b/host/online_compile/include/binary_cache.hpp similarity index 97% rename from host/online_compilation/include/binary_cache.hpp rename to host/online_compile/include/binary_cache.hpp index 5ff9f81093..c146bb9758 100644 --- a/host/online_compilation/include/binary_cache.hpp +++ b/host/online_compile/include/binary_cache.hpp @@ -31,7 +31,7 @@ #include #include -namespace olCompile { +namespace online_compile { boost::filesystem::path GetCacheFile(const std::string& device, const std::string& name, const std::string& args); @@ -47,6 +47,6 @@ void SaveBinary(const boost::filesystem::path& binary_path, const std::string& name, const std::string& args); -} // namespace olCompile +} // namespace online_compile #endif diff --git a/host/online_compilation/include/config.h.in b/host/online_compile/include/config.h.in similarity index 100% rename from host/online_compilation/include/config.h.in rename to host/online_compile/include/config.h.in diff --git a/host/online_compilation/include/env.hpp b/host/online_compile/include/env.hpp similarity index 92% rename from host/online_compilation/include/env.hpp rename to host/online_compile/include/env.hpp index 1d519a44d7..057a863269 100644 --- a/host/online_compilation/include/env.hpp +++ b/host/online_compile/include/env.hpp @@ -31,7 +31,7 @@ #include #include -namespace olCompile { +namespace online_compile { /// \todo Rework: Case-insensitive string compare, ODR, (?) move to .cpp @@ -101,23 +101,23 @@ inline const char* GetStringEnv(T) template inline bool IsEnabled(T) { - static const bool result = olCompile::IsEnvvarValueEnabled(T::value()); + static const bool result = online_compile::IsEnvvarValueEnabled(T::value()); return result; } template inline bool IsDisabled(T) { - static const bool result = olCompile::IsEnvvarValueDisabled(T::value()); + static const bool result = online_compile::IsEnvvarValueDisabled(T::value()); return result; } template inline unsigned long int Value(T, unsigned long int fallback = 0) { - static const auto result = olCompile::EnvvarValue(T::value(), fallback); + static const auto result = online_compile::EnvvarValue(T::value(), fallback); return result; } -} // namespace olCompile +} // namespace online_compile #endif diff --git a/host/online_compilation/include/exec_utils.hpp b/host/online_compile/include/exec_utils.hpp similarity index 96% rename from host/online_compilation/include/exec_utils.hpp rename to host/online_compile/include/exec_utils.hpp index bbad128d96..e257133ca4 100644 --- a/host/online_compilation/include/exec_utils.hpp +++ b/host/online_compile/include/exec_utils.hpp @@ -30,13 +30,13 @@ #include #include -namespace olCompile { +namespace online_compile { namespace exec { /// Redirecting both input and output is not supported. int Run(const std::string& p, std::istream* in, std::ostream* out); } // namespace exec -} // namespace olCompile +} // namespace online_compile #endif // EXEC_UTILS_HPP diff --git a/host/online_compilation/include/handle.hpp b/host/online_compile/include/handle.hpp similarity index 98% rename from host/online_compilation/include/handle.hpp rename to host/online_compile/include/handle.hpp index db93ee1445..8eda802a43 100644 --- a/host/online_compilation/include/handle.hpp +++ b/host/online_compile/include/handle.hpp @@ -40,7 +40,7 @@ #include #include -namespace olCompile { +namespace online_compile { struct HandleImpl; @@ -140,6 +140,6 @@ struct Handle inline std::ostream& operator<<(std::ostream& os, const Handle& handle) { return handle.Print(os); } -} // namespace olCompile +} // namespace online_compile #endif // GUARD_OLC_HANDLE_HPP_ diff --git a/host/online_compilation/include/hipCheck.hpp b/host/online_compile/include/hipCheck.hpp similarity index 100% rename from host/online_compilation/include/hipCheck.hpp rename to host/online_compile/include/hipCheck.hpp diff --git a/host/online_compilation/include/hip_build_utils.hpp b/host/online_compile/include/hip_build_utils.hpp similarity index 96% rename from host/online_compilation/include/hip_build_utils.hpp rename to host/online_compile/include/hip_build_utils.hpp index af456f846b..f93993edef 100644 --- a/host/online_compilation/include/hip_build_utils.hpp +++ b/host/online_compile/include/hip_build_utils.hpp @@ -31,9 +31,9 @@ #include #include -namespace olCompile { +namespace online_compile { -boost::filesystem::path HipBuild(boost::optional& tmp_dir, +boost::filesystem::path HipBuild(boost::optional& tmp_dir, const std::string& filename, std::string src, std::string params, @@ -92,6 +92,6 @@ class LcOptionTargetStrings } }; -} // namespace olCompile +} // namespace online_compile #endif diff --git a/host/online_compilation/include/hipoc_kernel.hpp b/host/online_compile/include/hipoc_kernel.hpp similarity index 99% rename from host/online_compilation/include/hipoc_kernel.hpp rename to host/online_compile/include/hipoc_kernel.hpp index 3bcf88f526..f6c5e1adf5 100644 --- a/host/online_compilation/include/hipoc_kernel.hpp +++ b/host/online_compile/include/hipoc_kernel.hpp @@ -36,7 +36,7 @@ #include #include -namespace olCompile { +namespace online_compile { using HipEventPtr = OLC_MANAGE_PTR(hipEvent_t, hipEventDestroy); inline HipEventPtr make_hip_event() @@ -169,6 +169,6 @@ struct HIPOCKernel std::function callback = nullptr) const; }; -} // namespace olCompile +} // namespace online_compile #endif diff --git a/host/online_compilation/include/hipoc_program.hpp b/host/online_compile/include/hipoc_program.hpp similarity index 97% rename from host/online_compilation/include/hipoc_program.hpp rename to host/online_compile/include/hipoc_program.hpp index 5296003cb7..c388bb35bf 100644 --- a/host/online_compilation/include/hipoc_program.hpp +++ b/host/online_compile/include/hipoc_program.hpp @@ -33,7 +33,7 @@ #include #include -namespace olCompile { +namespace online_compile { struct HIPOCProgramImpl; struct HIPOCProgram @@ -59,6 +59,6 @@ struct HIPOCProgram /// False if CO resides on filesystem. bool IsCodeObjectInMemory() const; }; -} // namespace olCompile +} // namespace online_compile #endif diff --git a/host/online_compilation/include/hipoc_program_impl.hpp b/host/online_compile/include/hipoc_program_impl.hpp similarity index 97% rename from host/online_compilation/include/hipoc_program_impl.hpp rename to host/online_compile/include/hipoc_program_impl.hpp index 2d8706b2e8..4e6b59d265 100644 --- a/host/online_compilation/include/hipoc_program_impl.hpp +++ b/host/online_compile/include/hipoc_program_impl.hpp @@ -33,7 +33,7 @@ #include #include -namespace olCompile { +namespace online_compile { using hipModulePtr = OLC_MANAGE_PTR(hipModule_t, hipModuleUnload); @@ -57,5 +57,5 @@ struct HIPOCProgramImpl BuildCodeObjectInFile(std::string& params, const std::string& src, const std::string& filename); void BuildCodeObject(std::string params); }; -} // namespace olCompile +} // namespace online_compile #endif // GUARD_OLC_HIPOC_PROGRAM_IMPL_HPP diff --git a/host/online_compilation/include/kernel.hpp b/host/online_compile/include/kernel.hpp similarity index 96% rename from host/online_compilation/include/kernel.hpp rename to host/online_compile/include/kernel.hpp index 73d6be61ad..7d1fd81242 100644 --- a/host/online_compilation/include/kernel.hpp +++ b/host/online_compile/include/kernel.hpp @@ -30,7 +30,7 @@ #include #include -namespace olCompile { +namespace online_compile { std::string GetKernelSrc(std::string name); std::string GetKernelInc(std::string key); std::vector GetKernelIncList(); @@ -40,6 +40,6 @@ using Kernel = HIPOCKernel; using KernelInvoke = HIPOCKernelInvoke; using Program = HIPOCProgram; -} // namespace olCompile +} // namespace online_compile #endif diff --git a/host/online_compilation/include/kernel_build_params.hpp b/host/online_compile/include/kernel_build_params.hpp similarity index 98% rename from host/online_compilation/include/kernel_build_params.hpp rename to host/online_compile/include/kernel_build_params.hpp index c15769ed27..30315ac9b7 100644 --- a/host/online_compilation/include/kernel_build_params.hpp +++ b/host/online_compile/include/kernel_build_params.hpp @@ -32,7 +32,7 @@ #include #include -namespace olCompile { +namespace online_compile { namespace kbp { struct Option @@ -132,6 +132,6 @@ class KernelBuildParameters } }; -} // namespace olCompile +} // namespace online_compile #endif diff --git a/host/online_compilation/include/kernel_cache.hpp b/host/online_compile/include/kernel_cache.hpp similarity index 98% rename from host/online_compilation/include/kernel_cache.hpp rename to host/online_compile/include/kernel_cache.hpp index 9f88327858..20d26f6102 100644 --- a/host/online_compilation/include/kernel_cache.hpp +++ b/host/online_compile/include/kernel_cache.hpp @@ -49,7 +49,7 @@ #include #include -namespace olCompile { +namespace online_compile { /** * @brief The KernelCache class Build and cache kernels @@ -92,6 +92,6 @@ class KernelCache ProgramMap program_map; }; -} // namespace olCompile +} // namespace online_compile #endif // GUARD_OLC_KERNEL_CACHE_HPP_ diff --git a/host/online_compilation/include/logger.hpp b/host/online_compile/include/logger.hpp similarity index 84% rename from host/online_compilation/include/logger.hpp rename to host/online_compile/include/logger.hpp index cc420d6e34..a397a868ba 100644 --- a/host/online_compilation/include/logger.hpp +++ b/host/online_compile/include/logger.hpp @@ -3,7 +3,7 @@ #include -namespace olCompile { +namespace online_compile { enum class LogLevel { @@ -18,6 +18,6 @@ std::ostream& fdt_log(LogLevel level, const char* header, const char* content); std::ostream& fdt_log(); void fdt_log_flush(); -}; // namespace olCompile +}; // namespace online_compile #endif diff --git a/host/online_compilation/include/manage_ptr.hpp b/host/online_compile/include/manage_ptr.hpp similarity index 93% rename from host/online_compilation/include/manage_ptr.hpp rename to host/online_compile/include/manage_ptr.hpp index c02c712475..f23807686b 100644 --- a/host/online_compilation/include/manage_ptr.hpp +++ b/host/online_compile/include/manage_ptr.hpp @@ -29,7 +29,7 @@ #include #include -namespace olCompile { +namespace online_compile { template struct manage_deleter @@ -68,9 +68,9 @@ using remove_ptr = typename std:: template using shared = std::shared_ptr>; -} // namespace olCompile +} // namespace online_compile #define OLC_MANAGE_PTR(T, F) \ - olCompile::manage_ptr::type, decltype(&F), &F> // NOLINT + online_compile::manage_ptr::type, decltype(&F), &F> // NOLINT #endif diff --git a/host/online_compilation/include/md5.hpp b/host/online_compile/include/md5.hpp similarity index 66% rename from host/online_compilation/include/md5.hpp rename to host/online_compile/include/md5.hpp index 1f350766e7..0fa25849a5 100644 --- a/host/online_compilation/include/md5.hpp +++ b/host/online_compile/include/md5.hpp @@ -3,10 +3,10 @@ #include -namespace olCompile { +namespace online_compile { std::string md5(std::string s); -} // namespace olCompile +} // namespace online_compile #endif diff --git a/host/online_compilation/include/op_kernel_args.hpp b/host/online_compile/include/op_kernel_args.hpp similarity index 100% rename from host/online_compilation/include/op_kernel_args.hpp rename to host/online_compile/include/op_kernel_args.hpp diff --git a/host/online_compilation/include/simple_hash.hpp b/host/online_compile/include/simple_hash.hpp similarity index 96% rename from host/online_compilation/include/simple_hash.hpp rename to host/online_compile/include/simple_hash.hpp index c7dac54cfc..1afa2e2066 100644 --- a/host/online_compilation/include/simple_hash.hpp +++ b/host/online_compile/include/simple_hash.hpp @@ -29,7 +29,7 @@ #include -namespace olCompile { +namespace online_compile { struct SimpleHash { size_t operator()(const std::pair& p) const @@ -39,6 +39,6 @@ struct SimpleHash } }; -} // namespace olCompile +} // namespace online_compile #endif diff --git a/host/online_compilation/include/stringutils.hpp b/host/online_compile/include/stringutils.hpp similarity index 98% rename from host/online_compilation/include/stringutils.hpp rename to host/online_compile/include/stringutils.hpp index 6175c36ff4..71975f430a 100644 --- a/host/online_compilation/include/stringutils.hpp +++ b/host/online_compile/include/stringutils.hpp @@ -36,7 +36,7 @@ #define OLC_STRINGIZE_1(...) #__VA_ARGS__ #define OLC_STRINGIZE(...) OLC_STRINGIZE_1(__VA_ARGS__) -namespace olCompile { +namespace online_compile { inline std::string ReplaceString(std::string subject, const std::string& search, const std::string& replace) @@ -128,6 +128,6 @@ inline std::vector SplitSpaceSeparated(const std::string& in, return rv; } -} // namespace olCompile +} // namespace online_compile #endif // GUARD_OLC_STRINGUTILS_HPP diff --git a/host/online_compilation/include/target_properties.hpp b/host/online_compile/include/target_properties.hpp similarity index 97% rename from host/online_compilation/include/target_properties.hpp rename to host/online_compile/include/target_properties.hpp index 7918728130..349a63fdd5 100644 --- a/host/online_compilation/include/target_properties.hpp +++ b/host/online_compile/include/target_properties.hpp @@ -29,7 +29,7 @@ #include #include -namespace olCompile { +namespace online_compile { struct Handle; @@ -51,6 +51,6 @@ struct TargetProperties boost::optional sramecc_reported = boost::none; }; -} // namespace olCompile +} // namespace online_compile #endif // GUARD_OLC_TARGET_PROPERTIES_HPP diff --git a/host/online_compilation/include/tmp_dir.hpp b/host/online_compile/include/tmp_dir.hpp similarity index 87% rename from host/online_compilation/include/tmp_dir.hpp rename to host/online_compile/include/tmp_dir.hpp index 099a18bf74..3221786061 100644 --- a/host/online_compilation/include/tmp_dir.hpp +++ b/host/online_compile/include/tmp_dir.hpp @@ -4,7 +4,7 @@ #include #include -namespace olCompile { +namespace online_compile { void SystemCmd(std::string cmd); @@ -21,6 +21,6 @@ struct TmpDir ~TmpDir(); }; -} // namespace olCompile +} // namespace online_compile #endif diff --git a/host/online_compilation/include/write_file.hpp b/host/online_compile/include/write_file.hpp similarity index 94% rename from host/online_compilation/include/write_file.hpp rename to host/online_compile/include/write_file.hpp index f1ddb85237..098ff17abf 100644 --- a/host/online_compilation/include/write_file.hpp +++ b/host/online_compile/include/write_file.hpp @@ -5,7 +5,7 @@ #include #include -namespace olCompile { +namespace online_compile { using FilePtr = OLC_MANAGE_PTR(FILE*, std::fclose); @@ -25,6 +25,6 @@ inline void WriteFile(const std::vector& content, const boost::filesystem: throw std::runtime_error("Failed to write to file"); } -} // namespace olCompile +} // namespace online_compile #endif diff --git a/host/online_compilation/kernel.cpp.in b/host/online_compile/kernel.cpp.in similarity index 97% rename from host/online_compilation/kernel.cpp.in rename to host/online_compile/kernel.cpp.in index f67e7d1c6e..b9a9805284 100644 --- a/host/online_compilation/kernel.cpp.in +++ b/host/online_compile/kernel.cpp.in @@ -31,7 +31,7 @@ ${KERNELS_DECLS} // clang-format on -namespace olCompile { +namespace online_compile { const std::map& kernels() { @@ -67,4 +67,4 @@ std::string GetKernelSrc(std::string name) return it->second; } -} // namespace olCompile +} // namespace online_compile diff --git a/host/online_compilation/kernel_includes.cpp.in b/host/online_compile/kernel_includes.cpp.in similarity index 97% rename from host/online_compilation/kernel_includes.cpp.in rename to host/online_compile/kernel_includes.cpp.in index 24dc09e9ff..a7e6bd689b 100644 --- a/host/online_compilation/kernel_includes.cpp.in +++ b/host/online_compile/kernel_includes.cpp.in @@ -29,7 +29,7 @@ #include #include -namespace olCompile { +namespace online_compile { static inline bool EndsWith(const std::string& value, const std::string& suffix) { @@ -77,4 +77,4 @@ std::vector GetHipKernelIncList() return keys; } -} // namespace olCompile +} // namespace online_compile diff --git a/host/online_compilation/kernels_batch.cpp.in b/host/online_compile/kernels_batch.cpp.in similarity index 100% rename from host/online_compilation/kernels_batch.cpp.in rename to host/online_compile/kernels_batch.cpp.in From 49c33aaea72f76d7679ee609ec3a9906e0be9d7b Mon Sep 17 00:00:00 2001 From: Chao Liu Date: Fri, 6 Aug 2021 19:59:53 +0000 Subject: [PATCH 2/4] refactor --- ...ion_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp | 2 +- host/driver_online/include/online_driver_common.hpp | 7 +++++++ host/online_compile/include/op_kernel_args.hpp | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp b/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp index 36c874c97b..46a9f61acc 100644 --- a/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp +++ b/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp @@ -100,7 +100,7 @@ void online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcy "dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.cpp"; std::string algo_name = "implicit_gemm_conv_fwd_v6r1_dlops_nchw"; - std::string compile_param_string = " -std=c++17 " + compile_param.GetCompileParameterString(); + std::string compile_param_string = get_ck_hip_online_compile_common_flag() + compile_param.GetCompileParameterString(); std::string network_config = compile_param_string; std::vector kernel1_times; diff --git a/host/driver_online/include/online_driver_common.hpp b/host/driver_online/include/online_driver_common.hpp index 472ffb52dc..d05a156d89 100644 --- a/host/driver_online/include/online_driver_common.hpp +++ b/host/driver_online/include/online_driver_common.hpp @@ -3,6 +3,13 @@ namespace ck_driver { +inline auto get_ck_hip_online_compile_common_flag() +{ + std::string param = " -std=c++17"; + + return param; +} + // greatest common divisor, aka highest common factor inline int gcd(int x, int y) { diff --git a/host/online_compile/include/op_kernel_args.hpp b/host/online_compile/include/op_kernel_args.hpp index 7d0420e8f5..eb483265ea 100644 --- a/host/online_compile/include/op_kernel_args.hpp +++ b/host/online_compile/include/op_kernel_args.hpp @@ -6,6 +6,9 @@ #include #include + +namespace online_compile { + struct OpKernelArg { @@ -32,4 +35,6 @@ struct OpKernelArg bool is_ptr = false; }; +} // namespace online_compile + #endif From 7b1ec41e5bd0a644a74f275149b2d625b3f13982 Mon Sep 17 00:00:00 2001 From: Chao Liu Date: Fri, 6 Aug 2021 20:50:01 +0000 Subject: [PATCH 3/4] refactor --- host/driver_offline/CMakeLists.txt | 1 + host/driver_online/CMakeLists.txt | 1 + ...tion_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp | 6 +++--- .../include/conv_igemm_fwd_v6r1_dlops_nchw_kcyx_nkhw.hpp | 0 .../include/conv_tunable_fwd_v4r4_dlops_nchw_kcyx_nkhw.hpp | 0 .../include/conv_tunable_fwd_v4r4_xdlops_nchw_kcyx_nkhw.hpp | 0 .../include/conv_tunable_fwd_v4r4_xdlops_nhwc_kyxc_nhwk.hpp | 0 .../include/convolution_problem_descriptor.hpp | 0 8 files changed, 5 insertions(+), 3 deletions(-) rename host/{driver_online => solver}/include/conv_igemm_fwd_v6r1_dlops_nchw_kcyx_nkhw.hpp (100%) rename host/{driver_online => solver}/include/conv_tunable_fwd_v4r4_dlops_nchw_kcyx_nkhw.hpp (100%) rename host/{driver_online => solver}/include/conv_tunable_fwd_v4r4_xdlops_nchw_kcyx_nkhw.hpp (100%) rename host/{driver_online => solver}/include/conv_tunable_fwd_v4r4_xdlops_nhwc_kyxc_nhwk.hpp (100%) rename host/{driver_online => solver}/include/convolution_problem_descriptor.hpp (100%) diff --git a/host/driver_offline/CMakeLists.txt b/host/driver_offline/CMakeLists.txt index 85bd31fbca..927975d449 100644 --- a/host/driver_offline/CMakeLists.txt +++ b/host/driver_offline/CMakeLists.txt @@ -1,6 +1,7 @@ include_directories(BEFORE include ${PROJECT_SOURCE_DIR}/host/host_tensor/include + ${PROJECT_SOURCE_DIR}/host/solver/include ${PROJECT_SOURCE_DIR}/composable_kernel/include ${PROJECT_SOURCE_DIR}/composable_kernel/include/utility ${PROJECT_SOURCE_DIR}/composable_kernel/include/tensor_description diff --git a/host/driver_online/CMakeLists.txt b/host/driver_online/CMakeLists.txt index 152eb270e3..077e3218a0 100644 --- a/host/driver_online/CMakeLists.txt +++ b/host/driver_online/CMakeLists.txt @@ -3,6 +3,7 @@ include_directories(BEFORE ${PROJECT_BINARY_DIR}/host/online_compile/include ${PROJECT_SOURCE_DIR}/host/online_compile/include ${PROJECT_SOURCE_DIR}/host/host_tensor/include + ${PROJECT_SOURCE_DIR}/host/solver/include ${PROJECT_SOURCE_DIR}/composable_kernel/include ${PROJECT_SOURCE_DIR}/composable_kernel/include/utility ${PROJECT_SOURCE_DIR}/composable_kernel/include/tensor_description diff --git a/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp b/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp index 46a9f61acc..92467a7668 100644 --- a/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp +++ b/host/driver_online/include/online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcyx_nkhw.hpp @@ -106,7 +106,7 @@ void online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcy std::vector kernel1_times; std::vector kernel2_times; - for(index_t i = 0; i < nrepeat; ++i) + for(index_t i = 0; i < nrepeat + 1; ++i) { KernelTimer timer1, timer2; std::string kernel_name; @@ -164,11 +164,11 @@ void online_device_dynamic_convolution_forward_implicit_gemm_v6r1_dlops_nchw_kcy auto ave_time1 = std::accumulate( std::next(kernel1_times.begin()), kernel1_times.end(), 0., std::plus{}) / - (nrepeat - 1); + nrepeat; auto ave_time2 = std::accumulate( std::next(kernel2_times.begin()), kernel2_times.end(), 0., std::plus{}) / - (nrepeat - 1); + nrepeat; float perf = (float)(conv_problem_desc.CalculateFlop()) / (std::size_t(1000) * 1000 * 1000) / (ave_time1 + ave_time2); diff --git a/host/driver_online/include/conv_igemm_fwd_v6r1_dlops_nchw_kcyx_nkhw.hpp b/host/solver/include/conv_igemm_fwd_v6r1_dlops_nchw_kcyx_nkhw.hpp similarity index 100% rename from host/driver_online/include/conv_igemm_fwd_v6r1_dlops_nchw_kcyx_nkhw.hpp rename to host/solver/include/conv_igemm_fwd_v6r1_dlops_nchw_kcyx_nkhw.hpp diff --git a/host/driver_online/include/conv_tunable_fwd_v4r4_dlops_nchw_kcyx_nkhw.hpp b/host/solver/include/conv_tunable_fwd_v4r4_dlops_nchw_kcyx_nkhw.hpp similarity index 100% rename from host/driver_online/include/conv_tunable_fwd_v4r4_dlops_nchw_kcyx_nkhw.hpp rename to host/solver/include/conv_tunable_fwd_v4r4_dlops_nchw_kcyx_nkhw.hpp diff --git a/host/driver_online/include/conv_tunable_fwd_v4r4_xdlops_nchw_kcyx_nkhw.hpp b/host/solver/include/conv_tunable_fwd_v4r4_xdlops_nchw_kcyx_nkhw.hpp similarity index 100% rename from host/driver_online/include/conv_tunable_fwd_v4r4_xdlops_nchw_kcyx_nkhw.hpp rename to host/solver/include/conv_tunable_fwd_v4r4_xdlops_nchw_kcyx_nkhw.hpp diff --git a/host/driver_online/include/conv_tunable_fwd_v4r4_xdlops_nhwc_kyxc_nhwk.hpp b/host/solver/include/conv_tunable_fwd_v4r4_xdlops_nhwc_kyxc_nhwk.hpp similarity index 100% rename from host/driver_online/include/conv_tunable_fwd_v4r4_xdlops_nhwc_kyxc_nhwk.hpp rename to host/solver/include/conv_tunable_fwd_v4r4_xdlops_nhwc_kyxc_nhwk.hpp diff --git a/host/driver_online/include/convolution_problem_descriptor.hpp b/host/solver/include/convolution_problem_descriptor.hpp similarity index 100% rename from host/driver_online/include/convolution_problem_descriptor.hpp rename to host/solver/include/convolution_problem_descriptor.hpp From 5781adf5cf4ac753e2e36da7385791775b744bf7 Mon Sep 17 00:00:00 2001 From: Chao Liu Date: Fri, 6 Aug 2021 16:13:07 -0500 Subject: [PATCH 4/4] Update develop (#5) (#6) * refactor