Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
c7441342
Unverified
Commit
c7441342
authored
Oct 16, 2025
by
Thomas Stocker
Committed by
GitHub
Oct 16, 2025
Browse files
vulkan: Get FilterID from Backend for Vulkan (#12655)
* vulkan: Get FilterID from Backend for Vulkan * Fixing patch
parent
4be41d2d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
9 deletions
+11
-9
discover/runner.go
discover/runner.go
+0
-7
llama/patches/0026-GPU-discovery-enhancements.patch
llama/patches/0026-GPU-discovery-enhancements.patch
+3
-1
llama/patches/0028-vulkan-pci-and-memory.patch
llama/patches/0028-vulkan-pci-and-memory.patch
+2
-1
ml/backend/ggml/ggml.go
ml/backend/ggml/ggml.go
+3
-0
ml/backend/ggml/ggml/include/ggml-backend.h
ml/backend/ggml/ggml/include/ggml-backend.h
+2
-0
ml/backend/ggml/ggml/src/ggml-vulkan/ggml-vulkan.cpp
ml/backend/ggml/ggml/src/ggml-vulkan/ggml-vulkan.cpp
+1
-0
No files found.
discover/runner.go
View file @
c7441342
...
...
@@ -550,13 +550,6 @@ func bootstrapDevices(ctx context.Context, ollamaLibDirs []string, extraEnvs []s
}
logutil
.
Trace
(
"runner enumerated devices"
,
"OLLAMA_LIBRARY_PATH"
,
ollamaLibDirs
,
"devices"
,
devices
)
// Enumerate returned devices starting at 0 per library and assign the per-library index as FilteredID
libCounts
:=
make
(
map
[
string
]
int
)
for
i
:=
range
devices
{
lib
:=
devices
[
i
]
.
Library
devices
[
i
]
.
FilteredID
=
strconv
.
Itoa
(
libCounts
[
lib
])
libCounts
[
lib
]
++
}
return
devices
}
...
...
llama/patches/0026-GPU-discovery-enhancements.patch
View file @
c7441342
...
...
@@ -22,7 +22,7 @@ diff --git a/ggml/include/ggml-backend.h b/ggml/include/ggml-backend.h
index ba181d09..09ff75f9 100644
--- a/ggml/include/ggml-backend.h
+++ b/ggml/include/ggml-backend.h
@@ -169,6 +169,1
5
@@
extern "C" {
@@ -169,6 +169,1
7
@@
extern "C" {
const char * device_id;
// device capabilities
struct ggml_backend_dev_caps caps;
...
...
@@ -35,6 +35,8 @@ index ba181d09..09ff75f9 100644
+ int pci_device_id;
+ int pci_domain_id;
+ const char *library;
+ // number with which the devices are accessed (Vulkan)
+ const char *numeric_id;
};
GGML_API const char * ggml_backend_dev_name(ggml_backend_dev_t device);
...
...
llama/patches/0028-vulkan-pci-and-memory.patch
View file @
c7441342
...
...
@@ -175,7 +175,7 @@ index adea7783..fb7204ce 100644
ggml_backend_vk_device_get_memory(dev, &props->memory_free, &props->memory_total);
props->caps = {
/* .async = */ false,
@@ -12564,6 +12633,1
6
@@
static void ggml_backend_vk_device_get_props(ggml_backend_dev_t dev, struct ggml
@@ -12564,6 +12633,1
7
@@
static void ggml_backend_vk_device_get_props(ggml_backend_dev_t dev, struct ggml
/* .buffer_from_host_ptr = */ false,
/* .events = */ false,
};
...
...
@@ -189,6 +189,7 @@ index adea7783..fb7204ce 100644
+ props->pci_device_id = ctx->pci_device_id;
+ props->pci_domain_id = ctx->pci_domain_id;
+ props->library = GGML_VK_NAME;
+ props->numeric_id = ctx->id.empty() ? nullptr : ctx->id.c_str();
}
static ggml_backend_t ggml_backend_vk_device_init(ggml_backend_dev_t dev, const char * params) {
...
...
ml/backend/ggml/ggml.go
View file @
c7441342
...
...
@@ -726,6 +726,9 @@ func (b *Backend) BackendDevices() []ml.DeviceInfo {
}
info
.
PCIID
=
fmt
.
Sprintf
(
"%02x:%02x.%x"
,
props
.
pci_bus_id
,
props
.
pci_device_id
,
props
.
pci_domain_id
)
info
.
LibraryPath
=
ggml
.
LibPaths
()
if
props
.
numeric_id
!=
nil
{
info
.
FilteredID
=
C
.
GoString
(
props
.
numeric_id
)
}
C
.
ggml_backend_dev_memory
(
dev
,
&
props
.
memory_free
,
&
props
.
memory_total
)
info
.
TotalMemory
=
(
uint64
)(
props
.
memory_total
)
...
...
ml/backend/ggml/ggml/include/ggml-backend.h
View file @
c7441342
...
...
@@ -178,6 +178,8 @@ extern "C" {
int
pci_device_id
;
int
pci_domain_id
;
const
char
*
library
;
// number with which the devices are accessed (Vulkan)
const
char
*
numeric_id
;
};
GGML_API
const
char
*
ggml_backend_dev_name
(
ggml_backend_dev_t
device
);
...
...
ml/backend/ggml/ggml/src/ggml-vulkan/ggml-vulkan.cpp
View file @
c7441342
...
...
@@ -12640,6 +12640,7 @@ static void ggml_backend_vk_device_get_props(ggml_backend_dev_t dev, struct ggml
props->pci_device_id = ctx->pci_device_id;
props->pci_domain_id = ctx->pci_domain_id;
props->library = GGML_VK_NAME;
props->numeric_id = ctx->id.empty() ? nullptr : ctx->id.c_str();
}
static ggml_backend_t ggml_backend_vk_device_init(ggml_backend_dev_t dev, const char * params) {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment