GithubHelp home page GithubHelp logo

silvanshade / rules_ll Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eomii/rules_ll

0.0 0.0 0.0 3.78 MB

An Upstream Clang/LLVM-based toolchain for contemporary C++ and heterogeneous programming

Home Page: https://ll.eomii.org

License: Other

Shell 1.33% C++ 0.01% Go 5.02% Nix 7.75% Starlark 85.90%

rules_ll's Introduction

rules_ll

OpenSSF Best Practices OSSF-Scorecard Score

An upstream Clang/LLVM-based toolchain for contemporary C++ and heterogeneous programming.

This project interleaves Nix and Bazel with opinionated Starlark rules for C++.

Builds running within rules_ll-compatible workspaces achieve virtually perfect cache hit rates across machines, using C++ toolchains often several major versions ahead of most other remote execution setups.

The ll_* rules use a toolchain purpose-built around Clang/LLVM. You can't combine ll_* and cc_* targets at the moment, but you can still build cc_* projects in rules_ll-workspaces to leverage the remote execution setup and share caches.

โœจ Setup

  1. Install the nix package manager and enable flakes.

  2. Create a rules_ll compatible workspace. To keep the development shell in sync with the rules_ll Bazel module, pin the flake to a specific version:

    git init
    nix flake init -t github:eomii/rules_ll/<version>

    The default toolchains include C++ and HIP for AMDGPU. If you also want to target NVPTX devices (Nvidia GPUs), make sure to read the CUDA license and set unfree = true in flake.nix.

    See tags to find the most recent version.

  3. Enter the rules_ll development shell:

    nix develop
  4. Consider setting up at least a local remote cache as described in the remote execution guide.

๐Ÿ”— Links

๐Ÿš€ C++ modules

Use the interfaces and exposed_interfaces attributes to build C++ modules. C++ modules guide.

load(
    "@rules_ll//ll:defs.bzl",
    "ll_binary",
    "ll_library",
)

ll_library(
    name = "mymodule",
    srcs = ["mymodule_impl.cpp"],
    exposed_interfaces = {
        "mymodule_interface.cppm": "mymodule",
    },
    compile_flags = ["-std=c++20"],
)

ll_binary(
    name = "main",
    srcs = ["main.cpp"],
    deps = [":mymodule"],
)

๐Ÿงน Clang-Tidy

Build compilation databases to use Clang-Tidy as part of your workflows and CI pipelines. Clang-Tidy guide.

load(
   "@rules_ll//ll:defs.bzl",
   "ll_compilation_database",
)

filegroup(
    name = "clang_tidy_config",
    srcs = [".clang-tidy"],
)

ll_compilation_database(
   name = "compile_commands",
   targets = [
      ":my_very_tidy_target",
   ],
   config = ":clang_tidy_config",
)

๐Ÿ˜ท Sanitizers

Integrate sanitizers in your builds with the sanitize attribute. Sanitizers guide.

load(
    "@rules_ll//ll:defs.bzl",
    "ll_binary",
)

ll_binary(
    name = "sanitizer_example",
    srcs = ["totally_didnt_shoot_myself_in_the_foot.cpp"],
    sanitize = ["address"],
)

๐Ÿงฎ CUDA and HIP

Use CUDA and HIP without any manual setup. CUDA and HIP guide.

load(
    "@rules_ll//ll:defs.bzl",
    "ll_binary",
)

ll_binary(
    name = "cuda_example",
    srcs = ["look_mum_no_cuda_setup.cu"],
    compilation_mode = "cuda_nvptx",  # Or "hip_nvptx". Or "hip_amdgpu".
    compile_flags = [
        "--std=c++20",
        "--offload-arch=sm_70",  # Your GPU model.
    ],
)

๐Ÿ“œ License

Licensed under the Apache 2.0 License with LLVM exceptions.

This repository uses overlays and automated setups for the CUDA toolkit and HIP. Using compilation_mode for heterogeneous toolchains implies acceptance of their licenses.

rules_ll's People

Contributors

aaronmondal avatar neqochan avatar renovate[bot] avatar jaroeichler avatar jannisfengler avatar spamdoodler avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.