Skip to content

Commit

Permalink
🤸 Make OpenMP more flexible (#232)
Browse files Browse the repository at this point in the history
Enable using OpenMP for all other toolchains such as `cuda_nvpxt`.

To achieve this, the `omp_cpu` toolchain has been removed.

There is no need to have transitions etc for OpenMP. Instead, users may
now add `-fopenmp` to the `compile_flags` and depend on
`@llvm-project//openmp` to achieve equivalent functionality.
  • Loading branch information
aaronmondal authored May 6, 2024
1 parent 4a6aa64 commit 22f5de3
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 66 deletions.
6 changes: 3 additions & 3 deletions docs/reference/defs.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Example:
| <a id="ll_binary-data"></a>`data` | <code><a href="https://bazel.build/concepts/labels">List of labels</a></code>, optional, defaults to <code>[]</code>.<br><br> Extra files made available to compilation and linking steps.<br><br>Not appended to the default command line arguments, but available to actions. Reference these files manually for instance in the `includes`, and `compile_flags` attributes.<br><br>Use this attribute to make intermediary outputs from non-ll targets, for example from `rules_cc` or `filegroup`, available to the rule. |
| <a id="ll_binary-hdrs"></a>`hdrs` | <code><a href="https://bazel.build/concepts/labels">List of labels</a></code>, optional, defaults to <code>[]</code>.<br><br> Header files for this target.<br><br>When including a header file with a nested path, for instance `#include "some/path/myheader.h"`, add `"some/path"` to `includes` to make it visible to the rule.<br><br>Unavailable to downstream targets. |
| <a id="ll_binary-angled_includes"></a>`angled_includes` | <code>List of strings</code>, optional, defaults to <code>[]</code>.<br><br> Angled include paths, relative to the target workspace.<br><br>Useful if you require include prefix stripping for dynamic paths, for instance the ones generated by `bzlmod`. Instead of `compile_flags = ["-Iexternal/mydep.someversion/include"]`, use `angled_includes = ["include"]` to add the path to the workspace automatically.<br><br>Expands paths starting with `$(GENERATED)` to the workspace location in the `GENDIR` path.<br><br>Unavailable to downstream targets. |
| <a id="ll_binary-compilation_mode"></a>`compilation_mode` | <code>String</code>, optional, defaults to <code>"cpp"</code>.<br><br> Enables compilation of heterogeneous single source files.<br><br>Prefer this attribute over adding SYCL/HIP/CUDA flags manually in the `compile_flags` and `link_flags`.<br><br>See [CUDA and HIP](../guides/cuda_and_hip.md).<br><br>`"cpp"` The default C++ toolchain.<br><br>`"cuda_nvptx"` The CUDA toolchain.<br><br>`"hip_nvptx"` The HIP toolchain.<br><br>`"omp_cpu"` The OpenMP CPU toolchain.<br><br>`"bootstrap"` The bootstrap toolchain used by internal dependencies of the `ll_toolchain`. |
| <a id="ll_binary-compilation_mode"></a>`compilation_mode` | <code>String</code>, optional, defaults to <code>"cpp"</code>.<br><br> Enables compilation of heterogeneous single source files.<br><br>Prefer this attribute over adding SYCL/HIP/CUDA flags manually in the `compile_flags` and `link_flags`.<br><br>See [CUDA and HIP](../guides/cuda_and_hip.md).<br><br>`"cpp"` The default C++ toolchain.<br><br>`"cuda_nvptx"` The CUDA toolchain.<br><br>`"hip_nvptx"` The HIP toolchain.<br><br>`"bootstrap"` The bootstrap toolchain used by internal dependencies of the `ll_toolchain`. |
| <a id="ll_binary-compile_flags"></a>`compile_flags` | <code>List of strings</code>, optional, defaults to <code>[]</code>.<br><br> Flags for the compiler.<br><br>Pass a list of strings here. For instance `["-O3", "-std=c++20"]`.<br><br>Split flag pairs `-Xclang -somearg` into separate flags `["-Xclang", "-somearg"]`.<br><br>Unavailable to downstream targets. |
| <a id="ll_binary-defines"></a>`defines` | <code>List of strings</code>, optional, defaults to <code>[]</code>.<br><br> Defines for this target.<br><br>Pass a list of strings here. For instance `["MYDEFINE_1", "MYDEFINE_2"]`.<br><br>Unavailable to downstream targets. |
| <a id="ll_binary-depends_on_llvm"></a>`depends_on_llvm` | <code>Boolean</code>, optional, defaults to <code>False</code>.<br><br> Whether this target directly depends on targets from the `llvm-project-overlay`.<br><br>Setting this to `True` makes the `cc_library` targets from the LLVM project overlay available to this target. |
Expand Down Expand Up @@ -115,7 +115,7 @@ Example:
| <a id="ll_library-data"></a>`data` | <code><a href="https://bazel.build/concepts/labels">List of labels</a></code>, optional, defaults to <code>[]</code>.<br><br> Extra files made available to compilation and linking steps.<br><br>Not appended to the default command line arguments, but available to actions. Reference these files manually for instance in the `includes`, and `compile_flags` attributes.<br><br>Use this attribute to make intermediary outputs from non-ll targets, for example from `rules_cc` or `filegroup`, available to the rule. |
| <a id="ll_library-hdrs"></a>`hdrs` | <code><a href="https://bazel.build/concepts/labels">List of labels</a></code>, optional, defaults to <code>[]</code>.<br><br> Header files for this target.<br><br>When including a header file with a nested path, for instance `#include "some/path/myheader.h"`, add `"some/path"` to `includes` to make it visible to the rule.<br><br>Unavailable to downstream targets. |
| <a id="ll_library-angled_includes"></a>`angled_includes` | <code>List of strings</code>, optional, defaults to <code>[]</code>.<br><br> Angled include paths, relative to the target workspace.<br><br>Useful if you require include prefix stripping for dynamic paths, for instance the ones generated by `bzlmod`. Instead of `compile_flags = ["-Iexternal/mydep.someversion/include"]`, use `angled_includes = ["include"]` to add the path to the workspace automatically.<br><br>Expands paths starting with `$(GENERATED)` to the workspace location in the `GENDIR` path.<br><br>Unavailable to downstream targets. |
| <a id="ll_library-compilation_mode"></a>`compilation_mode` | <code>String</code>, optional, defaults to <code>"cpp"</code>.<br><br> Enables compilation of heterogeneous single source files.<br><br>Prefer this attribute over adding SYCL/HIP/CUDA flags manually in the `compile_flags` and `link_flags`.<br><br>See [CUDA and HIP](../guides/cuda_and_hip.md).<br><br>`"cpp"` The default C++ toolchain.<br><br>`"cuda_nvptx"` The CUDA toolchain.<br><br>`"hip_nvptx"` The HIP toolchain.<br><br>`"omp_cpu"` The OpenMP CPU toolchain.<br><br>`"bootstrap"` The bootstrap toolchain used by internal dependencies of the `ll_toolchain`. |
| <a id="ll_library-compilation_mode"></a>`compilation_mode` | <code>String</code>, optional, defaults to <code>"cpp"</code>.<br><br> Enables compilation of heterogeneous single source files.<br><br>Prefer this attribute over adding SYCL/HIP/CUDA flags manually in the `compile_flags` and `link_flags`.<br><br>See [CUDA and HIP](../guides/cuda_and_hip.md).<br><br>`"cpp"` The default C++ toolchain.<br><br>`"cuda_nvptx"` The CUDA toolchain.<br><br>`"hip_nvptx"` The HIP toolchain.<br><br>`"bootstrap"` The bootstrap toolchain used by internal dependencies of the `ll_toolchain`. |
| <a id="ll_library-compile_flags"></a>`compile_flags` | <code>List of strings</code>, optional, defaults to <code>[]</code>.<br><br> Flags for the compiler.<br><br>Pass a list of strings here. For instance `["-O3", "-std=c++20"]`.<br><br>Split flag pairs `-Xclang -somearg` into separate flags `["-Xclang", "-somearg"]`.<br><br>Unavailable to downstream targets. |
| <a id="ll_library-defines"></a>`defines` | <code>List of strings</code>, optional, defaults to <code>[]</code>.<br><br> Defines for this target.<br><br>Pass a list of strings here. For instance `["MYDEFINE_1", "MYDEFINE_2"]`.<br><br>Unavailable to downstream targets. |
| <a id="ll_library-depends_on_llvm"></a>`depends_on_llvm` | <code>Boolean</code>, optional, defaults to <code>False</code>.<br><br> Whether this target directly depends on targets from the `llvm-project-overlay`.<br><br>Setting this to `True` makes the `cc_library` targets from the LLVM project overlay available to this target. |
Expand Down Expand Up @@ -168,7 +168,7 @@ Example:
| <a id="ll_test-data"></a>`data` | <code><a href="https://bazel.build/concepts/labels">List of labels</a></code>, optional, defaults to <code>[]</code>.<br><br> Extra files made available to compilation and linking steps.<br><br>Not appended to the default command line arguments, but available to actions. Reference these files manually for instance in the `includes`, and `compile_flags` attributes.<br><br>Use this attribute to make intermediary outputs from non-ll targets, for example from `rules_cc` or `filegroup`, available to the rule. |
| <a id="ll_test-hdrs"></a>`hdrs` | <code><a href="https://bazel.build/concepts/labels">List of labels</a></code>, optional, defaults to <code>[]</code>.<br><br> Header files for this target.<br><br>When including a header file with a nested path, for instance `#include "some/path/myheader.h"`, add `"some/path"` to `includes` to make it visible to the rule.<br><br>Unavailable to downstream targets. |
| <a id="ll_test-angled_includes"></a>`angled_includes` | <code>List of strings</code>, optional, defaults to <code>[]</code>.<br><br> Angled include paths, relative to the target workspace.<br><br>Useful if you require include prefix stripping for dynamic paths, for instance the ones generated by `bzlmod`. Instead of `compile_flags = ["-Iexternal/mydep.someversion/include"]`, use `angled_includes = ["include"]` to add the path to the workspace automatically.<br><br>Expands paths starting with `$(GENERATED)` to the workspace location in the `GENDIR` path.<br><br>Unavailable to downstream targets. |
| <a id="ll_test-compilation_mode"></a>`compilation_mode` | <code>String</code>, optional, defaults to <code>"cpp"</code>.<br><br> Enables compilation of heterogeneous single source files.<br><br>Prefer this attribute over adding SYCL/HIP/CUDA flags manually in the `compile_flags` and `link_flags`.<br><br>See [CUDA and HIP](../guides/cuda_and_hip.md).<br><br>`"cpp"` The default C++ toolchain.<br><br>`"cuda_nvptx"` The CUDA toolchain.<br><br>`"hip_nvptx"` The HIP toolchain.<br><br>`"omp_cpu"` The OpenMP CPU toolchain.<br><br>`"bootstrap"` The bootstrap toolchain used by internal dependencies of the `ll_toolchain`. |
| <a id="ll_test-compilation_mode"></a>`compilation_mode` | <code>String</code>, optional, defaults to <code>"cpp"</code>.<br><br> Enables compilation of heterogeneous single source files.<br><br>Prefer this attribute over adding SYCL/HIP/CUDA flags manually in the `compile_flags` and `link_flags`.<br><br>See [CUDA and HIP](../guides/cuda_and_hip.md).<br><br>`"cpp"` The default C++ toolchain.<br><br>`"cuda_nvptx"` The CUDA toolchain.<br><br>`"hip_nvptx"` The HIP toolchain.<br><br>`"bootstrap"` The bootstrap toolchain used by internal dependencies of the `ll_toolchain`. |
| <a id="ll_test-compile_flags"></a>`compile_flags` | <code>List of strings</code>, optional, defaults to <code>[]</code>.<br><br> Flags for the compiler.<br><br>Pass a list of strings here. For instance `["-O3", "-std=c++20"]`.<br><br>Split flag pairs `-Xclang -somearg` into separate flags `["-Xclang", "-somearg"]`.<br><br>Unavailable to downstream targets. |
| <a id="ll_test-defines"></a>`defines` | <code>List of strings</code>, optional, defaults to <code>[]</code>.<br><br> Defines for this target.<br><br>Pass a list of strings here. For instance `["MYDEFINE_1", "MYDEFINE_2"]`.<br><br>Unavailable to downstream targets. |
| <a id="ll_test-depends_on_llvm"></a>`depends_on_llvm` | <code>Boolean</code>, optional, defaults to <code>False</code>.<br><br> Whether this target directly depends on targets from the `llvm-project-overlay`.<br><br>Setting this to `True` makes the `cc_library` targets from the LLVM project overlay available to this target. |
Expand Down
Loading

0 comments on commit 22f5de3

Please sign in to comment.