SWDEV-489106 - Linker API addition to runtime
1) Add Linker APIs to runtime to support SPIRV linking 2) Migrate Internal implementations to runtime and share with rtc 3) Add Support to bundled and unbundled SPIRV Code object linking. Change-Id: Ic1fd4431f842a208a2468e8aec54a65b5fa6b0e3
This commit is contained in:
committed by
Rahul Manocha
parent
9faaf20aae
commit
5930f047bb
@@ -20,6 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "../hip_comgr_helper.hpp"
|
||||
#include <hip/hiprtc.h>
|
||||
#include "hiprtcInternal.hpp"
|
||||
|
||||
@@ -90,7 +91,7 @@ hiprtcResult hiprtcCreateProgram(hiprtcProgram* prog, const char* src, const cha
|
||||
|
||||
if (name == nullptr || strlen(name) == 0) {
|
||||
progName = "CompileSourceXXXXXX";
|
||||
hiprtc::helpers::GenerateUniqueFileName(progName);
|
||||
hip::helpers::GenerateUniqueFileName(progName);
|
||||
}
|
||||
|
||||
if (!rtcProgram->addSource(std::string(src), progName)) {
|
||||
@@ -306,8 +307,9 @@ hiprtcResult hiprtcLinkCreate(unsigned int num_options, hiprtcJIT_option* option
|
||||
}
|
||||
|
||||
std::string name("LinkerProgram");
|
||||
hiprtc::RTCLinkProgram* rtc_link_prog_ptr = new hiprtc::RTCLinkProgram(name);
|
||||
if (!rtc_link_prog_ptr->AddLinkerOptions(num_options, options_ptr, options_vals_pptr)) {
|
||||
hip::LinkProgram* rtc_link_prog_ptr = new hip::LinkProgram(name);
|
||||
if (!rtc_link_prog_ptr->AddLinkerOptions(num_options, options_ptr,
|
||||
options_vals_pptr)) {
|
||||
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_OPTION);
|
||||
}
|
||||
|
||||
@@ -327,14 +329,15 @@ hiprtcResult hiprtcLinkAddFile(hiprtcLinkState hip_link_state, hiprtcJITInputTyp
|
||||
|
||||
if (input_type == HIPRTC_JIT_INPUT_CUBIN || input_type == HIPRTC_JIT_INPUT_PTX ||
|
||||
input_type == HIPRTC_JIT_INPUT_FATBINARY || input_type == HIPRTC_JIT_INPUT_OBJECT ||
|
||||
input_type == HIPRTC_JIT_INPUT_LIBRARY || input_type == HIPRTC_JIT_INPUT_NVVM) {
|
||||
input_type == HIPRTC_JIT_INPUT_LIBRARY || input_type == HIPRTC_JIT_INPUT_NVVM ||
|
||||
input_type == HIPRTC_JIT_INPUT_SPIRV ) {
|
||||
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_INPUT);
|
||||
}
|
||||
|
||||
hiprtc::RTCLinkProgram* rtc_link_prog_ptr =
|
||||
reinterpret_cast<hiprtc::RTCLinkProgram*>(hip_link_state);
|
||||
hip::LinkProgram* rtc_link_prog_ptr =
|
||||
reinterpret_cast<hip::LinkProgram*>(hip_link_state);
|
||||
|
||||
if (!hiprtc::RTCLinkProgram::isLinkerValid(rtc_link_prog_ptr)) {
|
||||
if (!hip::LinkProgram::isLinkerValid(rtc_link_prog_ptr)) {
|
||||
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_INPUT);
|
||||
}
|
||||
|
||||
@@ -357,7 +360,8 @@ hiprtcResult hiprtcLinkAddData(hiprtcLinkState hip_link_state, hiprtcJITInputTyp
|
||||
|
||||
if (input_type == HIPRTC_JIT_INPUT_CUBIN || input_type == HIPRTC_JIT_INPUT_PTX ||
|
||||
input_type == HIPRTC_JIT_INPUT_FATBINARY || input_type == HIPRTC_JIT_INPUT_OBJECT ||
|
||||
input_type == HIPRTC_JIT_INPUT_LIBRARY || input_type == HIPRTC_JIT_INPUT_NVVM) {
|
||||
input_type == HIPRTC_JIT_INPUT_LIBRARY || input_type == HIPRTC_JIT_INPUT_NVVM ||
|
||||
input_type == HIPRTC_JIT_INPUT_SPIRV) {
|
||||
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_INPUT);
|
||||
}
|
||||
|
||||
@@ -366,10 +370,10 @@ hiprtcResult hiprtcLinkAddData(hiprtcLinkState hip_link_state, hiprtcJITInputTyp
|
||||
input_name = name;
|
||||
}
|
||||
|
||||
hiprtc::RTCLinkProgram* rtc_link_prog_ptr =
|
||||
reinterpret_cast<hiprtc::RTCLinkProgram*>(hip_link_state);
|
||||
hip::LinkProgram* rtc_link_prog_ptr =
|
||||
reinterpret_cast<hip::LinkProgram*>(hip_link_state);
|
||||
|
||||
if (!hiprtc::RTCLinkProgram::isLinkerValid(rtc_link_prog_ptr)) {
|
||||
if (!hip::LinkProgram::isLinkerValid(rtc_link_prog_ptr)) {
|
||||
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_INPUT);
|
||||
}
|
||||
|
||||
@@ -387,10 +391,10 @@ hiprtcResult hiprtcLinkComplete(hiprtcLinkState hip_link_state, void** bin_out,
|
||||
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_INPUT);
|
||||
}
|
||||
|
||||
hiprtc::RTCLinkProgram* rtc_link_prog_ptr =
|
||||
reinterpret_cast<hiprtc::RTCLinkProgram*>(hip_link_state);
|
||||
hip::LinkProgram* rtc_link_prog_ptr =
|
||||
reinterpret_cast<hip::LinkProgram*>(hip_link_state);
|
||||
|
||||
if (!hiprtc::RTCLinkProgram::isLinkerValid(rtc_link_prog_ptr)) {
|
||||
if (!hip::LinkProgram::isLinkerValid(rtc_link_prog_ptr)) {
|
||||
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_INPUT);
|
||||
}
|
||||
|
||||
@@ -404,10 +408,10 @@ hiprtcResult hiprtcLinkComplete(hiprtcLinkState hip_link_state, void** bin_out,
|
||||
hiprtcResult hiprtcLinkDestroy(hiprtcLinkState hip_link_state) {
|
||||
HIPRTC_INIT_API(hip_link_state);
|
||||
|
||||
hiprtc::RTCLinkProgram* rtc_link_prog_ptr =
|
||||
reinterpret_cast<hiprtc::RTCLinkProgram*>(hip_link_state);
|
||||
hip::LinkProgram* rtc_link_prog_ptr =
|
||||
reinterpret_cast<hip::LinkProgram*>(hip_link_state);
|
||||
|
||||
if (!hiprtc::RTCLinkProgram::isLinkerValid(rtc_link_prog_ptr)) {
|
||||
if (!hip::LinkProgram::isLinkerValid(rtc_link_prog_ptr)) {
|
||||
HIPRTC_RETURN(HIPRTC_ERROR_INVALID_INPUT);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user