tmp: diagnostics for register_host pinning path
This commit is contained in:
@@ -3173,6 +3173,7 @@ static vk_buffer ggml_vk_create_buffer(vk_device& device, size_t size, const std
|
||||
import_info.setPNext(&mem_flags_info);
|
||||
buf->device_memory = device->device.allocateMemory({ size, memory_type_idx, &import_info });
|
||||
} catch (const vk::SystemError& e) {
|
||||
fprintf(stderr, "PROBE import allocateMemory threw: %s\n", e.what());
|
||||
}
|
||||
} else {
|
||||
for (auto it = req_flags_list.begin(); it != req_flags_list.end(); it++) {
|
||||
@@ -17812,14 +17813,17 @@ static void ggml_backend_vk_device_event_synchronize(ggml_backend_dev_t dev, ggm
|
||||
|
||||
static vk_buffer ggml_vk_buffer_from_host_ptr(vk_device & device, void * ptr, size_t size) {
|
||||
if (!device->external_memory_host) {
|
||||
fprintf(stderr, "PROBE from_host_ptr: ext_mem_host disabled\n");
|
||||
return {};
|
||||
}
|
||||
|
||||
uintptr_t uptr = reinterpret_cast<uintptr_t>(ptr);
|
||||
if (uptr & (device->min_imported_host_pointer_alignment - 1)) {
|
||||
fprintf(stderr, "PROBE from_host_ptr: ptr %p not aligned to %zu\n", ptr, device->min_imported_host_pointer_alignment);
|
||||
return {};
|
||||
}
|
||||
if (size & (device->min_imported_host_pointer_alignment - 1)) {
|
||||
fprintf(stderr, "PROBE from_host_ptr: size %zu not aligned to %zu\n", size, device->min_imported_host_pointer_alignment);
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -17829,9 +17833,10 @@ static vk_buffer ggml_vk_buffer_from_host_ptr(vk_device & device, void * ptr, si
|
||||
try {
|
||||
buf = ggml_vk_create_buffer(device, size, { property_flags }, ptr);
|
||||
} catch (vk::SystemError& e) {
|
||||
GGML_LOG_WARN("ggml_vulkan: Failed ggml_vk_create_buffer (%s)\n", e.what());
|
||||
fprintf(stderr, "PROBE from_host_ptr: create_buffer threw (%s)\n", e.what());
|
||||
}
|
||||
|
||||
fprintf(stderr, "PROBE from_host_ptr: ptr=%p size=%zu -> buf=%p buf->buffer=%p\n", ptr, size, buf.get(), buf ? (void*)buf->buffer.operator VkBuffer() : nullptr);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -17923,6 +17928,8 @@ static ggml_backend_dev_t ggml_backend_vk_reg_get_device(ggml_backend_reg_t reg,
|
||||
// GGML_CUDA_REGISTER_HOST path; populates device->pinned_memory, which the
|
||||
// existing pinned fast path in ggml_vk_buffer_write_2d_async looks up.
|
||||
static bool ggml_backend_vk_register_host_buffer(void * buffer, size_t size) {
|
||||
fprintf(stderr, "PROBE register_host CALLED buffer=%p size=%zu cuda_env=%d vk_env=%d\n", buffer, size,
|
||||
getenv("GGML_CUDA_REGISTER_HOST") != nullptr, getenv("GGML_VK_REGISTER_HOST") != nullptr);
|
||||
if (getenv("GGML_CUDA_REGISTER_HOST") == nullptr && getenv("GGML_VK_REGISTER_HOST") == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user