| 254 | } |
| 255 | |
| 256 | void KernelParamManager::RegisterStaticCodeObject(const void* data) |
| 257 | { |
| 258 | // Parse the binary and get metadata object |
| 259 | const FatBinStructure *fatbin = reinterpret_cast<const FatBinStructure *>(data); |
| 260 | const void *image = fatbin->image; |
| 261 | |
| 262 | // Now, we need to find where the data is from |
| 263 | // so we can call amd_comgr_set_data_from_file_slice() later |
| 264 | std::string fname; |
| 265 | size_t foffset; |
| 266 | if (!FindFileNameFromAddress(image, &fname, &foffset)) XERRO("Failed to find file name from address"); |
| 267 | |
| 268 | int fd; |
| 269 | size_t fsize; |
| 270 | if (!GetFileHandle(fname.c_str(), &fd, &fsize)) XERRO("Failed to get file handle and size"); |
| 271 | |
| 272 | // Create the data object and set the file slice |
| 273 | amd_comgr_data_t data_object; |
| 274 | // XINFO("create data from %s offset %lu len %lu",fname.c_str(),foffset,fsize); |
| 275 | ASSERT_COMGR_STATUS(CodeObjectManager::create_data(AMD_COMGR_DATA_KIND_FATBIN, &data_object)); |
| 276 | ASSERT_COMGR_STATUS(CodeObjectManager::set_data_from_file_slice(data_object, fd, foffset, fsize)); |
| 277 | registerForDataObject(data_object, image, this->static_kernel_names_params_); |
| 278 | ASSERT_COMGR_STATUS(CodeObjectManager::release_data(data_object)); |
| 279 | } |
| 280 | |
| 281 | void KernelParamManager::RegisterStaticFunction(const void* func, const char* name) |
| 282 | { |
no test coverage detected