Skip to content

Commit 58b16e0

Browse files
committed
Update on "Add OpInfo test to check that floating point inputs in OpInfos have requires_grad set to True"
This test detected a number of sampling methods that were not generating the samples as expected, e.g. `index_put`, `cosine_embedding`, `stft`, but perhaps most notably the generator for `BinOps`. It also detected that `reminder` and `fmod` did not have implemented the backward formula for the second input. I added this in the previous PR. [ghstack-poisoned]
2 parents 7fd0bd7 + fb7e489 commit 58b16e0

File tree

724 files changed

+23241
-12855
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

724 files changed

+23241
-12855
lines changed

.circleci/docker/common/install_conda.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ if [ -n "$ANACONDA_PYTHON_VERSION" ]; then
120120
# Install numba only on python-3.8 or below
121121
# For numba issue see https://github.com/pytorch/pytorch/issues/51511
122122
if [[ $(python -c "import sys; print(int(sys.version_info < (3, 9)))") == "1" ]]; then
123-
as_jenkins pip install --progress-bar off numba librosa>=0.6.2
123+
as_jenkins pip install --progress-bar off numba==0.54.1 librosa>=0.6.2
124124
else
125125
as_jenkins pip install --progress-bar off numba==0.49.0 librosa>=0.6.2
126126
fi

.circleci/scripts/binary_populate_env.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ tagged_version() {
66
# Grabs version from either the env variable CIRCLE_TAG
77
# or the pytorch git described version
88
if [[ "$OSTYPE" == "msys" ]]; then
9-
GIT_DESCRIBE="git --git-dir ${workdir}/p/.git describe"
9+
GIT_DIR="${workdir}/p/.git"
1010
else
11-
GIT_DESCRIBE="git --git-dir ${workdir}/pytorch/.git describe"
11+
GIT_DIR="${workdir}/pytorch/.git"
1212
fi
13+
GIT_DESCRIBE="git --git-dir ${GIT_DIR} describe --tags --match v[0-9]*.[0-9]*.[0-9]*"
1314
if [[ -n "${CIRCLE_TAG:-}" ]]; then
1415
echo "${CIRCLE_TAG}"
15-
elif ${GIT_DESCRIBE} --exact --tags >/dev/null; then
16-
${GIT_DESCRIBE} --tags
16+
elif ${GIT_DESCRIBE} --exact >/dev/null; then
17+
${GIT_DESCRIBE}
1718
else
1819
return 1
1920
fi

.github/generated-ciflow-ruleset.json

Lines changed: 16 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/merge_rules.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[
2+
{
3+
"name": "ONNX exporter",
4+
"patterns": ["torch/onnx/**", "torch/csrc/jit/passes/onnx/**", "torch/csrc/jit/passes/onnx.*", "test/onnx/**", "docs/source/onnx.rst"],
5+
"approved_by": ["garymm"],
6+
"mandatory_app_id": 12274
7+
},
8+
{
9+
"name": "NVFuser",
10+
"patterns": ["torch/csrc/jit/codegen/fuser/cuda/**", "torch/csrc/jit/codegen/cuda/**", "benchmarks/cpp/nvfuser/**"],
11+
"approved_by": ["csarofeen", "ngimel"],
12+
"mandatory_app_id": 12274
13+
},
14+
{
15+
"name": "OSS CI",
16+
"patterns": [".github/**", ".circleci/**", ".jenkins/**"],
17+
"approved_by": ["seemethere", "malfet", "suo"],
18+
"mandatory_app_id": 12274
19+
}
20+
]

.github/scripts/generate_binary_build_matrix.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
CUDA_ARCHES = ["10.2", "11.1", "11.3", "11.5"]
1717

1818

19-
ROCM_ARCHES = ["4.2", "4.3.1"]
19+
ROCM_ARCHES = ["4.3.1", "4.5.2"]
2020

2121

2222
def arch_type(arch_version: str) -> str:
@@ -65,6 +65,7 @@ def arch_type(arch_version: str) -> str:
6565
"3.7",
6666
"3.8",
6767
"3.9",
68+
"3.10"
6869
]
6970

7071

.github/scripts/generate_ci_workflows.py

