| 285 | } |
| 286 | |
| 287 | void KernelParamManager::RegisterDynamicCodeObject(const char* file_path, hipModule_t mod) |
| 288 | { |
| 289 | // Similar to RegisterStaticCodeObject but read from file_path directly |
| 290 | // Store results in module_kernel_params_[mod] |
| 291 | int fd; |
| 292 | size_t fsize; |
| 293 | if (!GetFileHandle(file_path, &fd, &fsize)) XERRO("Failed to get file handle for dynamic code object"); |
| 294 | |
| 295 | // const char* file_content = nullptr; |
| 296 | // mmap the fd to the file_content |
| 297 | char* file_content = new char[fsize]; |
| 298 | std::ifstream file(file_path, std::ios::binary); |
| 299 | file.read(file_content, fsize); |
| 300 | file.close(); |
| 301 | |
| 302 | amd_comgr_data_t data_object; |
| 303 | ASSERT_COMGR_STATUS(CodeObjectManager::create_data(AMD_COMGR_DATA_KIND_FATBIN, &data_object)); |
| 304 | ASSERT_COMGR_STATUS(CodeObjectManager::set_data_from_file_slice(data_object, fd, 0, fsize)); |
| 305 | |
| 306 | // XDEBG("RegisterDynamicCodeObject for %s, fsize = %zu, fd = %d", file_path, fsize, fd); |
| 307 | |
| 308 | this->module_kernel_params_[mod] = kernel_names_params_map(); |
| 309 | registerForDataObject(data_object, file_content, this->module_kernel_params_[mod]); |
| 310 | for (auto iter : this->module_kernel_params_[mod]) { |
| 311 | // XDEBG("Dynamic module %p has kernel %s with %zu parameters", mod, iter.first.c_str(), iter.second.size()); |
| 312 | } |
| 313 | ASSERT_COMGR_STATUS(CodeObjectManager::release_data(data_object)); |
| 314 | delete[] file_content; |
| 315 | } |
| 316 | |
| 317 | void KernelParamManager::RegisterDynamicFunction(hipModule_t mod, hipFunction_t func, const char* func_name) |
| 318 | { |
nothing calls this directly
no test coverage detected