MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / ggml_ensure_tensor_data_at_memory

Function ggml_ensure_tensor_data_at_memory

ggml.c:14766–14782  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14764/////////////////////////////////
14765
14766static void ggml_ensure_tensor_data_at_memory(struct ggml_tensor * tensor) {
14767#if defined(GGML_USE_CUBLAS)
14768 if (tensor->backend == GGML_BACKEND_CPU) {
14769 // in this case, the data is already placed in the memory at compute time
14770 return;
14771 }
14772
14773 if (tensor->buffer == NULL || tensor->data == NULL) {
14774 GGML_ASSERT(false && "not implemented: tensor has no buffer or data");
14775 }
14776
14777 fprintf(stderr, "WARNING: transfering tensor %s to CPU at inference is safe but slow\n", ggml_get_name(tensor));
14778 ggml_cuda_copy_to_host(tensor);
14779#else
14780 UNUSED(tensor);
14781#endif
14782}
14783
14784static void ggml_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * tensor) {
14785 GGML_ASSERT(params);

Callers 1

ggml_compute_forwardFunction · 0.85

Calls 2

fprintfFunction · 0.85
ggml_get_nameFunction · 0.70

Tested by

no test coverage detected