Lines changed: 52 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,22 @@
2929
LINUX_CPU_TEST_RUNNER = "linux.2xlarge"
3030
# contains 1 gpu
3131
LINUX_CUDA_TEST_RUNNER = "linux.4xlarge.nvidia.gpu"
32+
# contains 4 gpus
33+
LINUX_ROCM_TEST_RUNNER = "linux.rocm.gpu"
3234
LINUX_RUNNERS = {
3335
LINUX_CPU_TEST_RUNNER,
3436
LINUX_CUDA_TEST_RUNNER,
37+
LINUX_ROCM_TEST_RUNNER,
38+
}
39+
40+
LINUX_DISTRIBUTED_GPU_RUNNERS = {
41+
LINUX_CUDA_TEST_RUNNER : "linux.8xlarge.nvidia.gpu",
42+
LINUX_ROCM_TEST_RUNNER : LINUX_ROCM_TEST_RUNNER,
43+
}
44+
45+
LINUX_MULTIGPU_RUNNERS = {
46+
LINUX_CUDA_TEST_RUNNER : "linux.16xlarge.nvidia.gpu",
47+
LINUX_ROCM_TEST_RUNNER : LINUX_ROCM_TEST_RUNNER,
3548
}
3649

3750
MACOS_TEST_RUNNER_10_15 = "macos-10.15"
@@ -46,6 +59,9 @@
4659
WINDOWS_CUDA_TEST_RUNNER,
4760
LINUX_CUDA_TEST_RUNNER,
4861
}
62+
ROCM_RUNNERS = {
63+
LINUX_ROCM_TEST_RUNNER,
64+
}
4965
CPU_RUNNERS = {
5066
WINDOWS_CPU_TEST_RUNNER,
5167
LINUX_CPU_TEST_RUNNER,
@@ -55,6 +71,7 @@
5571
LABEL_CIFLOW_BAZEL = "ciflow/bazel"
5672
LABEL_CIFLOW_CPU = "ciflow/cpu"
5773
LABEL_CIFLOW_CUDA = "ciflow/cuda"
74+
LABEL_CIFLOW_ROCM = "ciflow/rocm"
5875
LABEL_CIFLOW_DOCS = "ciflow/docs"
5976
LABEL_CIFLOW_DEFAULT = "ciflow/default"
6077
LABEL_CIFLOW_LIBTORCH = "ciflow/libtorch"
@@ -76,56 +93,25 @@
7693
LABEL_CIFLOW_MACOS = "ciflow/macos"
7794
LABEL_CIFLOW_TRUNK = "ciflow/trunk"
7895
LABEL_CIFLOW_BINARIES = "ciflow/binaries"
79-
LABEL_CIFLOW_BINARIES_WHEEL = "ciflow/binaries/wheel"
80-
LABEL_CIFLOW_BINARIES_CONDA = "ciflow/binaries/conda"
81-
LABEL_CIFLOW_BINARIES_LIBTORCH = "ciflow/binaries/libtorch"
96+
LABEL_CIFLOW_BINARIES_WHEEL = "ciflow/binaries_wheel"
97+
LABEL_CIFLOW_BINARIES_CONDA = "ciflow/binaries_conda"
98+
LABEL_CIFLOW_BINARIES_LIBTORCH = "ciflow/binaries_libtorch"
8299

83100

84101
@dataclass
85102
class CIFlowConfig:
86103
# For use to enable workflows to run on pytorch/pytorch-canary
87104
run_on_canary: bool = False
88105
labels: Set[str] = field(default_factory=set)
89-
trigger_action: str = 'unassigned'
90-
trigger_actor: str = 'pytorchbot'
91-
root_job_condition: str = ''
92-
label_conditions: str = ''
93106
# Certain jobs might not want to be part of the ciflow/[all,trunk] workflow
94107
isolated_workflow: bool = False
95108

96-
def gen_root_job_condition(self) -> None:
97-
# CIFlow conditions:
98-
# - Workflow should always run on push
99-
# - CIFLOW_DEFAULT workflows should run on PRs even if no `ciflow/` labels on PR
100-
# - Otherwise workflow should be scheduled on all qualifying events
101-
label_conditions = [f"contains(github.event.pull_request.labels.*.name, '{label}')" for label in sorted(self.labels)]
102-
self.label_conditions = ' || '.join(label_conditions)
103-
repo_condition = "github.repository_owner == 'pytorch'" if self.run_on_canary else "github.repository == 'pytorch/pytorch'"
104-
push_event = "github.event_name == 'push'"
105-
scheduled_event = "github.event_name == 'schedule'"
106-
pr_updated_event = f"github.event_name == 'pull_request' && github.event.action != '{self.trigger_action}'"
107-
if LABEL_CIFLOW_DEFAULT in self.labels:
108-
run_with_no_labels = f"({pr_updated_event}) && " \
109-
f"!contains(join(github.event.pull_request.labels.*.name), '{LABEL_CIFLOW_PREFIX}')"
110-
else:
111-
run_with_no_labels = "false"
112-
self.root_job_condition = f"${{{{ ({repo_condition}) && (\n" \
113-
f" ({push_event}) ||\n" \
114-
f" ({scheduled_event}) ||\n" \
115-
f" ({self.label_conditions}) ||\n" \
116-
f" ({run_with_no_labels}))\n"\
117-
f" }}}}"
118-
119-
def reset_root_job(self) -> None:
120-
self.root_job_condition = ''
121-
122109
def __post_init__(self) -> None:
123110
if not self.isolated_workflow:
124111
self.labels.add(LABEL_CIFLOW_ALL)
125112
if LABEL_CIFLOW_SCHEDULED not in self.labels:
126113
self.labels.add(LABEL_CIFLOW_TRUNK)
127114
assert all(label.startswith(LABEL_CIFLOW_PREFIX) for label in self.labels)
128-
self.gen_root_job_condition()
129115

130116

131117
@dataclass
@@ -164,6 +150,8 @@ class CIWorkflow:
164150

165151
# Optional fields
166152
test_runner_type: str = ''
153+
multigpu_runner_type: str = ''
154+
distributed_gpu_runner_type: str = ''
167155
ciflow_config: CIFlowConfig = field(default_factory=CIFlowConfig)
168156
cuda_version: str = ''
169157
docker_image_base: str = ''
@@ -172,13 +160,15 @@ class CIWorkflow:
172160
build_generates_artifacts: bool = True
173161
build_with_debug: bool = False
174162
is_scheduled: str = ''
163+
is_default: bool = False
175164
num_test_shards: int = 1
176165
only_run_smoke_tests_on_pull_request: bool = False
177166
num_test_shards_on_pull_request: int = -1
178167
distributed_test: bool = True
179168
fx2trt_test: bool = False
180169
timeout_after: int = 240
181170
xcode_version: str = ''
171+
only_on_pr: bool = False
182172

183173
# The following variables will be set as environment variables,
184174
# so it's easier for both shell and Python scripts to consume it if false is represented as the empty string.
@@ -205,6 +195,12 @@ def __post_init__(self) -> None:
205195
if self.fx2trt_test:
206196
self.enable_fx2trt_test = 1
207197

198+
self.multigpu_runner_type = LINUX_MULTIGPU_RUNNERS.get(self.test_runner_type, "linux.16xlarge.nvidia.gpu")
199+
self.distributed_gpu_runner_type = LINUX_DISTRIBUTED_GPU_RUNNERS.get(self.test_runner_type, "linux.8xlarge.nvidia.gpu")
200+
201+
if LABEL_CIFLOW_DEFAULT in self.ciflow_config.labels:
202+
self.is_default = True
203+
208204
# If num_test_shards_on_pull_request is not user-defined, default to num_test_shards unless we are
209205
# only running smoke tests on the pull request.
210206
if self.num_test_shards_on_pull_request == -1:
@@ -223,7 +219,6 @@ def assert_valid(self) -> None:
223219
assert self.test_runner_type in WINDOWS_RUNNERS, err_message
224220

225221
assert LABEL_CIFLOW_ALL in self.ciflow_config.labels
226-
assert LABEL_CIFLOW_ALL in self.ciflow_config.label_conditions
227222
if self.arch == 'linux':
228223
assert LABEL_CIFLOW_LINUX in self.ciflow_config.labels
229224
if self.arch == 'windows':
@@ -235,6 +230,8 @@ def assert_valid(self) -> None:
235230
assert self.test_runner_type != ''
236231
if self.test_runner_type in CUDA_RUNNERS:
237232
assert LABEL_CIFLOW_CUDA in self.ciflow_config.labels
233+
if self.test_runner_type in ROCM_RUNNERS:
234+
assert LABEL_CIFLOW_ROCM in self.ciflow_config.labels
238235
if self.test_runner_type in CPU_RUNNERS and not self.exclude_test:
239236
assert LABEL_CIFLOW_CPU in self.ciflow_config.labels
240237
if self.is_scheduled:
@@ -576,6 +573,17 @@ def generate_workflow_file(self, workflow_template: jinja2.Template) -> None:
576573
labels=set([LABEL_CIFLOW_DEFAULT, LABEL_CIFLOW_LINUX, LABEL_CIFLOW_CPU]),
577574
),
578575
),
576+
CIWorkflow(
577+
arch="linux",
578+
build_environment="linux-bionic-rocm4.5-py3.7",
579+
docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-bionic-rocm4.5-py3.7",
580+
test_runner_type=LINUX_ROCM_TEST_RUNNER,
581+
num_test_shards=2,
582+
only_on_pr=True,
583+
ciflow_config=CIFlowConfig(
584+
labels=set([LABEL_CIFLOW_LINUX, LABEL_CIFLOW_ROCM]),
585+
),
586+
),
579587
CIWorkflow(
580588
arch="linux",
581589
build_environment="libtorch-linux-xenial-cuda11.3-py3.7-gcc7",
@@ -619,8 +627,10 @@ def generate_workflow_file(self, workflow_template: jinja2.Template) -> None:
619627
num_test_shards=2,
620628
distributed_test=False,
621629
enable_noarch_test=1,
630+
# Disabled, see https://github.com/pytorch/pytorch/issues/71732
631+
# enable_xla_test=1,
622632
ciflow_config=CIFlowConfig(
623-
labels={LABEL_CIFLOW_DEFAULT, LABEL_CIFLOW_LINUX, LABEL_CIFLOW_CPU, LABEL_CIFLOW_NOARCH},
633+
labels={LABEL_CIFLOW_DEFAULT, LABEL_CIFLOW_LINUX, LABEL_CIFLOW_CPU, LABEL_CIFLOW_XLA, LABEL_CIFLOW_NOARCH},
624634
),
625635
),
626636
CIWorkflow(
@@ -824,8 +834,8 @@ def generate_workflow_file(self, workflow_template: jinja2.Template) -> None:
824834
DockerWorkflow(
825835
build_environment="docker-builds",
826836
docker_images=sorted(DOCKER_IMAGES),
827-
# Run every Wednesday to ensure they can build
828-
is_scheduled="1 * * * 3",
837+
# Run every Wednesday at 3:01am to ensure they can build
838+
is_scheduled="1 3 * * 3",
829839
),
830840
]
831841

