Merge branch 'ollama_vulkan_stable' into grinco-vulkan

This commit is contained in:
Vadim Grinco
2025-03-10 12:39:00 +01:00
2 changed files with 16 additions and 4 deletions

View File

@@ -58,7 +58,11 @@
"cacheVariables": { "cacheVariables": {
"AMDGPU_TARGETS": "gfx900;gfx940;gfx941;gfx942;gfx1010;gfx1012;gfx1030;gfx1100;gfx1101;gfx1102;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack+;gfx90a:xnack-" "AMDGPU_TARGETS": "gfx900;gfx940;gfx941;gfx942;gfx1010;gfx1012;gfx1030;gfx1100;gfx1101;gfx1102;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack+;gfx90a:xnack-"
} }
} },
{
"name": "Vulkan",
"inherits": [ "Default" ]
}
], ],
"buildPresets": [ "buildPresets": [
{ {
@@ -105,6 +109,11 @@
"name": "ROCm 6", "name": "ROCm 6",
"inherits": [ "ROCm" ], "inherits": [ "ROCm" ],
"configurePreset": "ROCm 6" "configurePreset": "ROCm 6"
} },
{
"name": "Vulkan",
"targets": [ "ggml-vulkan" ],
"configurePreset": "Vulkan"
}
] ]
} }

View File

@@ -196,7 +196,10 @@ func initVulkanHandles() *vulkanHandles {
libcapPaths := FindLibCapLibs() libcapPaths := FindLibCapLibs()
if len(vulkanPaths) > 0 && len(libcapPaths) > 0 { if len(vulkanPaths) > 0 && len(libcapPaths) > 0 {
slog.Info("vulkan: load libvulkan and libcap ok")
vHandles.deviceCount, vHandles.vulkan, vulkanLibPath, libcapLibPath = LoadVulkanMgmt(vulkanPaths, libcapPaths) vHandles.deviceCount, vHandles.vulkan, vulkanLibPath, libcapLibPath = LoadVulkanMgmt(vulkanPaths, libcapPaths)
} else {
slog.Info("vulkan: failed to load libvulkan or libcap")
} }
return vHandles return vHandles
@@ -425,7 +428,7 @@ func GetGPUInfo() GpuInfoList {
gpuInfo.ID = C.GoString(&memInfo.gpu_id[0]) gpuInfo.ID = C.GoString(&memInfo.gpu_id[0])
gpuInfo.Compute = fmt.Sprintf("%d.%d", memInfo.major, memInfo.minor) gpuInfo.Compute = fmt.Sprintf("%d.%d", memInfo.major, memInfo.minor)
gpuInfo.MinimumMemory = 0 gpuInfo.MinimumMemory = 0
gpuInfo.DependencyPath = depPaths gpuInfo.DependencyPath = []string{LibOllamaPath}
gpuInfo.Name = C.GoString(&memInfo.gpu_name[0]) gpuInfo.Name = C.GoString(&memInfo.gpu_name[0])
gpuInfo.DriverMajor = int(memInfo.major) gpuInfo.DriverMajor = int(memInfo.major)
gpuInfo.DriverMinor = int(memInfo.minor) gpuInfo.DriverMinor = int(memInfo.minor)
@@ -767,7 +770,7 @@ func LoadVulkanMgmt(vulkanLibPaths []string, capLibPaths []string) (int, *C.vk_h
C.vk_init(vkLib, capLib, &resp) C.vk_init(vkLib, capLib, &resp)
if resp.err != nil { if resp.err != nil {
slog.Debug("Unable to load vulkan", "library", vkLibPath, capLibPath, "error", C.GoString(resp.err)) slog.Error("Unable to load vulkan", "library", vkLibPath, capLibPath, "error", C.GoString(resp.err))
C.free(unsafe.Pointer(resp.err)) C.free(unsafe.Pointer(resp.err))
} else { } else {
return int(resp.num_devices), &resp.ch, vkLibPath, capLibPath return int(resp.num_devices), &resp.ch, vkLibPath, capLibPath