diff --git a/projects/hip/api/hip/hip_hcc.def.in b/projects/hip/api/hip/hip_hcc.def.in index 8bb7f41083..6913c777a6 100644 --- a/projects/hip/api/hip/hip_hcc.def.in +++ b/projects/hip/api/hip/hip_hcc.def.in @@ -175,6 +175,16 @@ hipHccGetAccelerator hipHccGetAcceleratorView hipCreateSurfaceObject hipDestroySurfaceObject -InitActivityCallback; -EnableActivityCallback; -GetCmdName; +InitActivityCallback +EnableActivityCallback +GetCmdName +hiprtcAddNameExpression +hiprtcCompileProgram +hiprtcCreateProgram +hiprtcDestroyProgram +hiprtcGetLoweredName +hiprtcGetProgramLog +hiprtcGetProgramLogSize +hiprtcGetCode +hiprtcGetCodeSize +hiprtcGetErrorString diff --git a/projects/hip/api/hip/hip_hcc.map.in b/projects/hip/api/hip/hip_hcc.map.in index 25924c5362..0933b51528 100644 --- a/projects/hip/api/hip/hip_hcc.map.in +++ b/projects/hip/api/hip/hip_hcc.map.in @@ -150,6 +150,15 @@ global: hipLaunchByPtr; hipProfilerStart; hipProfilerStop; + hiprtcCompileProgram; + hiprtcCreateProgram; + hiprtcDestroyProgram; + hiprtcGetLoweredName; + hiprtcGetProgramLog; + hiprtcGetProgramLogSize; + hiprtcGetCode; + hiprtcGetCodeSize; + hiprtcGetErrorString; extern "C++" { hip_impl::hipLaunchKernelGGLImpl*; hipCreateTextureObject*; @@ -181,9 +190,19 @@ global: hipDestroySurfaceObject*; hipHccModuleLaunchKernel*; hipExtModuleLaunchKernel*; - InitActivityCallback; - EnableActivityCallback; - GetCmdName; + InitActivityCallback*; + EnableActivityCallback*; + GetCmdName*; + hiprtcAddNameExpression*; + hiprtcCompileProgram*; + hiprtcCreateProgram*; + hiprtcDestroyProgram*; + hiprtcGetLoweredName*; + hiprtcGetProgramLog*; + hiprtcGetProgramLogSize*; + hiprtcGetCode*; + hiprtcGetCodeSize*; + hiprtcGetErrorString*; }; local: *; diff --git a/projects/hip/api/hip/hip_rtc.cpp b/projects/hip/api/hip/hip_rtc.cpp new file mode 100644 index 0000000000..a5dbd097ae --- /dev/null +++ b/projects/hip/api/hip/hip_rtc.cpp @@ -0,0 +1,112 @@ +/* +Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include +#include +#include + +const char* hiprtcGetErrorString(hiprtcResult x) { + switch (x) { + case HIPRTC_SUCCESS: + return "HIPRTC_SUCCESS"; + case HIPRTC_ERROR_OUT_OF_MEMORY: + return "HIPRTC_ERROR_OUT_OF_MEMORY"; + case HIPRTC_ERROR_PROGRAM_CREATION_FAILURE: + return "HIPRTC_ERROR_PROGRAM_CREATION_FAILURE"; + case HIPRTC_ERROR_INVALID_INPUT: + return "HIPRTC_ERROR_INVALID_INPUT"; + case HIPRTC_ERROR_INVALID_PROGRAM: + return "HIPRTC_ERROR_INVALID_PROGRAM"; + case HIPRTC_ERROR_INVALID_OPTION: + return "HIPRTC_ERROR_INVALID_OPTION"; + case HIPRTC_ERROR_COMPILATION: + return "HIPRTC_ERROR_COMPILATION"; + case HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE: + return "HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE"; + case HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION: + return "HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION"; + case HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION: + return "HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION"; + case HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID: + return "HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID"; + case HIPRTC_ERROR_INTERNAL_ERROR: + return "HIPRTC_ERROR_INTERNAL_ERROR"; + default: + throw std::logic_error{"Invalid HIPRTC result."}; + }; +} + +hiprtcResult hiprtcAddNameExpression(hiprtcProgram p, const char* n) { + return HIPRTC_SUCCESS; +} + +hiprtcResult hiprtcCompileProgram(hiprtcProgram p, int n, const char** o) +{ + return HIPRTC_SUCCESS; +} + +hiprtcResult hiprtcCreateProgram(hiprtcProgram* p, const char* src, + const char* name, int n, const char** hdrs, + const char** incs) { + if (p == nullptr) { + return HIPRTC_ERROR_INVALID_PROGRAM; + } + if (n < 0) { + return HIPRTC_ERROR_INVALID_INPUT; + } + if (n && (hdrs == nullptr || incs == nullptr)) { + return HIPRTC_ERROR_INVALID_INPUT; + } + + return HIPRTC_SUCCESS; +} + +hiprtcResult hiprtcDestroyProgram(hiprtcProgram* p) +{ + return HIPRTC_SUCCESS; +} + +hiprtcResult hiprtcGetLoweredName(hiprtcProgram p, const char* n, + const char** ln) +{ + return HIPRTC_SUCCESS; +} + +hiprtcResult hiprtcGetProgramLog(hiprtcProgram p, char* l) +{ + return HIPRTC_SUCCESS; +} + +hiprtcResult hiprtcGetProgramLogSize(hiprtcProgram p, std::size_t* sz) +{ + return HIPRTC_SUCCESS; +} + +hiprtcResult hiprtcGetCode(hiprtcProgram p, char* c) +{ + return HIPRTC_SUCCESS; +} + +hiprtcResult hiprtcGetCodeSize(hiprtcProgram p, std::size_t* sz) +{ + return HIPRTC_SUCCESS; +} \ No newline at end of file