Skip to content
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

Merged
merged 9 commits into from
Oct 3, 2024
Merged

sync : llama.cpp #981

merged 9 commits into from
Oct 3, 2024

Conversation

ggerganov
Copy link
Owner

TODO: update examples

rgerganov and others added 7 commits October 3, 2024 21:21
* 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
Comment on lines 59 to 71
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);
Copy link
Collaborator

@slaren slaren Oct 3, 2024

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);

Copy link
Owner Author

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

Copy link
Collaborator

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.

@ggerganov ggerganov merged commit 47e4bf0 into master Oct 3, 2024
4 checks passed
@ggerganov ggerganov deleted the sync branch October 3, 2024 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants