Skip to content

Latest commit

 

History

History
170 lines (137 loc) · 7.74 KB

CONTRIBUTING.md

File metadata and controls

170 lines (137 loc) · 7.74 KB

Contributing

License

Intel Project for LLVM* technology is licensed under the terms of the Apache License v2.0 with LLVM Exceptions license (LICENSE.txt) to ensure our ability to contribute this project to the LLVM project under the same license.

By contributing to this project, you agree to the Apache License v2.0 with LLVM Exceptions and copyright terms there in and release your contribution under these terms.

Contribution process

Development

NB: For any changes not related to DPC++, but rather to LLVM in general, it is strongly encouraged that you submit the patch to https://llvm.org/ directly. See LLVM contribution guidelines for more information.

NB: A change in compiler and runtime should be accompanied with corresponding test changes. See Test DPC++ toolchain section of Get Started guide for more information.

Note (October, 2020): DPC++ runtime and compiler ABI is currently in frozen state. This means that no ABI-breaking changes will be accepted by default. Project maintainers may still approve breaking changes in some cases. Please, see ABI Policy Guide for more information.

  • Create a personal fork of the project on GitHub
    • For the DPC++ Compiler project, use sycl branch as baseline for your changes. See Get Started Guide.
  • Prepare your patch
    • follow LLVM coding standards

    • clang-format and clang-tidy tools can be integrated into your workflow to ensure formatting and stylistic compliance of your changes. To avoid code formatting misalignment with GitHub Actions check we recommend using 10 version of clang-format tool (default version on Ubuntu 20.04).

    • use

      ./clang/tools/clang-format/git-clang-format `git merge-base origin/sycl HEAD`

      to check the format of your current changes against the origin/sycl branch.

      • -f to also correct unstaged changes
      • --diff to only print the diff without applying
  • Build the project following Get Started Guide instructions.
  • Run regression tests - instructions.

Tests development

Every product change should be accompanied with corresponding test modification (adding new test(s), extending, removing or modifying existing test(s)).

There are 3 types of tests which are used for DPC++ toolchain validation:

  • DPC++ in-tree tests including check-llvm, check-clang, check-llvm-spirv and check-sycl targets stored in this repository. These tests should not have hardware (e.g. GPU, FPGA, etc.) or external software dependencies (e.g. OpenCL, Level Zero, CUDA runtimes). All tests not following this approach should be moved to DPC++ end-to-end or SYCL-CTS tests. Generally, any functional change to any of the DPC++ toolchain components should be accompanied by one or more tests of this type when possible. They allow verifying individual components and tend to be more lightweight than end-to-end or SYCL-CTS tests.

    General guidelines for adding DPC++ in-tree tests:

    • Use sycl:: namespace instead of cl::sycl::

    • Add a helpful comment describing what the test does at the beginning and other comments throughout the test as necessary.

    • Try to follow descriptive naming convention for variables, functions as much as possible. Please refer to LLVM naming convention

    DPC++ clang FE tests:

    • Include sycl mock headers as system headers. Example: -internal-isystem %S/Inputs #include "sycl.hpp"

    • Use SYCL functions for invoking kernels from the mock header (single_task, parallel_for, parallel_for_work_group) Example:

    `#include "Inputs/sycl.hpp"`
    sycl::queue q;
    q.submit([&](cl::sycl::handler &h) {
    h.single_task( { //code });
    });

    DPC++ headers and runtime tests:

    • check-sycl target contains 2 types of tests: LIT tests and unit tests. LIT tests make compile-time checks of DPC++ headers, e.g. device code IR verification, static_assert tests. Unit tests check DPC++ runtime behavior and do not perform any device code compilation, instead relying on redefining plugin API with PiMock when necessary.
  • DPC++ end-to-end (E2E) tests which are extension to LLVM* test suite. A test which requires full stack including backend runtimes (e.g. OpenCL, Level Zero or CUDA) should be put to DPC++ E2E test suite following CONTRIBUTING.

  • SYCL-CTS are official Khronos* SYCL* conformance tests. They verify SYCL specification compatibility. All implementation details or extensions are out of scope for the tests. If SYCL specification has changed (SYCL CTS tests conflict with recent version of SYCL specification) or change is required in the way the tests are built with DPC++ compiler (defined in FindIntel_SYCL) pull request should be created under KhronosGroup/SYCL-CTS with required patch.

Commit message

  • When writing your commit message, please make sure to follow LLVM developer policies on the subject.
  • For any DPC++-related commit, the [SYCL] tag should be present in the commit message title. To a reasonable extent, additional tags can be used to signify the component changed, e.g.: [PI], [CUDA], [Doc].
  • For product changes which require modification in tests outside of the current repository (see Test DPC++ toolchain), the commit message should contain the link to corresponding test PR, e.g.: E2E test changes are available under intel/llvm-test-suite#88 or SYCL conformance test changes are available under KhronosGroup/SYCL-CTS#65 (see Autolinked references and URLs for more details). The same message should be present both in commit message and in PR description.

Review and acceptance testing

  • Create a pull request for your changes following Creating a pull request instructions.
  • CI will run a signed-off check as soon as your PR is created - see the check_pr CI action results.
  • CI will run several build and functional testing checks as soon as the PR is approved by an Intel representative.
    • A new approval is needed if the PR was updated (e.g. during code review).
  • Once the PR is approved and all checks have passed, the pull request is ready for merge.

Merge

Project maintainers merge pull requests using one of the following options:

  • [Rebase and merge] The preferable choice for PRs containing a single commit
  • [Squash and merge] Used when there are multiple commits in the PR
    • Squashing is done to make sure that the project is buildable on any commit
  • [Create a merge commit] Used for LLVM pull-down PRs to preserve hashes of the commits pulled from the LLVM community repository

*Other names and brands may be claimed as the property of others.