@@ -835,7 +845,7 @@ def generate_workflow_file(self, workflow_template: jinja2.Template) -> None:
835845
package_type="manywheel",
836846
build_configs=generate_binary_build_matrix.generate_wheels_matrix(),
837847
ciflow_config=CIFlowConfig(
838-
labels={LABEL_CIFLOW_BINARIES, LABEL_CIFLOW_BINARIES_WHEEL},
848+
labels={LABEL_CIFLOW_DEFAULT, LABEL_CIFLOW_BINARIES, LABEL_CIFLOW_BINARIES_WHEEL},
839849
isolated_workflow=True,
840850
),
841851
),
@@ -844,7 +854,7 @@ def generate_workflow_file(self, workflow_template: jinja2.Template) -> None:
844854
package_type="conda",
845855
build_configs=generate_binary_build_matrix.generate_conda_matrix(),
846856
ciflow_config=CIFlowConfig(
847-
labels={LABEL_CIFLOW_BINARIES, LABEL_CIFLOW_BINARIES_CONDA},
857+
labels={LABEL_CIFLOW_DEFAULT, LABEL_CIFLOW_BINARIES, LABEL_CIFLOW_BINARIES_CONDA},
848858
isolated_workflow=True,
849859
),
850860
),
@@ -856,7 +866,7 @@ def generate_workflow_file(self, workflow_template: jinja2.Template) -> None:
856866
generate_binary_build_matrix.CXX11_ABI
857867
),
858868
ciflow_config=CIFlowConfig(
859-
labels={LABEL_CIFLOW_BINARIES, LABEL_CIFLOW_BINARIES_LIBTORCH},
869+
labels={LABEL_CIFLOW_DEFAULT, LABEL_CIFLOW_BINARIES, LABEL_CIFLOW_BINARIES_LIBTORCH},
860870
isolated_workflow=True,
861871
),
862872
),
@@ -868,7 +878,7 @@ def generate_workflow_file(self, workflow_template: jinja2.Template) -> None:
868878
generate_binary_build_matrix.PRE_CXX11_ABI
869879
),
870880
ciflow_config=CIFlowConfig(
871-
labels={LABEL_CIFLOW_BINARIES, LABEL_CIFLOW_BINARIES_LIBTORCH},
881+
labels={LABEL_CIFLOW_DEFAULT, LABEL_CIFLOW_BINARIES, LABEL_CIFLOW_BINARIES_LIBTORCH},
872882
isolated_workflow=True,
873883
),
874884
),

0 commit comments

Comments
 (0)