Commit Graph

16 Commits

Author SHA1 Message Date
Ivan Zaitsev
3d4ca228be Remove METADATA.bzl files (#166574)
(meta-internal, should not be synced)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166574
Approved by: https://github.com/bigfootjon
2025-10-29 23:17:41 +00:00
Ivan Murashko
df1ef27e6a [AutoAccept][Codemod][FBSourceBuckFormatLinter] Daily arc lint --take BUCKFORMAT (#79692)
Reviewed By: ivanmurashko

Differential Revision: D37203030

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79692
Approved by: https://github.com/mehtanirav
2022-06-16 17:01:17 +00:00
Michael Andreas Dagitses
34b0285185 turn on -Werror=extra in Bazel
Summary:
These are mostly helpful warnings but we explicitly disable two of
them that are problematic in our codebase.

We also remove -Werror=type-limits and -Werror=unused-but-set-variable
since they are both included as part of -Wextra.

Test Plan: Rely on CI.

Reviewers: alband

Subscribers:

Tasks:

Tags:

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79327

Approved by: https://github.com/malfet
2022-06-13 21:07:31 +00:00
Michael Andreas Dagitses
70810a3691 turn on -Wall with a few exceptions in Bazel build
Summary:
We add the following exceptions:
 * sign-compare: this is heavily violated in our codebase
 * unknown-pragmas: we use this intentionally for some loop unrolling
   in CUDA

Because they are included in -Wall by default, we remove the following
warnings from our explicit list:
 * unused-function
 * unused-variable

Test Plan: Rely on CI.

Reviewers: alband, seemethere

Subscribers:

Tasks:

Tags:

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79306

Approved by: https://github.com/malfet
2022-06-13 20:29:14 +00:00
Michael Andreas Dagitses
52a5266aab turn on -Werror=unused-but-set-variable
Summary:
Also fix the one violation.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79305

Approved by: https://github.com/malfet
2022-06-13 20:23:50 +00:00
Michael Andreas Dagitses
9c6579f8f7 move CUDA flags out of --per_file_copts into the cu_library macro
Summary:
This has a few advantages:
 * changes do not discard the Bazel analysis cache
 * allows for per-target overrides

Test Plan: Verified with `bazel build --subcommands`.

Reviewers: seemethere

Subscribers:

Tasks:

Tags:

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79414

Approved by: https://github.com/malfet
2022-06-13 17:22:34 +00:00
Jon Janzen
03847808a0 Add all bzl files per D36874458 2022-06-06 09:40:19 -07:00
Thuyen Ngo
e35bf56461 [Bazel] Add CUDA build to CI (#66241)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/35316
On master, bazel cuda build is disabled due to lack of a proper `cu_library` rule. This PR:
- Add `rules_cuda` to the WORKSPACE and forward `cu_library` to `rules_cuda`.
- Use a simple local cuda and cudnn repositories (adopted from TRTorch) for cuda 11.3.
- Fix current broken cuda build.
- Enable cuda build in CI, not just for `:torch` target but all the test binaries to catch undefined symbols.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/66241

Reviewed By: ejguan

Differential Revision: D31544091

Pulled By: malfet

fbshipit-source-id: fd3c34d0e8f80fee06f015694a4c13a8e9e12206
2021-12-17 13:44:29 -08:00
Andres Suarez
c015cbabf9 [codemod][fbcode/caffe2] Apply all buildifier fixes
Test Plan: Visual inspection. Sandcastle.

Reviewed By: zsol

Differential Revision: D31144864

fbshipit-source-id: f8e65fec69f88d03048df9edb98969d648eb6981
2021-09-23 14:03:19 -07:00
Sergei Vorobev
f922b58b5f [bazel] GPU-support: add @local_config_cuda and @cuda (#63604)
Summary:
## Context

We take the first step at tackling the GPU-bazel support by adding bazel external workspaces `local_config_cuda` and `cuda`, where the first one has some hardcoded values and lists of files, and the second one provides a nicer, high-level wrapper that maps into the already expected by pytorch bazel targets that are guarded with `if_cuda` macro.

The prefix `local_config_` signifies the fact that we are breaking the bazel hermeticity philosophy by explicitly relaying on the CUDA installation that is present on the machine.

## Testing

Notice an important scenario that is unlocked by this change: compilation of cpp code that depends on cuda libraries (i.e. cuda.h and so on).

Before:
```
sergei.vorobev@cs-sv7xn77uoy-gpu-1628706590:~/src/pytorch4$ bazelisk build --define=cuda=true //:c10
ERROR: /home/sergei.vorobev/src/pytorch4/tools/config/BUILD:12:1: no such package 'tools/toolchain': BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.
 - /home/sergei.vorobev/src/pytorch4/tools/toolchain and referenced by '//tools/config:cuda_enabled_and_capable'
ERROR: While resolving configuration keys for //:c10: Analysis failed
ERROR: Analysis of target '//:c10' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.259s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (2 packages loaded, 2 targets configured)
```

After:
```
sergei.vorobev@cs-sv7xn77uoy-gpu-1628706590:~/src/pytorch4$ bazelisk build --define=cuda=true //:c10
INFO: Analyzed target //:c10 (6 packages loaded, 246 targets configured).
INFO: Found 1 target...
Target //:c10 up-to-date:
  bazel-bin/libc10.lo
  bazel-bin/libc10.so
INFO: Elapsed time: 0.617s, Critical Path: 0.04s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
```

The `//:c10` target is a good testing one for this, because it has such cases where the [glob is different](075024b9a3/BUILD.bazel (L76-L81)), based on do we compile for CUDA or not.

## What is out of scope of this PR

This PR is a first in a series of providing the comprehensive GPU bazel build support. Namely, we don't tackle the [cu_library](11a40ad915/tools/rules/cu.bzl (L2)) implementation here. This would be a separate large chunk of work.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/63604

Reviewed By: soulitzer

Differential Revision: D30442083

Pulled By: malfet

fbshipit-source-id: b2a8e4f7e5a25a69b960a82d9e36ba568eb64595
2021-08-27 09:33:42 -07:00
Andres Suarez
684589e8e0 [codemod][fbcode][1/n] Apply buildifier
Test Plan: Manual inspection. Sandcastle.

Reviewed By: karlodwyer, zsol

Differential Revision: D27702434

fbshipit-source-id: ee7498331c51daf44a29f2de452e3b02488b9af3
2021-04-12 11:04:32 -07:00
Stanislau Hlebik
b774ce54f8 remediation of S205607
fbshipit-source-id: 798decc90db4f13770e97cdce3c0df7d5421b2a3
2020-07-17 17:19:47 -07:00
Stanislau Hlebik
8fdea489af remediation of S205607
fbshipit-source-id: 5113fe0c527595e4227ff827253b7414abbdf7ac
2020-07-17 17:17:03 -07:00
George Gensure
447bcd341d Bazel build of pytorch with gating CI (#36011)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/36011

Differential Revision: D20873430

Pulled By: malfet

fbshipit-source-id: 8ffffd10ca0ff8bdab578a70a9b2b777aed985d0
2020-04-06 22:50:33 -07:00
Nikita Shulga
6be9c77998 Revert D20783179: [pytorch][PR] Bazel build of pytorch
Test Plan: revert-hammer

Differential Revision:
D20783179

Original commit changeset: b160908a3e10

fbshipit-source-id: 5b7b36305525e7ccc49540b48991149cf0a759f4
2020-04-03 17:59:10 -07:00
George Gensure
585f153d00 Bazel build of pytorch (#35220)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/35220

Reviewed By: seemethere

Differential Revision: D20783179

Pulled By: malfet

fbshipit-source-id: b160908a3e107790fa06057a77de9d6d23493bbc
2020-04-03 17:13:58 -07:00