Skip to content

Conversation

safranowith
Copy link
Contributor

This PR adds support for the following unary operators in the SYCL backend:

FLOOR, CEIL, ROUND, TRUNC.

Changes include:

Implementation in element_wise.cpp and element_wise.hpp

Header updates in ggml.h

Registration in SYCL.csv

Documentation updates in docs/ops.md

Test coverage in test-backend-ops.cpp

This SYCL implementation was added following the prior addition of the same operators in the CPU backend.

@github-actions github-actions bot added documentation Improvements or additions to documentation testing Everything test related ggml changes relating to the ggml tensor library for machine learning SYCL https://en.wikipedia.org/wiki/SYCL - GPU programming language labels Oct 16, 2025
@CISC
Copy link
Collaborator

CISC commented Oct 16, 2025

There's a bad merge or something, you are touching a lot of unrelated code.

@safranowith
Copy link
Contributor Author

safranowith commented Oct 16, 2025 via email

@safranowith
Copy link
Contributor Author

safranowith commented Oct 16, 2025 via email

Copy link
Collaborator

@CISC CISC left a comment

Choose a reason for hiding this comment

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

Just a few more whitespace cleanups.

Copy link
Collaborator

@CISC CISC left a comment

Choose a reason for hiding this comment

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

Let's try again. :)

@safranowith
Copy link
Contributor Author

safranowith commented Oct 16, 2025 via email

@CISC CISC requested a review from NeoZhangJianyu October 16, 2025 13:06
Copy link
Collaborator

@NeoZhangJianyu NeoZhangJianyu left a comment

Choose a reason for hiding this comment

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

It's great work!
It's first time that SYCL backend support OP ahead of other backend.

Thank you!

Comment on lines +1107 to +1139
GGML_API struct ggml_tensor * ggml_floor(
struct ggml_context * ctx,
struct ggml_tensor * a);

GGML_API struct ggml_tensor * ggml_floor_inplace(
struct ggml_context * ctx,
struct ggml_tensor * a);

GGML_API struct ggml_tensor * ggml_ceil(
struct ggml_context * ctx,
struct ggml_tensor * a);

GGML_API struct ggml_tensor * ggml_ceil_inplace(
struct ggml_context * ctx,
struct ggml_tensor * a);

GGML_API struct ggml_tensor * ggml_round(
struct ggml_context * ctx,
struct ggml_tensor * a);

GGML_API struct ggml_tensor * ggml_round_inplace(
struct ggml_context * ctx,
struct ggml_tensor * a);

GGML_API struct ggml_tensor * ggml_trunc(
struct ggml_context * ctx,
struct ggml_tensor * a);

GGML_API struct ggml_tensor * ggml_trunc_inplace(
struct ggml_context * ctx,
struct ggml_tensor * a);


Copy link
Member

Choose a reason for hiding this comment

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

These are not needed - the declarations are already in the header a few lines further down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation 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.

4 participants