SWDEV-345650 - Solving hipKernelNameRefByPtr Stream Issue
Stream is not important to get the kernel name from Function that can be found in the functions_ map. Change-Id: I164bc3ebcc5552359856e76204d8b124ba0d2f34
This commit is contained in:
committed by
Ammar Elwazir
parent
4375b9f5b9
commit
fb8690f812
@@ -766,6 +766,14 @@ hipError_t StatCO::registerStatFunction(const void* hostFunction, Function* func
|
|||||||
return hipSuccess;
|
return hipSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* StatCO::getStatFuncName(const void* hostFunction) const {
|
||||||
|
const auto it = functions_.find(hostFunction);
|
||||||
|
if (it == functions_.end()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return it->second->name().c_str();
|
||||||
|
}
|
||||||
|
|
||||||
hipError_t StatCO::getStatFunc(hipFunction_t* hfunc, const void* hostFunction, int deviceId) {
|
hipError_t StatCO::getStatFunc(hipFunction_t* hfunc, const void* hostFunction, int deviceId) {
|
||||||
amd::ScopedLock lock(sclock_);
|
amd::ScopedLock lock(sclock_);
|
||||||
|
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ public:
|
|||||||
hipError_t registerStatManagedVar(Var *var);
|
hipError_t registerStatManagedVar(Var *var);
|
||||||
|
|
||||||
//Retrive Vars/Funcs for a given hostSidePtr(const void*), unless stated otherwise.
|
//Retrive Vars/Funcs for a given hostSidePtr(const void*), unless stated otherwise.
|
||||||
|
const char* getStatFuncName(const void* hostFunction) const;
|
||||||
hipError_t getStatFunc(hipFunction_t* hfunc, const void* hostFunction, int deviceId);
|
hipError_t getStatFunc(hipFunction_t* hfunc, const void* hostFunction, int deviceId);
|
||||||
hipError_t getStatFuncAttr(hipFuncAttributes* func_attr, const void* hostFunction, int deviceId);
|
hipError_t getStatFuncAttr(hipFuncAttributes* func_attr, const void* hostFunction, int deviceId);
|
||||||
hipError_t getStatGlobalVar(const void* hostVar, int deviceId, hipDeviceptr_t* dev_ptr,
|
hipError_t getStatGlobalVar(const void* hostVar, int deviceId, hipDeviceptr_t* dev_ptr,
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ public:
|
|||||||
hipError_t getStatFunc(hipFunction_t *hfunc, int deviceId);
|
hipError_t getStatFunc(hipFunction_t *hfunc, int deviceId);
|
||||||
hipError_t getStatFuncAttr(hipFuncAttributes* func_attr, int deviceId);
|
hipError_t getStatFuncAttr(hipFuncAttributes* func_attr, int deviceId);
|
||||||
void resize_dFunc(size_t size) { dFunc_.resize(size); }
|
void resize_dFunc(size_t size) { dFunc_.resize(size); }
|
||||||
FatBinaryInfo** moduleInfo() { return modules_; };
|
FatBinaryInfo** moduleInfo() { return modules_; }
|
||||||
|
const std::string& name() const { return name_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<DeviceFunc*> dFunc_; //DeviceFuncObj per Device
|
std::vector<DeviceFunc*> dFunc_; //DeviceFuncObj per Device
|
||||||
|
|||||||
@@ -39,21 +39,11 @@ int hipGetStreamDeviceId(hipStream_t stream) {
|
|||||||
return (s != nullptr)? s->DeviceId() : ihipGetDevice();
|
return (s != nullptr)? s->DeviceId() : ihipGetDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* hipKernelNameRefByPtr(const void* hostFunction, hipStream_t stream) {
|
const char* hipKernelNameRefByPtr(const void* hostFunction, hipStream_t) {
|
||||||
if (hostFunction == NULL) {
|
if (hostFunction == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
int deviceId = hipGetStreamDeviceId(stream);
|
return PlatformState::instance().getStatFuncName(hostFunction);
|
||||||
if (deviceId == -1) {
|
|
||||||
LogPrintfError("Wrong Device Id: %d \n", deviceId);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
hipFunction_t func = nullptr;
|
|
||||||
hipError_t hip_error = PlatformState::instance().getStatFunc(&func, hostFunction, deviceId);
|
|
||||||
if (hip_error != hipSuccess) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return hipKernelNameRef(func);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hipError_t hipRegisterApiCallback(uint32_t id, void* fun, void* arg) {
|
hipError_t hipRegisterApiCallback(uint32_t id, void* fun, void* arg) {
|
||||||
|
|||||||
@@ -889,6 +889,10 @@ hipError_t PlatformState::registerStatManagedVar(hip::Var* var) {
|
|||||||
return statCO_.registerStatManagedVar(var);
|
return statCO_.registerStatManagedVar(var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* PlatformState::getStatFuncName(const void* hostFunction) const {
|
||||||
|
return statCO_.getStatFuncName(hostFunction);
|
||||||
|
}
|
||||||
|
|
||||||
hipError_t PlatformState::getStatFunc(hipFunction_t* hfunc, const void* hostFunction,
|
hipError_t PlatformState::getStatFunc(hipFunction_t* hfunc, const void* hostFunction,
|
||||||
int deviceId) {
|
int deviceId) {
|
||||||
return statCO_.getStatFunc(hfunc, hostFunction, deviceId);
|
return statCO_.getStatFunc(hfunc, hostFunction, deviceId);
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class PlatformState {
|
|||||||
hipError_t registerStatGlobalVar(const void* hostVar, hip::Var* var);
|
hipError_t registerStatGlobalVar(const void* hostVar, hip::Var* var);
|
||||||
hipError_t registerStatManagedVar(hip::Var* var);
|
hipError_t registerStatManagedVar(hip::Var* var);
|
||||||
|
|
||||||
|
const char* getStatFuncName(const void* hostFunction) const;
|
||||||
hipError_t getStatFunc(hipFunction_t* hfunc, const void* hostFunction, int deviceId);
|
hipError_t getStatFunc(hipFunction_t* hfunc, const void* hostFunction, int deviceId);
|
||||||
hipError_t getStatFuncAttr(hipFuncAttributes* func_attr, const void* hostFunction, int deviceId);
|
hipError_t getStatFuncAttr(hipFuncAttributes* func_attr, const void* hostFunction, int deviceId);
|
||||||
hipError_t getStatGlobalVar(const void* hostVar, int deviceId, hipDeviceptr_t* dev_ptr,
|
hipError_t getStatGlobalVar(const void* hostVar, int deviceId, hipDeviceptr_t* dev_ptr,
|
||||||
|
|||||||
Reference in New Issue
Block a user