Skip to content

Commit

Permalink
Apply UFMT to all non test/torch files (pytorch#106205)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezyang authored and pytorchmergebot committed Jul 29, 2023
1 parent 1163800 commit e6ec0ef
Show file tree
Hide file tree
Showing 51 changed files with 1,669 additions and 939 deletions.
56 changes: 0 additions & 56 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -908,62 +908,6 @@ exclude_patterns = [
'third_party/**/*.pyi',
# These files are all grandfathered in, feel free to remove from this list
# as necessary
'aten/src/ATen/function_wrapper.py',
'aten/src/ATen/native/quantized/cpu/qnnpack/configure.py',
'aten/src/ATen/native/quantized/cpu/qnnpack/deps/clog/configure.py',
'aten/src/ATen/native/quantized/cpu/qnnpack/generate-wrapper.py',
'aten/src/ATen/native/transformers/cuda/mem_eff_attention/kernels/generate_kernels.py',
'aten/src/ATen/nnapi/codegen.py',
'functorch/__init__.py',
'functorch/_src/__init__.py',
'functorch/_src/aot_autograd/__init__.py',
'functorch/_src/eager_transforms/__init__.py',
'functorch/_src/make_functional/__init__.py',
'functorch/_src/vmap/__init__.py',
'functorch/benchmarks/chrome_trace_parser.py',
'functorch/benchmarks/cse.py',
'functorch/benchmarks/operator_authoring.py',
'functorch/benchmarks/per_sample_grads.py',
'functorch/benchmarks/pointwise_scorecard.py',
'functorch/benchmarks/process_scorecard.py',
'functorch/compile/__init__.py',
'functorch/dim/__init__.py',
'functorch/dim/batch_tensor.py',
'functorch/dim/delayed_mul_tensor.py',
'functorch/dim/dim.py',
'functorch/dim/magic_trace.py',
'functorch/dim/op_properties.py',
'functorch/dim/reference.py',
'functorch/dim/tree_map.py',
'functorch/dim/wrap_type.py',
'functorch/docs/source/conf.py',
'functorch/einops/__init__.py',
'functorch/einops/_parsing.py',
'functorch/einops/rearrange.py',
'functorch/examples/compilation/eager_fusion.py',
'functorch/examples/compilation/fuse_module.py',
'functorch/examples/compilation/linear_train.py',
'functorch/examples/compilation/simple_function.py',
'functorch/examples/dp_cifar10/cifar10_opacus.py',
'functorch/examples/dp_cifar10/cifar10_transforms.py',
'functorch/examples/ensembling/parallel_train.py',
'functorch/examples/lennard_jones/lennard_jones.py',
'functorch/examples/maml_omniglot/maml-omniglot-higher.py',
'functorch/examples/maml_omniglot/maml-omniglot-ptonly.py',
'functorch/examples/maml_omniglot/maml-omniglot-transforms.py',
'functorch/examples/maml_omniglot/support/omniglot_loaders.py',
'functorch/examples/maml_regression/evjang.py',
'functorch/examples/maml_regression/evjang_transforms.py',
'functorch/examples/maml_regression/evjang_transforms_module.py',
'functorch/experimental/__init__.py',
'functorch/experimental/_cond.py',
'functorch/experimental/_map.py',
'functorch/experimental/control_flow.py',
'functorch/experimental/ops.py',
'functorch/notebooks/_src/plot_ensembling.py',
'functorch/notebooks/_src/plot_jacobians_and_hessians.py',
'functorch/notebooks/_src/plot_per_sample_gradients.py',
'functorch/op_analysis/gen_data.py',
'test/_nvfuser/__init__.py',
'test/_nvfuser/test_dynamo.py',
'test/_nvfuser/test_python_frontend.py',
Expand Down
3 changes: 0 additions & 3 deletions aten/src/ATen/native/quantized/cpu/qnnpack/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def main(args):
],
extra_include_dirs="src",
):

requantization_objects = [
build.cc("requantization/precise-scalar.c"),
build.cc("requantization/fp32-scalar.c"),
Expand Down Expand Up @@ -192,7 +191,6 @@ def main(args):
},
extra_include_dirs=["src", "test"],
):

build.unittest("hgemm-test", build.cxx("hgemm.cc"))
build.unittest("q8avgpool-test", build.cxx("q8avgpool.cc"))
build.unittest("q8conv-test", build.cxx("q8conv.cc"))
Expand Down Expand Up @@ -252,7 +250,6 @@ def main(args):
isa=benchmark_isa,
extra_include_dirs="src",
):

build.benchmark("add-bench", build.cxx("add.cc"))
build.benchmark("average-pooling-bench", build.cxx("average-pooling.cc"))
build.benchmark("channel-shuffle-bench", build.cxx("channel-shuffle.cc"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# LICENSE file in the root directory of this source tree.

import confu

parser = confu.standard_parser("clog configuration script")


Expand All @@ -19,13 +20,16 @@ def main(args):
with build.options(source_dir="src", extra_include_dirs="src"):
build.static_library("clog", build.cc("clog.c"))

with build.options(source_dir="test", deps={
(build, build.deps.googletest): all,
"log": build.target.is_android}):
with build.options(
source_dir="test",
deps={(build, build.deps.googletest): all, "log": build.target.is_android},
):
build.unittest("clog-test", build.cxx("clog.cc"))

return build


if __name__ == "__main__":
import sys

main(sys.argv[1:]).generate()
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
# Kernels are ordered (see `sort_index`), and when dispatching,
# we select the first kernel in the list that supports the inputs

import argparse
import collections
import itertools
from dataclasses import dataclass, field
from pathlib import Path
from typing import Dict, List, Optional, Tuple, TypeVar
import argparse

DTYPES = {
"f32": "float",
Expand Down Expand Up @@ -303,7 +303,11 @@ def get_all(cls) -> List["BwdKernel"]:


def write_decl_impl(
kernels: List[T], family_name: str, impl_file: str, autogen_dir: Path, disable_def: str = None
kernels: List[T],
family_name: str,
impl_file: str,
autogen_dir: Path,
disable_def: str = None,
) -> None:
cpp_file_header = """/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
Expand Down Expand Up @@ -382,22 +386,28 @@ def main(output_dir: Optional[str]) -> None:
FwdKernel.get_all(),
"cutlassF",
impl_file="<ATen/native/transformers/cuda/mem_eff_attention/kernel_forward.h>",
autogen_dir=output_dir
autogen_dir=output_dir,
)
write_decl_impl(
BwdKernel.get_all(),
"cutlassB",
impl_file="<ATen/native/transformers/cuda/mem_eff_attention/kernel_backward.h>",
autogen_dir=output_dir
autogen_dir=output_dir,
)


if __name__ == "__main__":
parser = argparse.ArgumentParser(
prog='generate_kernels',
description='Generate the mem-eff kernels template instantiations')
prog="generate_kernels",
description="Generate the mem-eff kernels template instantiations",
)
# Set an optional output directory
parser.add_argument('-o', '--output_dir', required=False, help="Where to generate the kernels "
" will default to <ATen/native/transformers/cuda/mem_eff_attention/kernels/> ")
parser.add_argument(
"-o",
"--output_dir",
required=False,
help="Where to generate the kernels "
" will default to <ATen/native/transformers/cuda/mem_eff_attention/kernels/> ",
)
args = parser.parse_args()
main(args.output_dir)
Loading

0 comments on commit e6ec0ef

Please sign in to comment.