[llvm] [SYCL] add CodingGuidelines.rst for libsycl (PR #171867)

Kseniya Tikhomirova via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 11 08:49:06 PST 2025


https://github.com/KseniyaTikhomirova created https://github.com/llvm/llvm-project/pull/171867

None

>From ed630662a04e99608f69df54753ceae56e8e0eb8 Mon Sep 17 00:00:00 2001
From: "Tikhomirova, Kseniya" <kseniya.tikhomirova at intel.com>
Date: Thu, 11 Dec 2025 08:34:21 -0800
Subject: [PATCH] [SYCL] add CodingGuidelines.rst for libsycl

Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova at intel.com>
---
 libsycl/docs/CodingGuidelines.rst | 52 +++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 libsycl/docs/CodingGuidelines.rst

diff --git a/libsycl/docs/CodingGuidelines.rst b/libsycl/docs/CodingGuidelines.rst
new file mode 100644
index 0000000000000..b765ec97856c9
--- /dev/null
+++ b/libsycl/docs/CodingGuidelines.rst
@@ -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
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+* **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``,
+  ``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.



More information about the llvm-commits mailing list