Skip to content

sycl: use DNN in the first part of ggml_sycl_mul_mat_batched_sycl #12972

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lslusarczyk
Copy link
Contributor

This is the first change towards making SYCL graphs working by avoiding using calls which issue sycl::wait inside recording phase. Also using oneDNN should be preferred over using MKL in AI, as in this PR.

@github-actions github-actions bot added ggml changes relating to the ggml tensor library for machine learning SYCL https://en.wikipedia.org/wiki/SYCL - GPU programming language labels Apr 16, 2025
Comment on lines 2788 to 2790
// TODO: use strided dnnl::memory::desc ctor in row_gemm to relax below assertions
GGML_ASSERT(nb11/nb10 == ne10);
GGML_ASSERT(nb01/nb00 == ne00);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you planning to remove these restrictions before making this PR ready?
Keep in mind oneDNN is enabled by default so we'll need to make sure that the paths using oneDNN for gemm_batch are as feature complete and performant as oneMKL. If this becomes an issue we may want to introduce another compiler option so that oneDNN batch gemm is disabled by default.

Copy link
Contributor Author

@lslusarczyk lslusarczyk Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indeed looks like not handling some cases which were handled before. However it seems that all cases which need strided API fall into the second "if" branch. I see no test in backend-ops which hits these assertions (it passes). If I understand "ggml_is_contiguous_2" code correctly, this is due to "ggml_is_contiguous_2" condition.

Therefore, unless I will find a case which hits these assertions, I plan to remove TODO and leave them in the final code PR as a self-validating good documentation of this "if" details.

If you know the case which can hit this assertion please let me know - I will add to backend-ops test and handle it.

Update: I've just found that case :) This TODO will be implemented

@NeoZhangJianyu
Copy link
Collaborator

  1. Please make sure the CI/UT is passed with the PR.
  2. There are several assert() to be added.
    Why add them?
    New code should support same cases of legacy code.

@github-actions github-actions bot added the testing Everything test related label Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ggml changes relating to the ggml tensor library for machine learning SYCL https://en.wikipedia.org/wiki/SYCL - GPU programming language testing Everything test related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants