-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[SYCL] Add CodingGuidelines.rst for libsycl #171867
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| ======================== | ||
| Libsycl Coding Standards | ||
| ======================== | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| Introduction | ||
| ============ | ||
|
|
||
| In general ``libsycl`` project adopts LLVM Coding Standards. | ||
| Although ``libsycl`` code base has a reason to deviate from the Coding | ||
| Standards. API classes interface is defined by SYCL 2020 specification and | ||
| don't match the LLVM Coding Standards for Naming. | ||
| This document describes points of deviation from LLVM coding standards for the | ||
| ``libsycl`` project. | ||
|
|
||
| Naming | ||
| ------ | ||
|
|
||
| Name of Types, Functions, Variables, and Enumerators | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| There are 2 kinds of declarations that have different rules: | ||
|
|
||
| * **SYCL API types** should be declared as it is stated in SYCL 2020 | ||
| specification. Those declarations are in snake case (e.g. | ||
| ``create_sub_devices``). | ||
| This rule can be applicable to type traits helpers that are used by SYCL API | ||
| methods (e.g. see platform::get_info) for style alignment within a | ||
| declaration. Decision to use snake case or camel case in this case remains | ||
| with a developer. | ||
|
|
||
| * **Other types (implementation details)** should follow LLVM Coding Standards | ||
| and should be declared in camel case. | ||
|
|
||
| Name of Files and Folders | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, use term "directory" instead of "folder". |
||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| * **Folder Names** within ``libsycl`` directory should be in the snake case | ||
| (e.g. ``test_e2e``). In some case exceptions may apply: for example | ||
| ``Inputs`` is usually used as default name for directories, containing helper | ||
| classes for LIT tests and that should be excluded from test descovery. | ||
|
|
||
| * **File Names in snake case** should be used for all C++ implementation files. | ||
| For example files in folders ``include``, ``src``, ``test``, ``utils``, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test is an umbrella for all types of tests here. I expect test_e2e and unittests follow the same rule. |
||
| ``tools`` should be named in snake case. | ||
|
|
||
| * **File Names in camel case** should be used for other files. For example | ||
| files in folders ``cmake/modules``, ``docs`` should be named in camel case. | ||
| Exception is extension files (in ``docs``) whose naming should be in snake | ||
| case to align with Khronos extensions style. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A link to LLVM Coding Standards would be helpful here I think to ease user's navigation.