-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sync : llama.cpp #981
sync : llama.cpp #981
Conversation
* vulkan : do not use tensor->extra This patch allows using the Vulkan backend with the RPC backend as tensor->extra is no longer used. Ref: #8536 * Adapt GGML_VULKAN_CHECK_RESULTS to extra removal (llama/2) --------- Co-authored-by: 0cc4m <picard12@live.de>
sycl: initial cmake support of SYCL for AMD GPUs
Co-authored-by: Johannes Gäßler <johannesg@5d6.de>
Also: - metal : fix compute pass descriptor autorelease crash - ggml-backend : add device description to CPU backend - ggml: unify backend logging mechanism
examples/mnist/mnist-common.h
Outdated
mnist_model(const std::string & backend_name) { | ||
const size_t backend_index = ggml_backend_reg_find_by_name(backend_name.c_str()); | ||
if (backend_index == SIZE_MAX) { | ||
const ggml_backend_reg_t reg = ggml_backend_reg_by_name(backend_name.c_str()); | ||
if (reg == nullptr) { | ||
fprintf(stderr, "%s: ERROR: backend %s not found, available:\n", __func__, backend_name.c_str()); | ||
for (size_t i = 0; i < ggml_backend_reg_get_count(); ++i) { | ||
fprintf(stderr, " - %s\n", ggml_backend_reg_get_name(i)); | ||
for (size_t i = 0; i < ggml_backend_reg_count(); ++i) { | ||
fprintf(stderr, " - %s\n", ggml_backend_reg_name(ggml_backend_reg_get(i))); | ||
} | ||
exit(1); | ||
} | ||
|
||
fprintf(stderr, "%s: using %s backend\n", __func__, backend_name.c_str()); | ||
backend = ggml_backend_reg_init_backend(backend_index, nullptr); | ||
|
||
ggml_backend_t backend = ggml_backend_init_by_name(backend_name.c_str(), NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The equivalent in the current API would be to find a device instead. Something like this:
mnist_model(const std::string & backend_name) {
ggml_backend_dev_t dev = ggml_backend_dev_by_name(backend_name.c_str());
if (reg == nullptr) {
fprintf(stderr, "%s: ERROR: backend %s not found, available:\n", __func__, backend_name.c_str());
for (size_t i = 0; i < ggml_backend_dev_count(); ++i) {
fprintf(stderr, " - %s\n", ggml_backend_dev_name(ggml_backend_dev_get(i)));
}
exit(1);
}
fprintf(stderr, "%s: using %s backend\n", __func__, backend_name.c_str());
ggml_backend_t backend = ggml_backend_dev_init(dev, NULL);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, can you also verify the changes in test-backend-buffer.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test-backend-buffer
should also test all the devices, however the test is very outdated and doesn't really test anything useful at this point. It may be better to remove it entirely. I may try to create a more comprehensive test to ensure that backends are implementing the API correctly in the future.
TODO: update examples