Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly add cuda and cxx features to cc_* rules #15499

Closed
dmadisetti opened this issue May 13, 2022 · 2 comments
Closed

Explicitly add cuda and cxx features to cc_* rules #15499

dmadisetti opened this issue May 13, 2022 · 2 comments
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-CPP Issues for C++ rules type: feature request

Comments

@dmadisetti
Copy link

Description of the feature request:

Native cuda support (#6578) is pretty close with clang. Things almost run out of the box with a properly configured clang toolchain. There's still a bit of friction since cuda and cpp share the same toolchain, there should be a near native way of distinguishing compilation types.

What underlying problem are you trying to solve with this feature?

Proposal, add features cxx and cuda in https://cs.opensource.google/bazel/bazel/+/master:tools/cpp/unix_cc_toolchain_config.bzl;l=218;drc=2fc2f4cac889919e80c7932e7933b281a1bce3e3

    default_compile_flags_feature = feature(
        name = "default_compile_flags",
        enabled = True,
        flag_sets = [
            # ... all the other features
            flag_set(
                actions = all_cpp_compile_actions + [ACTION_NAMES.lto_backend],
                flag_groups = ([
                    flag_group(
                        flags = ctx.attr.cxx_flags,
                    ),
                ] if ctx.attr.cxx_flags else []),
                with_features = [with_feature_set(features = ["cxx"])],
            ),
            flag_set(
                actions = all_cpp_compile_actions + [ACTION_NAMES.lto_backend],
                flag_groups = ([
                    flag_group(
                        flags = ctx.attr.cuda_flags,
                    ),
                ] if ctx.attr.cuda_flags else []),
                with_features = [with_feature_set(features = ["cuda"])],
            ),
        ],
    )

    cxx_feature = feature(name = "cxx", enabled = True)
    cuda_feature = feature(name = "cuda")

and then add the relevant attrs for toolchain use.

This will let users distinguish between cuda and cxxflags on the toolchain level. I don't think the flags need to be mutually exclusive. A second effort would to be document all these flags (see #8706 (comment))

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

No response

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

2fc2f4cac889919e80c7932e7933b281a1bce3e3

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

This request comes from trying to resolve this issue: tweag/rules_nixpkgs#218 with a clang toolchain.

@oquenchil oquenchil added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) and removed untriaged labels Jul 7, 2022
@github-actions
Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Sep 11, 2023
Copy link

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team (@bazelbuild/triage). Thanks!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-CPP Issues for C++ rules type: feature request
Projects
None yet
Development

No branches or pull requests

3 participants