Skip to content

Commit

Permalink
Update on "[quant] Add reflection padding to conv"
Browse files Browse the repository at this point in the history
Differential Revision: [D25394384](https://our.internmc.facebook.com/intern/diff/D25394384)

[ghstack-poisoned]
  • Loading branch information
z-a-f committed Feb 3, 2021
2 parents c97d71a + 5cf3278 commit 0ce292f
Show file tree
Hide file tree
Showing 137 changed files with 6,718 additions and 1,450 deletions.
2 changes: 1 addition & 1 deletion .circleci/cimodel/data/dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

ROCM_VERSIONS = [
"3.10",
"4.0",
"4.0.1",
]

ROCM_VERSION_LABELS = ["rocm" + v for v in ROCM_VERSIONS]
Expand Down
104 changes: 52 additions & 52 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2165,49 +2165,49 @@ workflows:
- /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
docker_image: "pytorch/manylinux-rocm:3.10"
- binary_linux_build:
name: binary_linux_manywheel_3_6m_rocm4_0_devtoolset7_nightly_build
build_environment: "manywheel 3.6m rocm4.0 devtoolset7"
name: binary_linux_manywheel_3_6m_rocm4_0_1_devtoolset7_nightly_build
build_environment: "manywheel 3.6m rocm4.0.1 devtoolset7"
filters:
branches:
only:
- /.*/
tags:
only:
- /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
docker_image: "pytorch/manylinux-rocm:4.0"
docker_image: "pytorch/manylinux-rocm:4.0.1"
- binary_linux_build:
name: binary_linux_manywheel_3_7m_rocm4_0_devtoolset7_nightly_build
build_environment: "manywheel 3.7m rocm4.0 devtoolset7"
name: binary_linux_manywheel_3_7m_rocm4_0_1_devtoolset7_nightly_build
build_environment: "manywheel 3.7m rocm4.0.1 devtoolset7"
filters:
branches:
only:
- /.*/
tags:
only:
- /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
docker_image: "pytorch/manylinux-rocm:4.0"
docker_image: "pytorch/manylinux-rocm:4.0.1"
- binary_linux_build:
name: binary_linux_manywheel_3_8m_rocm4_0_devtoolset7_nightly_build
build_environment: "manywheel 3.8m rocm4.0 devtoolset7"
name: binary_linux_manywheel_3_8m_rocm4_0_1_devtoolset7_nightly_build
build_environment: "manywheel 3.8m rocm4.0.1 devtoolset7"
filters:
branches:
only:
- /.*/
tags:
only:
- /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
docker_image: "pytorch/manylinux-rocm:4.0"
docker_image: "pytorch/manylinux-rocm:4.0.1"
- binary_linux_build:
name: binary_linux_manywheel_3_9m_rocm4_0_devtoolset7_nightly_build
build_environment: "manywheel 3.9m rocm4.0 devtoolset7"
name: binary_linux_manywheel_3_9m_rocm4_0_1_devtoolset7_nightly_build
build_environment: "manywheel 3.9m rocm4.0.1 devtoolset7"
filters:
branches:
only:
- /.*/
tags:
only:
- /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
docker_image: "pytorch/manylinux-rocm:4.0"
docker_image: "pytorch/manylinux-rocm:4.0.1"
- binary_linux_build:
name: binary_linux_conda_3_6_cpu_devtoolset7_nightly_build
build_environment: "conda 3.6 cpu devtoolset7"
Expand Down Expand Up @@ -3551,8 +3551,8 @@ workflows:
use_cuda_docker_runtime: "1"
resource_class: gpu.medium
- binary_linux_test:
name: binary_linux_manywheel_3_6m_rocm4_0_devtoolset7_nightly_test
build_environment: "manywheel 3.6m rocm4.0 devtoolset7"
name: binary_linux_manywheel_3_6m_rocm4_0_1_devtoolset7_nightly_test
build_environment: "manywheel 3.6m rocm4.0.1 devtoolset7"
filters:
branches:
only:
Expand All @@ -3561,13 +3561,13 @@ workflows:
only:
- /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
requires:
- binary_linux_manywheel_3_6m_rocm4_0_devtoolset7_nightly_build
docker_image: "pytorch/manylinux-rocm:4.0"
- binary_linux_manywheel_3_6m_rocm4_0_1_devtoolset7_nightly_build
docker_image: "pytorch/manylinux-rocm:4.0.1"
use_cuda_docker_runtime: "1"
resource_class: gpu.medium
- binary_linux_test:
name: binary_linux_manywheel_3_7m_rocm4_0_devtoolset7_nightly_test
build_environment: "manywheel 3.7m rocm4.0 devtoolset7"
name: binary_linux_manywheel_3_7m_rocm4_0_1_devtoolset7_nightly_test
build_environment: "manywheel 3.7m rocm4.0.1 devtoolset7"
filters:
branches:
only:
Expand All @@ -3576,13 +3576,13 @@ workflows:
only:
- /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
requires:
- binary_linux_manywheel_3_7m_rocm4_0_devtoolset7_nightly_build
docker_image: "pytorch/manylinux-rocm:4.0"
- binary_linux_manywheel_3_7m_rocm4_0_1_devtoolset7_nightly_build
docker_image: "pytorch/manylinux-rocm:4.0.1"
use_cuda_docker_runtime: "1"
resource_class: gpu.medium
- binary_linux_test:
name: binary_linux_manywheel_3_8m_rocm4_0_devtoolset7_nightly_test
build_environment: "manywheel 3.8m rocm4.0 devtoolset7"
name: binary_linux_manywheel_3_8m_rocm4_0_1_devtoolset7_nightly_test
build_environment: "manywheel 3.8m rocm4.0.1 devtoolset7"
filters:
branches:
only:
Expand All @@ -3591,13 +3591,13 @@ workflows:
only:
- /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
requires:
- binary_linux_manywheel_3_8m_rocm4_0_devtoolset7_nightly_build
docker_image: "pytorch/manylinux-rocm:4.0"
- binary_linux_manywheel_3_8m_rocm4_0_1_devtoolset7_nightly_build
docker_image: "pytorch/manylinux-rocm:4.0.1"
use_cuda_docker_runtime: "1"
resource_class: gpu.medium
- binary_linux_test:
name: binary_linux_manywheel_3_9m_rocm4_0_devtoolset7_nightly_test
build_environment: "manywheel 3.9m rocm4.0 devtoolset7"
name: binary_linux_manywheel_3_9m_rocm4_0_1_devtoolset7_nightly_test
build_environment: "manywheel 3.9m rocm4.0.1 devtoolset7"
filters:
branches:
only:
Expand All @@ -3606,8 +3606,8 @@ workflows:
only:
- /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
requires:
- binary_linux_manywheel_3_9m_rocm4_0_devtoolset7_nightly_build
docker_image: "pytorch/manylinux-rocm:4.0"
- binary_linux_manywheel_3_9m_rocm4_0_1_devtoolset7_nightly_build
docker_image: "pytorch/manylinux-rocm:4.0.1"
use_cuda_docker_runtime: "1"
resource_class: gpu.medium
- binary_linux_test:
Expand Down Expand Up @@ -5129,10 +5129,10 @@ workflows:
package_type: manywheel
upload_subfolder: rocm3.10
- binary_upload:
name: binary_linux_manywheel_3_6m_rocm4_0_devtoolset7_nightly_upload
name: binary_linux_manywheel_3_6m_rocm4_0_1_devtoolset7_nightly_upload
context: org-member
requires:
- binary_linux_manywheel_3_6m_rocm4_0_devtoolset7_nightly_test
- binary_linux_manywheel_3_6m_rocm4_0_1_devtoolset7_nightly_test
filters:
branches:
only:
Expand All @@ -5141,12 +5141,12 @@ workflows:
only:
- /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
package_type: manywheel
upload_subfolder: rocm4.0
upload_subfolder: rocm4.0.1
- binary_upload:
name: binary_linux_manywheel_3_7m_rocm4_0_devtoolset7_nightly_upload
name: binary_linux_manywheel_3_7m_rocm4_0_1_devtoolset7_nightly_upload
context: org-member
requires:
- binary_linux_manywheel_3_7m_rocm4_0_devtoolset7_nightly_test
- binary_linux_manywheel_3_7m_rocm4_0_1_devtoolset7_nightly_test
filters:
branches:
only:
Expand All @@ -5155,12 +5155,12 @@ workflows:
only:
- /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
package_type: manywheel
upload_subfolder: rocm4.0
upload_subfolder: rocm4.0.1
- binary_upload:
name: binary_linux_manywheel_3_8m_rocm4_0_devtoolset7_nightly_upload
name: binary_linux_manywheel_3_8m_rocm4_0_1_devtoolset7_nightly_upload
context: org-member
requires:
- binary_linux_manywheel_3_8m_rocm4_0_devtoolset7_nightly_test
- binary_linux_manywheel_3_8m_rocm4_0_1_devtoolset7_nightly_test
filters:
branches:
only:
Expand All @@ -5169,12 +5169,12 @@ workflows:
only:
- /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
package_type: manywheel
upload_subfolder: rocm4.0
upload_subfolder: rocm4.0.1
- binary_upload:
name: binary_linux_manywheel_3_9m_rocm4_0_devtoolset7_nightly_upload
name: binary_linux_manywheel_3_9m_rocm4_0_1_devtoolset7_nightly_upload
context: org-member
requires:
- binary_linux_manywheel_3_9m_rocm4_0_devtoolset7_nightly_test
- binary_linux_manywheel_3_9m_rocm4_0_1_devtoolset7_nightly_test
filters:
branches:
only:
Expand All @@ -5183,7 +5183,7 @@ workflows:
only:
- /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
package_type: manywheel
upload_subfolder: rocm4.0
upload_subfolder: rocm4.0.1
- binary_upload:
name: binary_linux_conda_3_6_cpu_devtoolset7_nightly_upload
context: org-member
Expand Down Expand Up @@ -7801,51 +7801,51 @@ workflows:
use_cuda_docker_runtime: "1"
resource_class: gpu.medium
- smoke_linux_test:
name: smoke_linux_manywheel_3_6m_rocm4_0_devtoolset7_nightly
build_environment: "manywheel 3.6m rocm4.0 devtoolset7"
name: smoke_linux_manywheel_3_6m_rocm4_0_1_devtoolset7_nightly
build_environment: "manywheel 3.6m rocm4.0.1 devtoolset7"
requires:
- update_s3_htmls
filters:
branches:
only:
- postnightly
docker_image: "pytorch/manylinux-rocm:4.0"
docker_image: "pytorch/manylinux-rocm:4.0.1"
use_cuda_docker_runtime: "1"
resource_class: gpu.medium
- smoke_linux_test:
name: smoke_linux_manywheel_3_7m_rocm4_0_devtoolset7_nightly
build_environment: "manywheel 3.7m rocm4.0 devtoolset7"
name: smoke_linux_manywheel_3_7m_rocm4_0_1_devtoolset7_nightly
build_environment: "manywheel 3.7m rocm4.0.1 devtoolset7"
requires:
- update_s3_htmls
filters:
branches:
only:
- postnightly
docker_image: "pytorch/manylinux-rocm:4.0"
docker_image: "pytorch/manylinux-rocm:4.0.1"
use_cuda_docker_runtime: "1"
resource_class: gpu.medium
- smoke_linux_test:
name: smoke_linux_manywheel_3_8m_rocm4_0_devtoolset7_nightly
build_environment: "manywheel 3.8m rocm4.0 devtoolset7"
name: smoke_linux_manywheel_3_8m_rocm4_0_1_devtoolset7_nightly
build_environment: "manywheel 3.8m rocm4.0.1 devtoolset7"
requires:
- update_s3_htmls
filters:
branches:
only:
- postnightly
docker_image: "pytorch/manylinux-rocm:4.0"
docker_image: "pytorch/manylinux-rocm:4.0.1"
use_cuda_docker_runtime: "1"
resource_class: gpu.medium
- smoke_linux_test:
name: smoke_linux_manywheel_3_9m_rocm4_0_devtoolset7_nightly
build_environment: "manywheel 3.9m rocm4.0 devtoolset7"
name: smoke_linux_manywheel_3_9m_rocm4_0_1_devtoolset7_nightly
build_environment: "manywheel 3.9m rocm4.0.1 devtoolset7"
requires:
- update_s3_htmls
filters:
branches:
only:
- postnightly
docker_image: "pytorch/manylinux-rocm:4.0"
docker_image: "pytorch/manylinux-rocm:4.0.1"
use_cuda_docker_runtime: "1"
resource_class: gpu.medium
- smoke_linux_test:
Expand Down
3 changes: 1 addition & 2 deletions aten/src/ATen/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ Tensor empty_cpu(
c10::optional<Device> device_opt,
c10::optional<bool> pin_memory_opt,
c10::optional<c10::MemoryFormat> memory_format_opt) {
Device device = device_or_default(device_opt);
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(device_or_default(device_opt).type() == DeviceType::CPU);

TORCH_CHECK(device.type() == DeviceType::CPU);
check_size_nonnegative(size);

bool pin_memory = pinned_memory_or_default(pin_memory_opt);
Expand Down
1 change: 1 addition & 0 deletions aten/src/ATen/core/aten_interned_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ _(aten, diag_embed) \
_(aten, diagflat) \
_(aten, diagonal) \
_(aten, fill_diagonal_) \
_(aten, diff) \
_(aten, digamma) \
_(aten, dim) \
_(aten, dist) \
Expand Down
34 changes: 17 additions & 17 deletions aten/src/ATen/core/op_registration/op_whitelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* set of operators (+ dependencies) included.
*
* - Build with -DTORCH_OPERATOR_WHITELIST="aten::add;aten::sub" and only these
* two ops will be included in your build. The whitelist records operators
* two ops will be included in your build. The allowlist records operators
* only, no overloads; if you include aten::add, all overloads of aten::add
* will be included.
*
Expand All @@ -19,9 +19,9 @@
* operator functions that weren't registered.
* See Note [Selective build] for more details
*
* WARNING: The whitelist mechanism doesn't work for all ways you could go about
* WARNING: The allowlist mechanism doesn't work for all ways you could go about
* registering an operator. If the dispatch key / operator name is not
* sufficiently obvious at compile time, then the whitelisting mechanism
* sufficiently obvious at compile time, then the allowlisting mechanism
* will fail (and the operator will be included in the binary anyway).
*/

Expand All @@ -33,21 +33,21 @@ namespace c10 {

namespace impl {

// returns true iff whitelist contains item
// returns true iff allowlist contains item
// op_whitelist_contains("a;bc;d", "bc") == true
constexpr bool op_whitelist_contains(string_view whitelist, string_view item) {
constexpr bool op_whitelist_contains(string_view allowlist, string_view item) {
//Choose a really big value for next so that if something goes wrong
//this code will blow up in a hopefully detectable way.
size_t next = std::numeric_limits<size_t>::max();
for (size_t cur = 0; cur <= whitelist.size(); cur = next) {
next = whitelist.find(';', cur);
for (size_t cur = 0; cur <= allowlist.size(); cur = next) {
next = allowlist.find(';', cur);
if (next != string_view::npos) {
if (whitelist.substr(cur, next - cur).compare(item) == 0) {
if (allowlist.substr(cur, next - cur).compare(item) == 0) {
return true;
}
next++;
} else {
if (whitelist.substr(cur).compare(item) == 0) {
if (allowlist.substr(cur).compare(item) == 0) {
return true;
}
break;
Expand All @@ -56,7 +56,7 @@ constexpr bool op_whitelist_contains(string_view whitelist, string_view item) {
return false;
}

// Returns true iff the given op name is on the whitelist
// Returns true iff the given op name is on the allowlist
// and should be registered
constexpr bool op_whitelist_check(string_view op_name) {
assert(op_name.find("::") != string_view::npos);
Expand All @@ -68,16 +68,16 @@ constexpr bool op_whitelist_check(string_view op_name) {
return op_whitelist_contains(
C10_STRINGIZE(TORCH_OPERATOR_WHITELIST),
// This function is majorly used for mobile selective build with
// root operators, where the overload is included in the whitelist.
// root operators, where the overload is included in the allowlist.
op_name);
// // Strip overload name (as whitelist doesn't contain overloads)
// // Strip overload name (as allowlist doesn't contain overloads)
// // Another function based on this may be added when there's usage
// // on op names without overload.
// OperatorNameView::parse(op_name).name);
#endif
}

// Returns true iff the given schema string is on the whitelist
// Returns true iff the given schema string is on the allowlist
// and should be registered
constexpr bool schema_whitelist_check(string_view schema) {
#if defined(TORCH_FORCE_SCHEMA_REGISTRATION)
Expand All @@ -88,12 +88,12 @@ constexpr bool schema_whitelist_check(string_view schema) {
}

// schema_whitelist_check() implicitly depends on a macro, TORCH_OPERATOR_WHITELIST.
// Add this API to pass arbitrary whitelist.
constexpr bool op_whitelist_contains_name_in_schema(string_view whitelist, string_view schema) {
return op_whitelist_contains(whitelist, schema.substr(0, schema.find("(")));
// Add this API to pass arbitrary allowlist.
constexpr bool op_whitelist_contains_name_in_schema(string_view allowlist, string_view schema) {
return op_whitelist_contains(allowlist, schema.substr(0, schema.find("(")));
}

// Returns true iff the given dispatch key is on the whitelist
// Returns true iff the given dispatch key is on the allowlist
// and should be registered. When we turn this on, the list of valid
// mobile dispatch keys is hard coded (but you need to make sure
// that you have the correct set of dispatch keys for this).
Expand Down

0 comments on commit 0ce292f

Please sign in to comment.