Unverified Commit 97e6d514 authored by Chao Liu's avatar Chao Liu Committed by GitHub
Browse files

Merge pull request #4 from ROCmSoftwarePlatform/separate_online_compile

Separate online compile
parents f6edda61 7b1ec41e
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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_
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment