Skip to content

Commit 8284efc

Browse files
authored
initialise buffer.device in ggml_hexagon_session (#16816)
1 parent 1c1409e commit 8284efc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ggml/src/ggml-hexagon/ggml-hexagon.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ static inline void hex_format_op_names(char * str, const struct ggml_tensor * t)
211211
// ** backend sessions
212212

213213
struct ggml_hexagon_session {
214-
ggml_hexagon_session(int dev_id) noexcept(false);
214+
ggml_hexagon_session(int dev_id, ggml_backend_dev_t dev) noexcept(false);
215215
~ggml_hexagon_session() noexcept(true);
216216

217217
void allocate(int dev_id) noexcept(false);
@@ -1631,10 +1631,13 @@ void ggml_hexagon_session::release() noexcept(true) {
16311631
}
16321632
}
16331633

1634-
ggml_hexagon_session::ggml_hexagon_session(int dev_id) noexcept(false) {
1634+
ggml_hexagon_session::ggml_hexagon_session(int dev_id, ggml_backend_dev_t dev) noexcept(false) {
16351635
buffer_type.context = nullptr;
16361636
repack_buffer_type.context = nullptr;
16371637

1638+
buffer_type.device = dev;
1639+
repack_buffer_type.device = dev;
1640+
16381641
try {
16391642
allocate(dev_id);
16401643

@@ -3628,7 +3631,7 @@ ggml_hexagon_registry::ggml_hexagon_registry(ggml_backend_reg_t reg) {
36283631
devices[i].iface = ggml_backend_hexagon_device_i;
36293632
devices[i].reg = reg;
36303633
try {
3631-
devices[i].context = new ggml_hexagon_session(i);
3634+
devices[i].context = new ggml_hexagon_session(i, &devices[i]);
36323635
} catch (std::exception const &exc) {
36333636
GGML_LOG_ERROR("ggml-hex: failed to create device/session %zu\n", i);
36343637
devices[i].context = nullptr;

0 commit comments

Comments
 (0)