Skip to content

Conversation

1ntEgr8
Copy link
Contributor

@1ntEgr8 1ntEgr8 commented Jul 12, 2021

Summary:

This PR opts in to using v11.1.0 of clang's builtin includes. It does this by copying (instead of symlinking) our custom build clang-tidy binary. As per this document, clang looks for its builtin includes relative to the location of the binary. By copying it into /usr/bin, we ensure that it cannot pick up our custom built headers which are located at /clang-tidy-checks/build/lib/include/clang/11.0.0/include. The clang-tidy runner script ensures that it will pick up the v11.1.0 header files.

Test Plan:

  1. Build a docker image, and start an interactive session
docker build . -t ct-no-header-conflicts -f ci-docker-base/Dockerfile.cilint-clang-tidy
docker run -it ct-no-header-conflicts /bin/bash
  1. Clone pytorch and run clang-tidy on torch/csrc/autograd/profiler_kineto.cpp
git clone --depth 1 https://github.com/pytorch/pytorch
cd pytorch
python3 -m tools.linter.clang_tidy -p torch/csrc/autograd/profiler_kineto.cpp -v

You should see no clang-diagnostic-errors, thereby fixing the failed run observed in https://github.com/pytorch/pytorch/pull/61478/checks?check_run_id=3033608896

1ntEgr8 added 2 commits July 12, 2021 11:24
The docker image has two versions of clang header files: v11.1.0 and v11.0.0.
This leads to issues when running clang-tidy on pytorch because there is a
header file conflict. To fix this problem, we opt into using v11.1.0.
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 12, 2021
Copy link
Contributor

@janeyx99 janeyx99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trusting you ran the commands and it worked and am currently running them now on my machine, but will approve before I see results on my end

@1ntEgr8 1ntEgr8 merged commit d8f0c77 into pytorch:master Jul 12, 2021
facebook-github-bot pushed a commit to pytorch/pytorch that referenced this pull request Jul 12, 2021
Summary:
Fixes recent `clang-diagnostic-errors` on clang-tidy runs

See pytorch/test-infra#59

Pull Request resolved: #61545

Reviewed By: malfet, seemethere

Differential Revision: D29664061

Pulled By: 1ntEgr8

fbshipit-source-id: cca482a8774e34e61919f2298846ae0b479bf224
@malfet
Copy link
Contributor

malfet commented Jul 12, 2021

This will definitely work for docker images, but it will make it almost impossible to run those checks locally

@1ntEgr8
Copy link
Contributor Author

1ntEgr8 commented Jul 12, 2021

@malfet Why so? We aren't hard-coding v11.1.0. The clang-tidy script in pytorch/pytorch will ensure that the clang builtin includes are on the include path https://github.com/pytorch/pytorch/blob/master/tools/linter/clang_tidy/__main__.py#L14-L47 (if clang exists on the system)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants