{"id":15282021,"url":"https://github.com/eomii/rules_ll","last_synced_at":"2025-04-06T10:14:15.661Z","repository":{"id":37238065,"uuid":"457188244","full_name":"eomii/rules_ll","owner":"eomii","description":"An Upstream Clang/LLVM-based toolchain for contemporary C++ and heterogeneous programming","archived":false,"fork":false,"pushed_at":"2025-03-20T16:41:11.000Z","size":4151,"stargazers_count":89,"open_issues_count":23,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-30T09:08:45.229Z","etag":null,"topics":["bazel","bleeding-edge","build-system","clang","clang-tidy","cpp","cuda","gpu-programming","hermetic","hip","llvm","nix","openmp","remote-caching","remote-execution","reproducible","sanitizers"],"latest_commit_sha":null,"homepage":"https://ll.eomii.org","language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eomii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"docs/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-09T03:04:53.000Z","updated_at":"2025-03-26T10:43:01.000Z","dependencies_parsed_at":"2023-12-19T01:03:57.435Z","dependency_job_id":"1e6fa57d-b0e2-405c-9d5e-09093322399c","html_url":"https://github.com/eomii/rules_ll","commit_stats":{"total_commits":409,"total_committers":7,"mean_commits":58.42857142857143,"dds":0.293398533007335,"last_synced_commit":"bf16e6a703b06bfeb0b65c8f58e7840311f07455"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eomii%2Frules_ll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eomii%2Frules_ll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eomii%2Frules_ll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eomii%2Frules_ll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eomii","download_url":"https://codeload.github.com/eomii/rules_ll/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247464226,"owners_count":20942970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bazel","bleeding-edge","build-system","clang","clang-tidy","cpp","cuda","gpu-programming","hermetic","hip","llvm","nix","openmp","remote-caching","remote-execution","reproducible","sanitizers"],"created_at":"2024-09-30T14:05:17.921Z","updated_at":"2025-04-06T10:14:15.631Z","avatar_url":"https://github.com/eomii.png","language":"Starlark","readme":"# `rules_ll`\n\n[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/6822/badge)](https://bestpractices.coreinfrastructure.org/projects/6822)\n[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/eomii/rules_ll/badge)](https://securityscorecards.dev/viewer/?uri=github.com/eomii/rules_ll)\n\nAn upstream Clang/LLVM-based toolchain for contemporary C++ and heterogeneous\nprogramming.\n\nThis project interleaves Nix and Bazel with opinionated Starlark rules for C++.\n\n\u003c!-- vale alex.ProfanityUnlikely = NO --\u003e\nBuilds running within `rules_ll`-compatible workspaces achieve virtually perfect\ncache hit rates across machines, using C++ toolchains often several major\nversions ahead of most other remote execution setups.\n\nThe `ll_*` rules use a toolchain purpose-built around Clang/LLVM. You can't\ncombine `ll_*` and `cc_*` targets at the moment, but you can still build `cc_*`\nprojects in `rules_ll`-workspaces to leverage the remote execution setup and\nshare caches.\n\n## ✨ Setup\n\n\u003c!-- markdownlint-disable MD029 --\u003e\n\n1. Install [nix with flakes](https://github.com/NixOS/experimental-nix-installer).\n\n2. Create a `rules_ll` compatible workspace. To keep the development shell in\n   sync with the `rules_ll` Bazel module, pin the flake to a specific commit:\n\n   ```bash\n   git init\n   nix flake init -t github:eomii/rules_ll/\u003ccommit\u003e\n   ```\n\n   The default toolchains include C++ and HIP for AMDGPU. If you also want to\n   target NVPTX devices (Nvidia GPUs), make sure to read the [CUDA license](https://docs.nvidia.com/cuda/eula/index.html)\n   and set `comment.allowUnfree` and `config.cudaSupport` in `flake.nix`.\n\n\u003e [!WARNING]\n\u003e Don't use the tags or releases from the GitHub repository. They were used in\n\u003e old versions of `rules_ll` and probably in a broken state. Use a pinned commit\n\u003e instead.\n\n3. Enter the `rules_ll` development shell:\n\n   ```bash\n   nix develop\n   ```\n\n\u003e [!TIP]\n\u003e Strongly consider setting up [`direnv`](https://github.com/direnv/direnv) so\n\u003e that you don't need to remember running `nix develop` to enter the flake and\n\u003e `exit` to exit it.\n\n4. Consider setting up at least a local remote cache as described in the [remote\n   execution guide](https://ll.eomii.org/setup/remote_execution).\n\u003c!-- vale alex.ProfanityUnlikely = YES --\u003e\n\n\u003c!-- markdownlint-enable MD029 --\u003e\n\n## 🔗 Links\n\n- [Docs](https://ll.eomii.org)\n- [Guides](https://ll.eomii.org/guides)\n- [Examples](https://github.com/eomii/rules_ll/tree/main/examples)\n- [Discussions](https://github.com/eomii/rules_ll/discussions)\n\n## 🚀 C++ modules\n\nUse the `interfaces` and `exposed_interfaces` attributes to build C++ modules.\n[C++ modules guide](https://ll.eomii.org/guides/modules).\n\n```python\nload(\n    \"@rules_ll//ll:defs.bzl\",\n    \"ll_binary\",\n    \"ll_library\",\n)\n\nll_library(\n    name = \"mymodule\",\n    srcs = [\"mymodule_impl.cpp\"],\n    exposed_interfaces = {\n        \"mymodule_interface.cppm\": \"mymodule\",\n    },\n    compile_flags = [\"-std=c++20\"],\n)\n\nll_binary(\n    name = \"main\",\n    srcs = [\"main.cpp\"],\n    deps = [\":mymodule\"],\n)\n```\n\n## 🧹 Clang-tidy\n\nBuild compilation databases to use Clang-Tidy as part of your workflows and CI\npipelines. [Clang-Tidy guide](https://ll.eomii.org/guides/clang_tidy).\n\n```python\nload(\n   \"@rules_ll//ll:defs.bzl\",\n   \"ll_compilation_database\",\n)\n\nfilegroup(\n    name = \"clang_tidy_config\",\n    srcs = [\".clang-tidy\"],\n)\n\nll_compilation_database(\n   name = \"compile_commands\",\n   targets = [\n      \":my_very_tidy_target\",\n   ],\n   config = \":clang_tidy_config\",\n)\n```\n\n## 😷 Sanitizers\n\nIntegrate sanitizers in your builds with the `sanitize` attribute.\n[Sanitizers guide](https://ll.eomii.org/guides/sanitizers).\n\n```python\nload(\n    \"@rules_ll//ll:defs.bzl\",\n    \"ll_binary\",\n)\n\nll_binary(\n    name = \"sanitizer_example\",\n    srcs = [\"totally_didnt_shoot_myself_in_the_foot.cpp\"],\n    sanitize = [\"address\"],\n)\n```\n\n## 🧮 CUDA and HIP\n\nUse CUDA and HIP without any manual setup. [CUDA and HIP guide](https://ll.eomii.org/guides/cuda_and_hip).\n\n```python\nload(\n    \"@rules_ll//ll:defs.bzl\",\n    \"ll_binary\",\n)\n\nll_binary(\n    name = \"cuda_example\",\n    srcs = [\"look_mum_no_cuda_setup.cu\"],\n    compilation_mode = \"cuda_nvptx\",  # Or \"hip_nvptx\". Or \"hip_amdgpu\".\n    compile_flags = [\n        \"--std=c++20\",\n        \"--offload-arch=sm_70\",  # Your GPU model.\n    ],\n)\n```\n\n## 📜 License\n\nLicensed under the Apache 2.0 License with LLVM exceptions.\n\nThis repository uses overlays and automated setups for the CUDA toolkit and HIP.\nUsing `compilation_mode` for heterogeneous toolchains implies acceptance of\ntheir licenses.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feomii%2Frules_ll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feomii%2Frules_ll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feomii%2Frules_ll/lists"}