Skip to content

Commit

Permalink
🔥 Migrate to flake-parts (#211)
Browse files Browse the repository at this point in the history
This commit removes devenv and instead uses the slimmer flake-parts for
flake creation. The `llShell` was always a bit hacky and has now been
removed in favor of a new `rules_ll.flakeModule` which provides a more
standardized API to configure the build environment.

The bazel wrapper has been removed. Instead, `rules_ll` now generates a
`.bazelrc.ll` file which contains an equivalent configuration. The new
generator hook for `.bazelrc.ll` may be used by adding
`${config.rules_ll.installationScript}` to the `shellHook` field of
`pkgs.mkShell` and functions similar to the `pre-commit-hooks.yaml`
generator from `pre-commit-hooks.nix`.

This commit temporarily breaks the `rules_ll` init template. This will
be fixed in a future commit where we'll migrate the entire RBE setup to
local remote execution.
  • Loading branch information
aaronmondal authored Apr 8, 2024
1 parent 7b6e482 commit ee43e03
Show file tree
Hide file tree
Showing 32 changed files with 765 additions and 960 deletions.
2 changes: 2 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Prevent infinite symlink chains
.devenv
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ build:rbe_local --spawn_strategy=docker --strategy=Javac=docker --genrule_strate
build:rbe_local --experimental_enable_docker_sandbox
build:rbe_local --experimental_docker_verbose

# Nix-generated action env for rules_ll.
try-import %workspace%/.bazelrc.ll

# Allow user-side customization.
try-import %workspace%/.bazelrc.user

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ examples/.pre-commit-config.yaml
# it to the repository when we're certain it's safe to do so.
MODULE.bazel.lock
examples/MODULE.bazel.lock

# Generated by the bazelrc hook.
.bazelrc.ll
examples/bazelrc.ll
3 changes: 2 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ bazel_dep(name = "bazel_skylib", version = "1.5.0")
# Documentation. These should be dev_dependencies, but that doesn't work at the
# moment. This is a bug.
bazel_dep(name = "rules_java", version = "7.5.0", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True)

bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = False)

# The LLVM project. We override the specific commit below.
bazel_dep(name = "llvm-project-overlay", version = "17-init-bcr.3")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ ll_binary(
)
```

## 🧹 Clang-Tidy
## 🧹 Clang-tidy

Build compilation databases to use Clang-Tidy as part of your workflows and CI
pipelines. [Clang-Tidy guide](https://ll.eomii.org/guides/clang_tidy).
Expand Down
119 changes: 0 additions & 119 deletions bazel-wrapper/default.nix

This file was deleted.

8 changes: 4 additions & 4 deletions devtools/ll.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, wrappedBazel, tag }:
{ pkgs, bazel, tag }:

let

Expand All @@ -18,7 +18,7 @@ let
ll_docs = llScript "docs" ./docs.sh;
ll_patch = llScript "overlay" ./overlay.sh;
ll_release = llScript "module" ./module.sh;
ll_rbe = import ./rbe.nix { inherit pkgs wrappedBazel tag; };
ll_rbe = import ./rbe.nix { inherit pkgs bazel tag; };

in

Expand All @@ -32,10 +32,10 @@ elif [[ "$1" == "module" ]]; then
${ll_release}/bin/module $2
elif [[ "$1" == "up" ]]; then
PATH=''${PATH+$PATH:}${pkgs.pulumi}/bin \
${wrappedBazel.baze_ll}/bin/bazel run @rules_ll//devtools:cluster -- up
${bazel}/bin/bazel run @rules_ll//devtools:cluster -- up
elif [[ "$1" == "down" ]]; then
PATH=''${PATH+$PATH:}${pkgs.pulumi}/bin \
${wrappedBazel.baze_ll}/bin/bazel run @rules_ll//devtools:cluster -- down
${bazel}/bin/bazel run @rules_ll//devtools:cluster -- down
elif [[ "$1" == "rbe" ]]; then
${ll_rbe}/bin/rbe $2
else
Expand Down
6 changes: 3 additions & 3 deletions devtools/rbe.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, wrappedBazel, tag }:
{ pkgs, bazel, tag }:

let bazelToolchains = import ../rbe/default.nix { inherit pkgs; }; in

Expand Down Expand Up @@ -56,10 +56,10 @@ pkgs.writeShellScriptBin "rbe" ''
--toolchain_container=$REGISTRY/rules_ll:${tag} \
--exec_os=linux \
--target_os=linux \
--bazel_version=${wrappedBazel.version} \
--bazel_version=${bazel.version} \
--output_src_root=$(pwd) \
--output_config_path=rbe/default \
--bazel_path=${wrappedBazel.baze_ll}/bin/bazel \
--bazel_path=${bazel}/bin/bazel \
--cpp_env_json=rbe/rbeconfig.json
pre-commit run --all-files
Expand Down
4 changes: 4 additions & 0 deletions docs/guides/cuda_and_hip.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,12 @@ ll_binary(
)
```

<!-- vale Microsoft.Headings = NO -->

## Relocatable device code

<!-- vale Microsoft.Headings = YES -->

To build [relocatable device code](https://developer.nvidia.com/blog/separate-compilation-linking-cuda-device-code/),
add `-fgpu-rdc` to `compile_flags`. This lets you split device code into
different files for a cleaner repository layout. Note that this comes at the
Expand Down
Loading

0 comments on commit ee43e03

Please sign in to comment.