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

[SYCL][bfloat16] Simplify bfloat16 class #17258

Open
wants to merge 5 commits into
base: sycl
Choose a base branch
from

Conversation

bader
Copy link
Contributor

@bader bader commented Mar 1, 2025

This change makes a few changes aiming to make the code more readable.

  • Move declaration of the bfloat16 class right on top of the header file
    and move all declarations with the implementation helpers after the
    class declaration.

  • Converted ConvertToBfloat16 class to namespace. The class doesn't
    represent any object, it's a collection of static methods.

  • Declare public API of the class first.

  • Define bfloat16 class as final.

  • Move Bfloat16StorageT declaration from the detail namespace directly
    into bfloat16 class definition.

  • Co-locate declaration of functions with similar functionality (e.g.
    conversion functions).

  • Simplified uniry operator- implementation by removing additional
    branch for the SPIR target. Generic code for SPIR target produces
    exactly the same code.

  • Added compile time checks for the array size inside conversion helper
    functions. Device side implementation of these functions work
    correctly only for certain array sizes.

  • Include C++ header instead of C (i.e. cstdint instead of stdint.h).

  • Applied "no-else-after-return" and "no-braces-for-single-statement-if"
    coding style changes.

This change makes a few changes aiming to make the code more readable.

* Move declaration of the bfloat16 class right on top of the header file
  and move all declarations with the implementation helpers after the
  class declaration.

* Converted ConvertToBfloat16 class to namespace. The class doesn't
  represent any object, it's a collection of static methods.

* Declare public API of the class first.

* Define bfloat16 class as final.

* Move Bfloat16StorageT declaration from the detail namespace directly
  into bfloat16 class definition.

* Co-locate declaration of functions with similar functionality (e.g.
  conversion functions).

* Simplified uniry operator- implementation by removing additional
  branch for the SPIR target. Generic code for SPIR target produces
  exactly the same code.

* Added compile time checks for the array size inside conversion helper
  functions. Device side implementation of these functions work
  correctly only for certain array sizes.

* Include C++ header instead of C (i.e. cstdint instead of stdint.h).

* Applied "no-else-after-return" and "no-braces-for-single-statement-if"
  coding style changes.
@bader bader requested a review from a team as a code owner March 1, 2025 04:06
@bader bader requested a review from againull March 1, 2025 04:06
@bader bader temporarily deployed to WindowsCILock March 1, 2025 04:06 — with GitHub Actions Inactive
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.

1 participant