Merge commit '437cc595c6e206dfebb118985b5171bbc1e29eab' into composable_kernel_init_integration_v3

This commit is contained in:
Chao Liu
2021-08-06 21:32:27 +00:00
57 changed files with 135 additions and 121 deletions

View File

@@ -1,4 +1,4 @@
add_subdirectory(host_tensor)
add_subdirectory(online_compilation)
add_subdirectory(online_compile)
add_subdirectory(driver_offline)
add_subdirectory(driver_online)

View File

@@ -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

View File

@@ -1,8 +1,9 @@
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}/host/solver/include
${PROJECT_SOURCE_DIR}/composable_kernel/include
${PROJECT_SOURCE_DIR}/composable_kernel/include/utility
${PROJECT_SOURCE_DIR}/composable_kernel/include/tensor_description
@@ -18,4 +19,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)

View File

@@ -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>{};

View File

@@ -216,7 +216,7 @@ template <typename TInWei,
typename InLeftPads,
typename InRightPads>
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,

View File

@@ -212,7 +212,7 @@ template <typename TInWei,
typename InLeftPads,
typename InRightPads>
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,

View File

@@ -213,7 +213,7 @@ template <typename TInWei,
typename InLeftPads,
typename InRightPads>
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,

View File

@@ -20,7 +20,7 @@ template <typename TInWei,
typename InLeftPads,
typename InRightPads>
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,
@@ -100,13 +100,13 @@ 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<float> kernel1_times;
std::vector<float> 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<float>{}) /
(nrepeat - 1);
nrepeat;
auto ave_time2 =
std::accumulate(
std::next(kernel2_times.begin()), kernel2_times.end(), 0., std::plus<float>{}) /
(nrepeat - 1);
nrepeat;
float perf = (float)(conv_problem_desc.CalculateFlop()) /
(std::size_t(1000) * 1000 * 1000) / (ave_time1 + ave_time2);

View File

@@ -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)
{

View File

@@ -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)

View File

@@ -35,7 +35,7 @@
#include <fstream>
#include <iostream>
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

View File

@@ -38,7 +38,7 @@
#include <sys/wait.h>
#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

View File

@@ -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<std::size_t>(num_cu);
@@ -282,4 +282,4 @@ std::ostream& Handle::Print(std::ostream& os) const
return os;
}
} // namespace olCompile
} // namespace online_compile

View File

@@ -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<TmpDir>& 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

View File

@@ -34,7 +34,7 @@
#include <chrono>
#include <thread>
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

View File

@@ -39,7 +39,7 @@
#include <unistd.h>
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

View File

@@ -31,7 +31,7 @@
#include <kernel_build_params.hpp>
#include <stringutils.hpp>
namespace olCompile {
namespace online_compile {
static std::string GenerateDefines(const std::vector<KernelBuildParameter>& options,
const std::string& prefix)
@@ -63,4 +63,4 @@ static std::string GenerateDefines(const std::vector<KernelBuildParameter>& opti
return JoinStrings(strs, " ");
}
} // namespace olCompile
} // namespace online_compile

View File

@@ -46,7 +46,7 @@
#include <iostream>
#include <iterator>
namespace olCompile {
namespace online_compile {
const std::vector<Kernel>& 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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -31,7 +31,7 @@
#include <boost/filesystem/path.hpp>
#include <string>
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

View File

@@ -31,7 +31,7 @@
#include <string>
#include <vector>
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 <class T>
inline bool IsEnabled(T)
{
static const bool result = olCompile::IsEnvvarValueEnabled(T::value());
static const bool result = online_compile::IsEnvvarValueEnabled(T::value());
return result;
}
template <class T>
inline bool IsDisabled(T)
{
static const bool result = olCompile::IsEnvvarValueDisabled(T::value());
static const bool result = online_compile::IsEnvvarValueDisabled(T::value());
return result;
}
template <class T>
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

View File

@@ -30,13 +30,13 @@
#include <ostream>
#include <string>
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

View File

@@ -40,7 +40,7 @@
#include <vector>
#include <unordered_map>
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_

View File

@@ -31,9 +31,9 @@
#include <boost/optional.hpp>
#include <string>
namespace olCompile {
namespace online_compile {
boost::filesystem::path HipBuild(boost::optional<olCompile::TmpDir>& tmp_dir,
boost::filesystem::path HipBuild(boost::optional<online_compile::TmpDir>& tmp_dir,
const std::string& filename,
std::string src,
std::string params,
@@ -92,6 +92,6 @@ class LcOptionTargetStrings
}
};
} // namespace olCompile
} // namespace online_compile
#endif

View File

@@ -36,7 +36,7 @@
#include <vector>
#include <memory>
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<void(hipEvent_t, hipEvent_t)> callback = nullptr) const;
};
} // namespace olCompile
} // namespace online_compile
#endif

View File

