MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / LoadModule

Method LoadModule

tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:349–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349port::Status GpuExecutor::LoadModule(const MultiModuleLoaderSpec& spec,
350 ModuleHandle* module_handle) {
351 // In GpuExecutor we store the pointer to the GPU binary (PTX or CUBIN) as
352 // ModuleHandle::id().
353 CUmodule cu_module;
354 if (spec.has_cuda_cubin_in_memory()) {
355 absl::MutexLock lock{&in_memory_modules_mu_};
356 TF_RETURN_IF_ERROR(LoadModuleFromCuBin(
357 reinterpret_cast<const char*>(spec.cuda_cubin_in_memory().data()),
358 &cu_module));
359 *module_handle = ModuleHandle(const_cast<void *>(
360 static_cast<const void *>(spec.cuda_cubin_in_memory().data())));
361 return port::Status::OK();
362 } else if (spec.has_cuda_ptx_in_memory()) {
363 if (cc_major_ == 0 && cc_minor_ == 0) {
364 return port::InternalError("Compute capability not set");
365 }
366
367 if (!spec.cuda_ptx_in_memory()) {
368 return port::InternalError("PTX not found in spec");
369 }
370
371 absl::MutexLock lock{&in_memory_modules_mu_};
372 TF_RETURN_IF_ERROR(
373 LoadModuleFromPtx(spec.cuda_ptx_in_memory(), &cu_module));
374 *module_handle = ModuleHandle(const_cast<void *>(
375 static_cast<const void *>(spec.cuda_ptx_in_memory())));
376 return port::Status::OK();
377 }
378 return port::InternalError("No method of loading CUDA module provided");
379}
380
381bool GpuExecutor::UnloadModule(ModuleHandle module_handle) {
382 const char *gpu_binary = reinterpret_cast<const char *>(module_handle.id());

Callers

nothing calls this directly

Calls 7

ModuleHandleClass · 0.85
cuda_cubin_in_memoryMethod · 0.80
cuda_ptx_in_memoryMethod · 0.80
InternalErrorFunction · 0.50
dataMethod · 0.45

Tested by

no test coverage detected