-
Notifications
You must be signed in to change notification settings - Fork 658
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* disable backward pass consistent tensor meta check. (#5871) * disable backward pass consistent tensor meta check. * auto format by CI Co-authored-by: binbinHan <han_binbin@163.com> Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> Co-authored-by: oneflow-ci-bot <ci-bot@oneflow.org> * ddp broadcast params and buffers (#5913) * ddp broadcast params and buffers Signed-off-by: daquexian <daquexian566@gmail.com> * auto format by CI Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> Co-authored-by: oneflow-ci-bot <ci-bot@oneflow.org> * add clang tidy target (#5957) * add clang tidy target * fix a bug * refine * refine * reformat Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> * cfg: add move assignment operator for performance (#5962) Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> * add zhangshen op-test (#5600) * add some op-test * fix dims_error in my branch * Fix the bad backward kernel function by using 'cuda::atomic::Add' (#5614) * Test `nn.AdaptiveAvgPoolXd` (#5615) * Fix the bad backward kernel function by using 'cuda::atomic::Add' * Support the 'NoneType' annotation * Support objects of 'collections.abc.Iterable' as 'output_size' * Test with all cases of 'output_size' * Update adaptive_pool_gpu_kernel.cu * Skip testing `nn.AdaptiveAvgPool3d` for the current PyTorch * remove some useless test * Format TODO * Add the assertion messages for 'output_size' * Reformat codes * Remove raw tests for `flow.negative` * Remove unnecessary codes and add the assertion messages * Merge updates for 'generators.py' from master * Remove unnecessary 'random()' * Delete the separate test for `AvgPool2d` * Fix import paths * Fix import problems * Remove the PyTorch import * Denote the annotations for `tile` and `repeat` ops * Add the test for `nn.AvgPool1d` * Choose better generators for `nn.MaxPoolXd` * Randomly choose `dilation` and default values * auto format by CI * Test more kwargs for `nn.AvgPoolXd` * Add tests for `return_indices` * auto format by CI Co-authored-by: Tianyu Zhao <guikarist@gmail.com> Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> Co-authored-by: oneflow-ci-bot <ci-bot@oneflow.org> * fix wrong names (#5951) * fix wrong names * auto format by CI * refine * auto format by CI Co-authored-by: oneflow-ci-bot <ci-bot@oneflow.org> Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> * Enable more checkers for clang-tidy in CI (#5738) * CI: enable more checkers for clang-tidy * .clang-tidy: remove cppcoreguidelines-pro-type-vararg * CI: remove duplicate checkers * CI: remove clang-analyzer-alpha.deadcode.* * .clang-tidy: add performance-* * oneflow/core/eager: remove unnecessary malloc & free * .clang-tidy: add clang-analyzer-cplusplus.* to werror * user_kernel: remove useless move * quantization_aware_training: fix move return * .clang-tidy: add google-* * CI: fix clang tidy command * CI: fix test Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> * Feat grad mode classes (#5956) * feat(no_grad): support no_grad decorator * feat(AutogradMode): export flow.autograd_mode * feat(GradMode): export some grad_mode class * docs(GradMode): export documents * refine * docs(GradMode): export document for is_grad_enabled * auto format by CI * fix(GradMode): fix single client bug * fix bug Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> Co-authored-by: oneflow-ci-bot <ci-bot@oneflow.org> * extract_consistent_to_consistent_op_expr (#5870) * abstract_consistent_to_consistent_op_expr * fix compiler complaint * refactor consistent-to-consistent eager consisitent op interpreter * fix compiler complaint * refactor ConsistentToConsistentOpExpr * lazy interpreter (#5903) * fix bugs about consistent_id * refactor functional::ToConsistent * refactor GetNdSbp * Update eager_consistent_op_interpreter.cpp * Update eager_mirrored_op_interpreter.cpp * fix error * fix error * auto format by CI * Update nd_sbp.h * refine identity boxing * fix sync checkmeta error * avoid consistent id check in lazy Co-authored-by: Xinqi Li <lixinqi0703106@163.com> Co-authored-by: leaves-zwx <kunta0932@gmail.com> Co-authored-by: Li Xinqi <lixinqi2010@gmail.com> Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> Co-authored-by: oneflow-ci-bot <ci-bot@oneflow.org> * add CMAKE_INTERPROCEDURAL_OPTIMIZATION in fast cmake cache (#5970) * add CMAKE_INTERPROCEDURAL_OPTIMIZATION in fast cmake cache * skip test targets of re2 Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> * check: fix clang-tidy-diff commands (#5972) * check: fix clang-tidy-diff commands * CI: fix step names Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> * Cpu mpi (#5865) * cuda base cpu mpi boxing * cpu_mpi * fix conflicts * add cpu mpi unittests * more checks and unittests * abstract_consistent_to_consistent_op_expr * fix compiler complaint * refactor consistent-to-consistent eager consisitent op interpreter * fix compiler complaint * refactor ConsistentToConsistentOpExpr * lazy interpreter (#5903) * fix bugs about consistent_id * more test_consistent_cast unittests * refactor functional::ToConsistent * refactor GetNdSbp * fix compiler complaints * refactor GetDevice4CurrentProcessCtx * fix error Co-authored-by: clackhan <han_binbin@163.com> Co-authored-by: leaves-zwx <kunta0932@gmail.com> Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> * fix_bug_test_tensor_str (#5958) * fix bug int test_tensor_str * format * fix comment * fix bug to(cuda) is unavailable in cpu env Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> * common/error: fix build error in mac (#5971) Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> * Prevent running oneflow in forked subprocess (#5976) * prevent_running_oneflow_in_forked_subprocess * add line change * IsFork => IsForkedSubProcess * auto format by CI Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> Co-authored-by: oneflow-ci-bot <ci-bot@oneflow.org> * refine randint Co-authored-by: Li Xinqi <lixinqi2010@gmail.com> Co-authored-by: binbinHan <han_binbin@163.com> Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> Co-authored-by: oneflow-ci-bot <ci-bot@oneflow.org> Co-authored-by: daquexian <daquexian566@gmail.com> Co-authored-by: Peihong Liu <mosout@qq.com> Co-authored-by: Twice <i@twice.moe> Co-authored-by: ZhangShen <55383772+zhangshen12356@users.noreply.github.com> Co-authored-by: Tianyu Zhao <guikarist@gmail.com> Co-authored-by: Luyang <flowingsun007@163.com> Co-authored-by: Yinggang Wang <wyg19970408@gmail.com> Co-authored-by: Xinqi Li <lixinqi0703106@163.com> Co-authored-by: leaves-zwx <kunta0932@gmail.com> Co-authored-by: Shenghang Tsai <jackalcooper@gmail.com> Co-authored-by: liufengwei0103 <2472937968@qq.com>
- Loading branch information
1 parent
038320c
commit 671f4f5
Showing
92 changed files
with
1,943 additions
and
2,377 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
# maybe-* checks are only available on OneFlow custom clang-tidy and clangd | ||
Checks: '-*, maybe-*' | ||
# `maybe-*` checks are only available on OneFlow custom clang-tidy and clangd | ||
# `-allow-enabling-analyzer-alpha-checkers` should be passed to clang-tidy for CSA checkers named `clang-analyzer-alpha.*` (or `-allow-enabling-alpha-checkers` for run-clang-tidy.py) | ||
# `aggressive-binary-operation-simplification` should be enabled (via `-Xclang -analyzer-config -Xclang aggressive-binary-operation-simplification=true` in clang) | ||
# there is some problem in `clang-analyzer-alpha.clone.*`, so do not enable it | ||
# `clang-analyzer-alpha.deadcode.*` is just too verbose to enable | ||
Checks: '-*, maybe-*, clang-analyzer-core.*, clang-analyzer-cplusplus.*, clang-analyzer-nullability.*, clang-analyzer-deadcode.*, clang-analyzer-security.*, clang-analyzer-optin.cplusplus.*, clang-analyzer-optin.performance.*, clang-analyzer-alpha.core.*, clang-analyzer-alpha.cplusplus.*, clang-analyzer-alpha.security.*, cppcoreguidelines-avoid-goto, cppcoreguidelines-init-variables, cppcoreguidelines-interfaces-global-init, cppcoreguidelines-no-malloc, cppcoreguidelines-prefer-member-initializer, cppcoreguidelines-pro-type-member-init, cppcoreguidelines-pro-type-static-cast-downcast, cppcoreguidelines-slicing, cppcoreguidelines-special-member-functions, performance-unnecessary-value-param, performance-unnecessary-copy-initialization, performance-noexcept-move-constructor, performance-no-automatic-move, performance-move-const-arg, performance-implicit-conversion-in-loop, performance-for-range-copy, google-default-arguments, google-global-names-in-headers, google-explicit-constructor' | ||
# TODO: treat all maybe warnings as errors when existing warnings are all fixed | ||
WarningsAsErrors: 'maybe-unused' | ||
WarningsAsErrors: 'maybe-unused, clang-analyzer-nullability.*, clang-analyzer-cplusplus.*, performance-implicit-conversion-in-loop, performance-move-const-arg, performance-no-automatic-move, performance-noexcept-move-constructor, google-default-arguments, google-global-names-in-headers' | ||
|
||
CheckOptions: | ||
# `cppcoreguidelines-special-member-functions` is enabled, refer to https://en.cppreference.com/w/cpp/language/rule_of_three | ||
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor | ||
value: True | ||
- key: performance-move-const-arg.CheckTriviallyCopyableMove | ||
value: False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/usr/bin/env python2 | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
import asyncio | ||
import argparse | ||
import subprocess | ||
import os | ||
|
||
|
||
def split_and_print(prefix, text): | ||
lines = text.decode().splitlines(keepends=True) | ||
prefixed = "" | ||
for l in lines: | ||
prefixed += f"{prefix} {l.strip()}" | ||
if l.strip(): | ||
print(prefixed, flush=True) | ||
|
||
|
||
async def handle_stream(stream, cb): | ||
while True: | ||
line = await stream.readline() | ||
if line: | ||
cb(line) | ||
else: | ||
break | ||
|
||
|
||
async def run_command(cmd=None, dry=False, name=None): | ||
if dry: | ||
print(f"[dry] {cmd}") | ||
return 0 | ||
process = await asyncio.create_subprocess_shell( | ||
cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, | ||
) | ||
l = lambda x: split_and_print(f"[{name}]" if name else "", x) | ||
await asyncio.gather( | ||
handle_stream(process.stdout, l), handle_stream(process.stderr, l), | ||
) | ||
await process.wait() | ||
return process.returncode | ||
|
||
|
||
def download(build_dir, dry=False): | ||
urls = [ | ||
"https://github.com/Oneflow-Inc/llvm-project/releases/download/latest/clang-tidy-489012f-x86_64.AppImage" | ||
if os.getenv("CI") | ||
else "https://oneflow-static.oss-cn-beijing.aliyuncs.com/bin/clang-tidy/linux-x86_64/clang-tidy.AppImage", | ||
"https://raw.githubusercontent.com/oneflow-inc/llvm-project/maybe/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py", | ||
] | ||
dst_dir = f"{build_dir}/cache/bin" | ||
dst = [f"{dst_dir}/clang-tidy", f"{dst_dir}/clang-tidy-diff.py"] | ||
if dry: | ||
if os.path.isfile(dst[0]) and os.path.isfile(dst[1]): | ||
return dst | ||
else: | ||
None | ||
else: | ||
assert subprocess.call(f"mkdir -p {dst_dir}", shell=True) == 0 | ||
for i, _dst in enumerate(dst): | ||
assert subprocess.call(f"curl -L {urls[i]} -o {_dst}", shell=True) == 0 | ||
assert subprocess.call(f"chmod +x {_dst}", shell=True) == 0 | ||
return dst | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser( | ||
description="Runs clang-tidy on all of the source files." | ||
) | ||
parser.add_argument( | ||
"--build_dir", required=True, | ||
) | ||
args = parser.parse_args() | ||
loop = asyncio.get_event_loop() | ||
downloaded = download(args.build_dir, dry=True) | ||
if downloaded is None: | ||
downloaded = download(args.build_dir) | ||
promises = [ | ||
run_command( | ||
f"cd .. && git diff -U0 master | {downloaded[1]} -clang-tidy-binary {downloaded[0]} -path {args.build_dir} -j $(nproc) -p1 -allow-enabling-alpha-checkers -extra-arg=-Xclang -extra-arg=-analyzer-config -extra-arg=-Xclang -extra-arg=aggressive-binary-operation-simplification=true" | ||
) | ||
] | ||
loop.run_until_complete(asyncio.gather(*promises)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.