From 35e0c1b6c46a59ea9e565a67ee1cda292abef752 Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 12 Dec 2019 16:01:14 -0500
Subject: [PATCH] P4 to Git Change 2045076 by
skudchad@skudchad_test2_win_opencl on 2019/12/12 15:57:20
SWDEV-213031 - Check the functions_ map else interpret as a hip::Function for now. Function may not be a device function and may have been obtaiend via hipModuleGetFunction and thus not in the functions_ map
ReviewBoardURL = http://ocltc.amd.com/reviews/r/18388/diff/
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#57 edit
---
hipamd/api/hip/hip_platform.cpp | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/hipamd/api/hip/hip_platform.cpp b/hipamd/api/hip/hip_platform.cpp
index abb7cdb740..05c8d6fce7 100644
--- a/hipamd/api/hip/hip_platform.cpp
+++ b/hipamd/api/hip/hip_platform.cpp
@@ -626,12 +626,17 @@ hipError_t ihipOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks,
{
HIP_INIT_API(NONE, f, blockSize, dynamicSMemSize);
int deviceId = ihipGetDevice();
+ // FIXME: Function may not be a device function and may have been obtaiend via
+ // hipModuleGetFunction and thus not in the functions_ map. Check the map
+ // else interpret as a hip::Function for now.
hipFunction_t func = PlatformState::instance().getFunc(f, deviceId);
if (func == nullptr) {
+ func = f;
+ }
+ hip::Function* function = hip::Function::asFunction(func);
+ if (function == nullptr) {
HIP_RETURN(hipErrorInvalidDeviceFunction);
}
-
- hip::Function* function = hip::Function::asFunction(func);
amd::Kernel* kernel = function->function_;
if (!kernel) {
HIP_RETURN(hipErrorOutOfMemory);
@@ -890,8 +895,9 @@ const std::unordered_map& functions()
for (auto&& function : function_names()) {
for (auto&& module : modules()) {
hipFunction_t f;
- if (hipSuccess == hipModuleGetFunction(&f, module, function.second.c_str()))
+ if (hipSuccess == hipModuleGetFunction(&f, module, function.second.c_str())) {
r[function.first] = f;
+ }
}
}
});