SWDEV-357250 - hiprtc support with AMD_LOG_LEVEL when linked as separate library
Change-Id: Ieda83af85a9344b4e09d4fe85acc65386db79c39
This commit is contained in:
@@ -164,11 +164,13 @@ hiprtcResult hiprtcGetLoweredName(hiprtcProgram prog, const char* name_expressio
|
||||
|
||||
hiprtcResult hiprtcDestroyProgram(hiprtcProgram* prog) {
|
||||
HIPRTC_INIT_API(prog);
|
||||
|
||||
if (prog == nullptr) {
|
||||
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_INPUT);
|
||||
}
|
||||
auto* rtcProgram = hiprtc::RTCCompileProgram::as_RTCCompileProgram(*prog);
|
||||
delete rtcProgram;
|
||||
|
||||
HIPRTC_RETURN(HIPRTC_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -237,6 +239,8 @@ hiprtcResult hiprtcVersion(int* major, int* minor) {
|
||||
}
|
||||
|
||||
hiprtcResult hiprtcGetBitcode (hiprtcProgram prog, char* bitcode) {
|
||||
HIPRTC_INIT_API(prog, bitcode);
|
||||
|
||||
if (bitcode == nullptr) {
|
||||
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_INPUT);
|
||||
}
|
||||
@@ -245,10 +249,13 @@ hiprtcResult hiprtcGetBitcode (hiprtcProgram prog, char* bitcode) {
|
||||
if (!rtcProgram->GetBitcode(bitcode)) {
|
||||
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_PROGRAM);
|
||||
}
|
||||
|
||||
HIPRTC_RETURN(HIPRTC_SUCCESS);
|
||||
}
|
||||
|
||||
hiprtcResult hiprtcGetBitcodeSize(hiprtcProgram prog, size_t* bitcode_size) {
|
||||
HIPRTC_INIT_API(prog, bitcode_size);
|
||||
|
||||
if (bitcode_size == nullptr) {
|
||||
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_INPUT);
|
||||
}
|
||||
@@ -333,18 +340,18 @@ hiprtcResult hiprtcLinkAddData(hiprtcLinkState hip_link_state, hiprtcJITInputTyp
|
||||
}
|
||||
|
||||
HIPRTC_RETURN(HIPRTC_SUCCESS);
|
||||
|
||||
}
|
||||
|
||||
hiprtcResult hiprtcLinkComplete(hiprtcLinkState hip_link_state, void** bin_out, size_t* size_out) {
|
||||
HIPRTC_INIT_API(hip_link_state, bin_out, size_out);
|
||||
|
||||
hiprtc::RTCLinkProgram* rtc_link_prog_ptr
|
||||
= reinterpret_cast<hiprtc::RTCLinkProgram*>(hip_link_state);
|
||||
if (!rtc_link_prog_ptr->LinkComplete(bin_out, size_out)) {
|
||||
HIPRTC_RETURN(HIPRTC_ERROR_LINKING);
|
||||
}
|
||||
HIPRTC_RETURN(HIPRTC_SUCCESS);
|
||||
|
||||
HIPRTC_RETURN(HIPRTC_SUCCESS);
|
||||
}
|
||||
|
||||
hiprtcResult hiprtcLinkDestroy(hiprtcLinkState hip_link_state) {
|
||||
|
||||
@@ -62,7 +62,12 @@ template <typename T, typename... Args> inline std::string ToString(T first, Arg
|
||||
} // namespace internal
|
||||
} // namespace hiprtc
|
||||
|
||||
static amd::Monitor g_hiprtcInitlock {"hiprtcInit lock"};
|
||||
#define HIPRTC_INIT_API(...) \
|
||||
amd::ScopedLock lock(g_hiprtcInitlock); \
|
||||
if (!amd::Flag::init()) { \
|
||||
HIPRTC_RETURN(HIPRTC_ERROR_INTERNAL_ERROR); \
|
||||
} \
|
||||
ClPrint(amd::LOG_INFO, amd::LOG_API, "%s ( %s )", __func__, \
|
||||
hiprtc::internal::ToString(__VA_ARGS__).c_str());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user