mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-12 11:56:36 +00:00
refactor: share CUDA-style extension kernels across backends
This commit is contained in:
1 parent
7ab323ef25
commit
d11410eee7
19 files changed
+1961
-1719
No files matched your search
@@ -147,6 +147,9 @@ namespace sd {
|
||||
append(usage);
|
||||
append(type);
|
||||
}
|
||||
} else {
|
||||
const auto alignment_offset = reinterpret_cast<uintptr_t>(tensor->data) % ggml_backend_get_alignment(external);
|
||||
append(alignment_offset);
|
||||
}
|
||||
const size_t index = ggml_hash_find(&graph->visited_hash_set, tensor);
|
||||
const int32_t uses = index != GGML_HASHSET_FULL && ggml_bitset_get(graph->visited_hash_set.used, index)
|
||||
@@ -187,7 +190,8 @@ namespace sd {
|
||||
ggml_backend_buffer_set_usage(buffer, GGML_BACKEND_BUFFER_USAGE_WEIGHTS);
|
||||
}
|
||||
copy->buffer = buffer;
|
||||
copy->data = reinterpret_cast<void*>(static_cast<uintptr_t>(1));
|
||||
// Capability checks inspect alignment even before weights are resident.
|
||||
copy->data = source->data ? source->data : reinterpret_cast<void*>(ggml_backend_get_alignment(external));
|
||||
copy->extra = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user