Skip to content

SYCL : support non-contiguous tensors in binary ops (add, sub, etc) #12399

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

Merged
merged 2 commits into from
Mar 15, 2025

Conversation

fairydreaming
Copy link
Collaborator

This PR adds support for non-contiguous tensors in SYCL backend binary OPs like ADD, SUB etc.

Note that I have little experience writing GPU kernels, this is basically a copy from ggml/src/ggml-cuda/binbcast.cu. I checked that test-backend-ops passes and confirmed that with this patch DeepSeek V2 Lite works correctly.

But someone more knowledgeable shall take a look and test this on Intel hardware.

Fixes #12390.

@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 Mar 15, 2025
@@ -625,6 +638,26 @@ struct bin_bcast_sycl {
size_t s12 = nb12 / sizeof(src1_t);
size_t s13 = nb13 / sizeof(src1_t);

size_t s00 = nb00 / sizeof(src0_t);
Copy link
Contributor

Choose a reason for hiding this comment

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

I saw a bunch of warning of s00, do you want to fix it?

/home/aubrey/work/llama-gpu/ggml/src/ggml-sycl/common.hpp:641:20: warning: unused variable 's00' [-Wunused-variable]
641 | size_t s00 = nb00 / sizeof(src0_t);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thx, they got lost in a sea of deprecation warnings.

@aubreyli
Copy link
Contributor

This PR looks good to me now, thanks @fairydreaming for your excellent work!

@arthw
Copy link
Collaborator

arthw commented Mar 15, 2025

I test the CI of this PR! all passed!

Thank you!

@arthw arthw merged commit b19bd06 into ggml-org:master Mar 15, 2025
47 checks passed
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Mar 19, 2025
…gml-org#12399)

* sycl : support non-contiguous tensors in binary ops

* sycl : silence unused variable warning

---------

Co-authored-by: Stanisław Szymczyk <[email protected]>
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SYCL bug: DeepSeek-V2-Lite-Chat-Q4_K_M does not work as expected
4 participants