SWDEV-339995 - Adding hiprtcGetBitcode and hiprtcBitcodeSize changes.

Change-Id: I378f1ac98de3b11fa3f74161abd036702c7b479b


[ROCm/clr commit: 2731d03f03]
This commit is contained in:
kjayapra-amd
2022-06-07 09:24:47 -07:00
کامیت شده توسط Maneesh Gupta
والد abcbb979db
کامیت 8a049faccb
7فایلهای تغییر یافته به همراه76 افزوده شده و 9 حذف شده
@@ -108,13 +108,18 @@ hiprtcResult hiprtcCompileProgram(hiprtcProgram prog, int numOptions, const char
auto* rtcProgram = hiprtc::RTCCompileProgram::as_RTCCompileProgram(prog);
bool fgpu_rdc = false;
std::vector<std::string> opt;
opt.reserve(numOptions);
for (int i = 0; i < numOptions; i++) {
opt.push_back(std::string(options[i]));
if(std::string(options[i]) == std::string("-fgpu-rdc")) {
fgpu_rdc = true;
} else {
opt.push_back(std::string(options[i]));
}
}
if (!rtcProgram->compile(opt)) {
if (!rtcProgram->compile(opt, fgpu_rdc)) {
HIPRTC_RETURN(HIPRTC_ERROR_COMPILATION);
}
@@ -227,6 +232,31 @@ hiprtcResult hiprtcVersion(int* major, int* minor) {
HIPRTC_RETURN(HIPRTC_SUCCESS);
}
hiprtcResult hiprtcGetBitcode (hiprtcProgram prog, char* bitcode) {
if (bitcode == nullptr) {
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_INPUT);
}
auto* rtcProgram = hiprtc::RTCCompileProgram::as_RTCCompileProgram(prog);
if (!rtcProgram->GetBitcode(bitcode)) {
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_PROGRAM);
}
HIPRTC_RETURN(HIPRTC_SUCCESS);
}
hiprtcResult hiprtcGetBitcodeSize(hiprtcProgram prog, size_t* bitcode_size) {
if (bitcode_size == nullptr) {
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_INPUT);
}
auto* rtcProgram = hiprtc::RTCCompileProgram::as_RTCCompileProgram(prog);
if (!rtcProgram->GetBitcodeSize(bitcode_size)) {
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_PROGRAM);
}
HIPRTC_RETURN(HIPRTC_SUCCESS);
}
hiprtcResult hiprtcLinkCreate(unsigned int num_options, hiprtcJIT_option* options_ptr,
void** options_vals_pptr, hiprtcLinkState* hip_link_state_ptr) {
HIPRTC_INIT_API(num_options, options_ptr, options_vals_pptr, hip_link_state_ptr);