adding hipKernelNameRefByPtr function

Change-Id: Iefc18967b10394b85a207ffdb5bbfe5e3601474d
这个提交包含在:
Evgeny 编写, Evgeny Shcherbakov 于 2020-05-28 10:59:48 -04:00 提交
1 父节点 1983d720c2
当前提交 ef7ff69ff0
3 个文件已更改
+16

没有与搜索条件相匹配的文件

+1
查看文件
@@ -181,6 +181,7 @@ global:
hipRemoveActivityCallback;
hipApiName;
hipKernelNameRef;
hipKernelNameRefByPtr;
hipProfilerStart;
hipProfilerStop;
hiprtcCompileProgram;
+14
查看文件
@@ -19,6 +19,7 @@
THE SOFTWARE. */
#include "hip/hip_runtime.h"
#include "hip_internal.hpp"
#include "hip_prof_api.h"
// HIP API callback/activity
@@ -27,6 +28,19 @@ api_callbacks_table_t callbacks_table;
extern const std::string& FunctionName(const hipFunction_t f);
const char* hipKernelNameRef(const hipFunction_t f) { return FunctionName(f).c_str(); }
const char* hipKernelNameRefByPtr(const void *hostFunction, hipStream_t stream) {
hip::Stream* s = reinterpret_cast<hip::Stream*>(stream);
int deviceId = (s != nullptr)? s->DeviceId() : ihipGetDevice();
if (deviceId == -1) {
DevLogPrintfError("Wrong Device Id: %d \n", deviceId);
return NULL;
}
hipFunction_t func = PlatformState::instance().getFunc(hostFunction, deviceId);
if (func == nullptr) {
return NULL;
}
return hipKernelNameRef(func);
}
hipError_t hipRegisterApiCallback(uint32_t id, void* fun, void* arg) {
return callbacks_table.set_callback(id, reinterpret_cast<api_callbacks_table_t::fun_t>(fun), arg) ?