@@ -33,7 +33,7 @@
#include <hip/hip_runtime_api.h>
#include <string>
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

View File

@@ -33,7 +33,7 @@
#include <boost/optional.hpp>
#include <hip/hip_runtime_api.h>
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

View File

@@ -30,7 +30,7 @@
#include <vector>
#include <hipoc_kernel.hpp>
namespace olCompile {
namespace online_compile {
std::string GetKernelSrc(std::string name);
std::string GetKernelInc(std::string key);
std::vector<std::string> GetKernelIncList();
@@ -40,6 +40,6 @@ using Kernel = HIPOCKernel;
using KernelInvoke = HIPOCKernelInvoke;
using Program = HIPOCProgram;
} // namespace olCompile
} // namespace online_compile
#endif

View File

@@ -32,7 +32,7 @@
#include <string>
#include <vector>
namespace olCompile {
namespace online_compile {
namespace kbp {
struct Option
@@ -132,6 +132,6 @@ class KernelBuildParameters
}
};
} // namespace olCompile
} // namespace online_compile
#endif

View File

@@ -49,7 +49,7 @@
#include <unordered_map>
#include <vector>
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_

View File

@@ -3,7 +3,7 @@
#include <fstream>
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

View File

@@ -29,7 +29,7 @@
#include <memory>
#include <type_traits>
namespace olCompile {
namespace online_compile {
template <class F, F f>
struct manage_deleter
@@ -68,9 +68,9 @@ using remove_ptr = typename std::
template <class T>
using shared = std::shared_ptr<remove_ptr<T>>;
} // namespace olCompile
} // namespace online_compile
#define OLC_MANAGE_PTR(T, F) \
olCompile::manage_ptr<typename std::remove_pointer<T>::type, decltype(&F), &F> // NOLINT
online_compile::manage_ptr<typename std::remove_pointer<T>::type, decltype(&F), &F> // NOLINT
#endif

View File

@@ -3,10 +3,10 @@
#include <string>
namespace olCompile {
namespace online_compile {
std::string md5(std::string s);
} // namespace olCompile
} // namespace online_compile
#endif

View File

@@ -6,6 +6,9 @@
#include <half.hpp>
#include <boost/container/small_vector.hpp>
namespace online_compile {
struct OpKernelArg
{
@@ -32,4 +35,6 @@ struct OpKernelArg
bool is_ptr = false;
};
} // namespace online_compile
#endif

View File

@@ -29,7 +29,7 @@
#include <string>
namespace olCompile {
namespace online_compile {
struct SimpleHash
{
size_t operator()(const std::pair<std::string, std::string>& p) const
@@ -39,6 +39,6 @@ struct SimpleHash
}
};
} // namespace olCompile
} // namespace online_compile
#endif

View File

@@ -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<std::string> SplitSpaceSeparated(const std::string& in,
return rv;
}
} // namespace olCompile
} // namespace online_compile
#endif // GUARD_OLC_STRINGUTILS_HPP

View File

@@ -29,7 +29,7 @@
#include <boost/optional.hpp>
#include <string>
namespace olCompile {
namespace online_compile {
struct Handle;
@@ -51,6 +51,6 @@ struct TargetProperties
boost::optional<bool> sramecc_reported = boost::none;
};
} // namespace olCompile
} // namespace online_compile
#endif // GUARD_OLC_TARGET_PROPERTIES_HPP

View File

@@ -4,7 +4,7 @@
#include <string>
#include <boost/filesystem/path.hpp>
namespace olCompile {
namespace online_compile {
void SystemCmd(std::string cmd);
@@ -21,6 +21,6 @@ struct TmpDir
~TmpDir();
};
} // namespace olCompile
} // namespace online_compile
#endif

View File

@@ -5,7 +5,7 @@
#include <manage_ptr.hpp>
#include <fstream>
namespace olCompile {
namespace online_compile {
using FilePtr = OLC_MANAGE_PTR(FILE*, std::fclose);
@@ -25,6 +25,6 @@ inline void WriteFile(const std::vector<char>& content, const boost::filesystem:
throw std::runtime_error("Failed to write to file");
}
} // namespace olCompile
} // namespace online_compile
#endif

View File

@@ -31,7 +31,7 @@
${KERNELS_DECLS}
// clang-format on
namespace olCompile {
namespace online_compile {
const std::map<std::string, std::string>& kernels()
{
@@ -67,4 +67,4 @@ std::string GetKernelSrc(std::string name)
return it->second;
}
} // namespace olCompile
} // namespace online_compile

View File

@@ -29,7 +29,7 @@
#include <stdexcept>
#include <vector>
namespace olCompile {
namespace online_compile {
static inline bool EndsWith(const std::string& value, const std::string& suffix)
{
@@ -77,4 +77,4 @@ std::vector<std::string> GetHipKernelIncList()
return keys;
}
} // namespace olCompile
} // namespace online_compile