Skip to content

Conversation

@wenleix
Copy link
Contributor

@wenleix wenleix commented Mar 4, 2021

Stack from ghstack:

Summary:

Test Plan:
USE_CUDA=0 BUILD_TEST=0 python setup.py install

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D26810622

Summary:

Test Plan:
USE_CUDA=0 BUILD_TEST=0 python setup.py install

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
wenleix added a commit that referenced this pull request Mar 4, 2021
Summary:

Test Plan:
USE_CUDA=0 BUILD_TEST=0 python setup.py install

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: a919df4
Pull Request resolved: #53247
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Mar 4, 2021

💊 CI failures summary and remediations

As of commit 95fee44 (more details on the Dr. CI page):



🕵️ 11 new failures recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See CircleCI build pytorch_linux_bionic_py3_8_gcc9_coverage_test2 (1/11)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

Mar 05 00:57:07 RuntimeError: test_foreach failed! Received signal: SIGSEGV
Mar 05 00:57:05   test_bool_scalarlist_cpu_int16 (__main__.TestForeachCPU) ... ok (0.165s)
Mar 05 00:57:06   test_bool_scalarlist_cpu_int32 (__main__.TestForeachCPU) ... ok (0.165s)
Mar 05 00:57:06   test_bool_scalarlist_cpu_int64 (__main__.TestForeachCPU) ... ok (0.170s)
Mar 05 00:57:06   test_bool_scalarlist_cpu_int8 (__main__.TestForeachCPU) ... ok (0.164s)
Mar 05 00:57:06   test_bool_scalarlist_cpu_uint8 (__main__.TestForeachCPU) ... ok (0.164s)
Mar 05 00:57:07   test_complex_scalar_cpu_bfloat16 (__main__.TestForeachCPU) ... Traceback (most recent call last):
Mar 05 00:57:07   File "test/run_test.py", line 926, in <module>
Mar 05 00:57:07     main()
Mar 05 00:57:07   File "test/run_test.py", line 905, in main
Mar 05 00:57:07     raise RuntimeError(err_message)
Mar 05 00:57:07 RuntimeError: test_foreach failed! Received signal: SIGSEGV
Mar 05 00:57:07 
Mar 05 00:57:07 real	11m7.819s
Mar 05 00:57:07 user	13m53.736s
Mar 05 00:57:07 sys	1m14.791s
Mar 05 00:57:07 + cleanup
Mar 05 00:57:07 + retcode=1
Mar 05 00:57:07 + set +x
Mar 05 00:57:07 =================== sccache compilation log ===================
Mar 05 00:57:07 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 05 00:57:07 Compile requests                      44

See CircleCI build pytorch_linux_xenial_py3_clang5_asan_test1 (2/11)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

Mar 05 00:46:33 RuntimeError: test_autograd failed!
Mar 05 00:46:33     #108 0x55922e031b0d in main /tmp/build/80754af9/python_1614113050744/work/Programs/python.c:69
Mar 05 00:46:33     #109 0x7f37ab8f383f in __libc_start_main /build/glibc-e6zv40/glibc-2.23/csu/../csu/libc-start.c:291
Mar 05 00:46:33     #110 0x55922e110d6f in _start /home/rdonnelly/mc/conda-bld/compilers_linux-64_1534865402226/work/.build/src/glibc-2.12.2/csu/../sysdeps/x86_64/elf/start.S:103
Mar 05 00:46:33 
Mar 05 00:46:33 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /var/lib/jenkins/workspace/c10/util/intrusive_ptr.h:238:88 in 
Mar 05 00:46:33 Traceback (most recent call last):
Mar 05 00:46:33   File "test/run_test.py", line 926, in <module>
Mar 05 00:46:33     main()
Mar 05 00:46:33   File "test/run_test.py", line 905, in main
Mar 05 00:46:33     raise RuntimeError(err_message)
Mar 05 00:46:33 RuntimeError: test_autograd failed!
Mar 05 00:46:33 =================== sccache compilation log ===================
Mar 05 00:46:33 + cleanup
Mar 05 00:46:33 + retcode=1
Mar 05 00:46:33 + set +x
Mar 05 00:46:33 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 05 00:46:33 Compile requests                      28
Mar 05 00:46:33 Compile requests executed             26
Mar 05 00:46:33 Cache hits                             1
Mar 05 00:46:33 Cache hits (C/C++)                     1
Mar 05 00:46:33 Cache misses                          25

See CircleCI build pytorch_linux_bionic_py3_6_clang9_test (3/11)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

Mar 05 00:41:44 RuntimeError: test_autograd failed!
Mar 05 00:41:44 Generated XML report: test-reports/python-unittest/test_autograd/TEST-TestAutogradComplex-20210305003624.xml
Mar 05 00:41:44 Generated XML report: test-reports/python-unittest/test_autograd/TEST-TestAutogradDeviceTypeCPU-20210305003624.xml
Mar 05 00:41:44 Generated XML report: test-reports/python-unittest/test_autograd/TEST-TestAutogradForwardMode-20210305003624.xml
Mar 05 00:41:44 Generated XML report: test-reports/python-unittest/test_autograd/TEST-TestAutogradFunctional-20210305003624.xml
Mar 05 00:41:44 Generated XML report: test-reports/python-unittest/test_autograd/TEST-TestMultithreadAutograd-20210305003624.xml
Mar 05 00:41:44 Traceback (most recent call last):
Mar 05 00:41:44   File "test/run_test.py", line 926, in <module>
Mar 05 00:41:44     main()
Mar 05 00:41:44   File "test/run_test.py", line 905, in main
Mar 05 00:41:44     raise RuntimeError(err_message)
Mar 05 00:41:44 RuntimeError: test_autograd failed!
Mar 05 00:41:44 
Mar 05 00:41:44 real	7m23.993s
Mar 05 00:41:44 user	8m51.150s
Mar 05 00:41:44 sys	1m49.704s
Mar 05 00:41:44 + cleanup
Mar 05 00:41:44 + retcode=1
Mar 05 00:41:44 + set +x
Mar 05 00:41:44 =================== sccache compilation log ===================
Mar 05 00:41:44 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 05 00:41:44 Compile requests                      28

See CircleCI build pytorch_windows_vs2019_py36_cuda10.1_test1 (4/11)

Step: "Test" (full log | diagnosis details | 🔁 rerun)

RuntimeError: test_autograd failed!
  test_function_returns_input (__main__.TestAutograd) ... ok (0.004s)
  test_function_returns_undefined_tensor (__main__.TestAutograd) ... ok (0.003s)
  test_gc_in_destructor (__main__.TestAutograd) ... ok (0.234s)
  test_grad (__main__.TestAutograd) ... ok (0.017s)
  test_grad_badcalls (__main__.TestAutograd) ... ok (0.002s)
  test_grad_fn_attr_bindings (__main__.TestAutograd) ... Traceback (most recent call last):
  File "run_test.py", line 926, in <module>
    main()
  File "run_test.py", line 905, in main
    raise RuntimeError(err_message)
RuntimeError: test_autograd failed!

(base) C:\Users\circleci\project\test>if ERRORLEVEL 1 exit /b 1 
+ cleanup
+ retcode=1
+ set +x


Exited with code exit status 1

See CircleCI build pytorch_macos_10_13_py3_test (5/11)

Step: "Test" (full log | diagnosis details | 🔁 rerun)

Mar 05 00:21:53 RuntimeError: test_autograd failed! Received signal: SIGIOT
Mar 05 00:21:53 /Users/distiller/workspace/miniconda3/lib/python3.7/site-packages/torch/nn/functional.py:3532: UserWarning: The default behavior for interpolate/upsample with float scale_factor changed in 1.6.0 to align with other frameworks/libraries, and now uses scale_factor directly, instead of relying on the computed output size. If you wish to restore the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details. 
Mar 05 00:21:53   "The default behavior for interpolate/upsample with float scale_factor changed "
Mar 05 00:21:53 python(4062,0x110865dc0) malloc: Incorrect checksum for freed object 0x7fd3f0a1ac38: probably modified after being freed.
Mar 05 00:21:53 Corrupt value: 0x500007fd3f0a2028
Mar 05 00:21:53 python(4062,0x110865dc0) malloc: *** set a breakpoint in malloc_error_break to debug
Mar 05 00:21:53 Traceback (most recent call last):
Mar 05 00:21:53   File "test/run_test.py", line 926, in <module>
Mar 05 00:21:53     main()
Mar 05 00:21:53   File "test/run_test.py", line 905, in main
Mar 05 00:21:53     raise RuntimeError(err_message)
Mar 05 00:21:53 RuntimeError: test_autograd failed! Received signal: SIGIOT
Mar 05 00:21:53 + cleanup
Mar 05 00:21:53 + retcode=1
Mar 05 00:21:53 + set +x


Exited with code exit status 1

See CircleCI build pytorch_windows_vs2019_py36_cuda10.1_test2 (6/11)

Step: "Test" (full log | diagnosis details | 🔁 rerun)

RuntimeError: test_foreach failed!
  test_bool_scalarlist_cpu_int16 (__main__.TestForeachCPU) ... ok (0.056s)
  test_bool_scalarlist_cpu_int32 (__main__.TestForeachCPU) ... ok (0.051s)
  test_bool_scalarlist_cpu_int64 (__main__.TestForeachCPU) ... ok (0.054s)
  test_bool_scalarlist_cpu_int8 (__main__.TestForeachCPU) ... ok (0.053s)
  test_bool_scalarlist_cpu_uint8 (__main__.TestForeachCPU) ... ok (0.053s)
  test_complex_scalar_cpu_bfloat16 (__main__.TestForeachCPU) ... Traceback (most recent call last):
  File "run_test.py", line 926, in <module>
    main()
  File "run_test.py", line 905, in main
    raise RuntimeError(err_message)
RuntimeError: test_foreach failed!

(base) C:\Users\circleci\project\test>if ERRORLEVEL 1 exit /b 1 
+ cleanup
+ retcode=1
+ set +x


Exited with code exit status 1

See CircleCI build pytorch_linux_xenial_py3_6_gcc5_4_test (7/11)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

Mar 05 02:17:02 RuntimeError: test_autograd failed! Received signal: SIGSEGV
Mar 05 02:17:00   test_pin_memory_cpu (__main__.TestAutogradDeviceTypeCPU) ... skip (0.001s)
Mar 05 02:17:00   test_pow_broadcast_all_cpu (__main__.TestAutogradDeviceTypeCPU) ... ok (0.223s)
Mar 05 02:17:01   test_pow_broadcast_lhs_cpu (__main__.TestAutogradDeviceTypeCPU) ... ok (0.349s)
Mar 05 02:17:01   test_pow_broadcast_rhs_cpu (__main__.TestAutogradDeviceTypeCPU) ... ok (0.351s)
Mar 05 02:17:02   test_pow_complex_constant_cpu (__main__.TestAutogradDeviceTypeCPU) ... ok (0.712s)
Mar 05 02:17:02   test_pow_complex_imaginary_exponent_cpu (__main__.TestAutogradDeviceTypeCPU) ... Traceback (most recent call last):
Mar 05 02:17:02   File "test/run_test.py", line 926, in <module>
Mar 05 02:17:02     main()
Mar 05 02:17:02   File "test/run_test.py", line 905, in main
Mar 05 02:17:02     raise RuntimeError(err_message)
Mar 05 02:17:02 RuntimeError: test_autograd failed! Received signal: SIGSEGV
Mar 05 02:17:02 + cleanup
Mar 05 02:17:02 + retcode=1
Mar 05 02:17:02 + set +x
Mar 05 02:17:02 =================== sccache compilation log ===================
Mar 05 02:17:02 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 05 02:17:02 Compile requests                      28
Mar 05 02:17:02 Compile requests executed             26
Mar 05 02:17:02 Cache hits                             1
Mar 05 02:17:02 Cache hits (C/C++)                     1
Mar 05 02:17:02 Cache misses                          25

See CircleCI build pytorch_linux_xenial_cuda10_2_cudnn7_py3_gcc7_test2 (8/11)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

Mar 05 01:24:15 RuntimeError: test_foreach failed! Received signal: SIGSEGV
Mar 05 01:24:14   test_bool_scalarlist_cpu_int16 (__main__.TestForeachCPU) ... ok (0.095s)
Mar 05 01:24:15   test_bool_scalarlist_cpu_int32 (__main__.TestForeachCPU) ... ok (0.094s)
Mar 05 01:24:15   test_bool_scalarlist_cpu_int64 (__main__.TestForeachCPU) ... ok (0.095s)
Mar 05 01:24:15   test_bool_scalarlist_cpu_int8 (__main__.TestForeachCPU) ... ok (0.094s)
Mar 05 01:24:15   test_bool_scalarlist_cpu_uint8 (__main__.TestForeachCPU) ... ok (0.094s)
Mar 05 01:24:15   test_complex_scalar_cpu_bfloat16 (__main__.TestForeachCPU) ... Traceback (most recent call last):
Mar 05 01:24:15   File "test/run_test.py", line 926, in <module>
Mar 05 01:24:15     main()
Mar 05 01:24:15   File "test/run_test.py", line 905, in main
Mar 05 01:24:15     raise RuntimeError(err_message)
Mar 05 01:24:15 RuntimeError: test_foreach failed! Received signal: SIGSEGV
Mar 05 01:24:16 + cleanup
Mar 05 01:24:16 + retcode=1
Mar 05 01:24:16 + set +x
Mar 05 01:24:16 =================== sccache compilation log ===================
Mar 05 01:24:16 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 05 01:24:16 Compile requests                     98
Mar 05 01:24:16 Compile requests executed            50
Mar 05 01:24:16 Cache hits                           11
Mar 05 01:24:16 Cache hits (C/C++)                   11
Mar 05 01:24:16 Cache misses                         39

See CircleCI build pytorch_linux_xenial_cuda10_2_cudnn7_py3_gcc7_test1 (9/11)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

Mar 05 01:05:08 RuntimeError: test_autograd failed! Received signal: SIGSEGV
Mar 05 01:05:06   test_pin_memory_cpu (__main__.TestAutogradDeviceTypeCPU) ... skip (0.001s)
Mar 05 01:05:06   test_pow_broadcast_all_cpu (__main__.TestAutogradDeviceTypeCPU) ... ok (0.267s)
Mar 05 01:05:07   test_pow_broadcast_lhs_cpu (__main__.TestAutogradDeviceTypeCPU) ... ok (0.411s)
Mar 05 01:05:07   test_pow_broadcast_rhs_cpu (__main__.TestAutogradDeviceTypeCPU) ... ok (0.415s)
Mar 05 01:05:08   test_pow_complex_constant_cpu (__main__.TestAutogradDeviceTypeCPU) ... ok (0.808s)
Mar 05 01:05:08   test_pow_complex_imaginary_exponent_cpu (__main__.TestAutogradDeviceTypeCPU) ... Traceback (most recent call last):
Mar 05 01:05:08   File "test/run_test.py", line 926, in <module>
Mar 05 01:05:08     main()
Mar 05 01:05:08   File "test/run_test.py", line 905, in main
Mar 05 01:05:08     raise RuntimeError(err_message)
Mar 05 01:05:08 RuntimeError: test_autograd failed! Received signal: SIGSEGV
Mar 05 01:05:09 + cleanup
Mar 05 01:05:09 + retcode=1
Mar 05 01:05:09 + set +x
Mar 05 01:05:09 =================== sccache compilation log ===================
Mar 05 01:05:09 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 05 01:05:09 Compile requests                     64
Mar 05 01:05:09 Compile requests executed            38
Mar 05 01:05:09 Cache hits                            2
Mar 05 01:05:09 Cache hits (C/C++)                    2
Mar 05 01:05:09 Cache misses                         36

See CircleCI build pytorch_linux_bionic_py3_8_gcc9_coverage_test1 (10/11)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

Mar 05 00:58:17 RuntimeError: test_autograd failed! Received signal: SIGSEGV
Mar 05 00:58:13   test_pin_memory_cpu (__main__.TestAutogradDeviceTypeCPU) ... skip (0.003s)
Mar 05 00:58:13   test_pow_broadcast_all_cpu (__main__.TestAutogradDeviceTypeCPU) ... ok (0.522s)
Mar 05 00:58:14   test_pow_broadcast_lhs_cpu (__main__.TestAutogradDeviceTypeCPU) ... ok (0.827s)
Mar 05 00:58:15   test_pow_broadcast_rhs_cpu (__main__.TestAutogradDeviceTypeCPU) ... ok (0.825s)
Mar 05 00:58:16   test_pow_complex_constant_cpu (__main__.TestAutogradDeviceTypeCPU) ... ok (1.191s)
Mar 05 00:58:17   test_pow_complex_imaginary_exponent_cpu (__main__.TestAutogradDeviceTypeCPU) ... Traceback (most recent call last):
Mar 05 00:58:17   File "test/run_test.py", line 926, in <module>
Mar 05 00:58:17     main()
Mar 05 00:58:17   File "test/run_test.py", line 905, in main
Mar 05 00:58:17     raise RuntimeError(err_message)
Mar 05 00:58:17 RuntimeError: test_autograd failed! Received signal: SIGSEGV
Mar 05 00:58:17 
Mar 05 00:58:17 real	12m16.075s
Mar 05 00:58:17 user	19m25.253s
Mar 05 00:58:17 sys	0m9.147s
Mar 05 00:58:17 + cleanup
Mar 05 00:58:17 + retcode=1
Mar 05 00:58:17 + set +x
Mar 05 00:58:17 =================== sccache compilation log ===================
Mar 05 00:58:17 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 05 00:58:17 Compile requests                      28

See CircleCI build pytorch_linux_xenial_py3_clang5_asan_test2 (11/11)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

Mar 05 00:49:03 RuntimeError: test_cpp_api_parity failed!
Mar 05 00:49:03     #112 0x55fde272fb0d in main /tmp/build/80754af9/python_1614113050744/work/Programs/python.c:69
Mar 05 00:49:03     #113 0x7fa3996d383f in __libc_start_main /build/glibc-e6zv40/glibc-2.23/csu/../csu/libc-start.c:291
Mar 05 00:49:03     #114 0x55fde280ed6f in _start /home/rdonnelly/mc/conda-bld/compilers_linux-64_1534865402226/work/.build/src/glibc-2.12.2/csu/../sysdeps/x86_64/elf/start.S:103
Mar 05 00:49:03 
Mar 05 00:49:03 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /var/lib/jenkins/workspace/c10/util/intrusive_ptr.h:238:88 in 
Mar 05 00:49:03 Traceback (most recent call last):
Mar 05 00:49:03   File "test/run_test.py", line 926, in <module>
Mar 05 00:49:03     main()
Mar 05 00:49:03   File "test/run_test.py", line 905, in main
Mar 05 00:49:03     raise RuntimeError(err_message)
Mar 05 00:49:03 RuntimeError: test_cpp_api_parity failed!
Mar 05 00:49:04 + cleanup
Mar 05 00:49:04 + retcode=1
Mar 05 00:49:04 + set +x
Mar 05 00:49:04 =================== sccache compilation log ===================
Mar 05 00:49:04 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 05 00:49:04 Compile requests                      32
Mar 05 00:49:04 Compile requests executed             28
Mar 05 00:49:04 Cache hits                             1
Mar 05 00:49:04 Cache hits (C/C++)                     1
Mar 05 00:49:04 Cache misses                          27

❄️ 1 failure tentatively classified as flaky

but reruns have not yet been triggered to confirm:

See CircleCI build pytorch_xla_linux_bionic_py3_6_clang9_build (1/1)

Step: "Build" (full log | diagnosis details | 🔁 rerun) ❄️

Mar 05 01:50:00 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/n/npm/npm_3.5.2-0ubuntu4_all.deb Unable to connect to archive.ubuntu.com:http:
Mar 05 01:50:00 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/n/node-ini/node-ini_1.3.4-1_all.deb  Unable to connect to archive.ubuntu.com:http:
Mar 05 01:50:00 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/n/node-lockfile/node-lockfile_0.4.1-1_all.deb  Unable to connect to archive.ubuntu.com:http:
Mar 05 01:50:00 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/n/node-lru-cache/node-lru-cache_4.1.1-1_all.deb  Unable to connect to archive.ubuntu.com:http:
Mar 05 01:50:00 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/n/node-mute-stream/node-mute-stream_0.0.7-1_all.deb  Unable to connect to archive.ubuntu.com:http:
Mar 05 01:50:00 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/n/node-normalize-package-data/node-normalize-package-data_2.3.5-2_all.deb  Unable to connect to archive.ubuntu.com:http:
Mar 05 01:50:00 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/n/node-read/node-read_1.0.7-1_all.deb  Unable to connect to archive.ubuntu.com:http:
Mar 05 01:50:00 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/n/node-read-package-json/node-read-package-json_1.2.4-1_all.deb  Unable to connect to archive.ubuntu.com:http:
Mar 05 01:50:00 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/n/node-retry/node-retry_0.10.1-1_all.deb  Unable to connect to archive.ubuntu.com:http:
Mar 05 01:50:00 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/n/node-sha/node-sha_1.2.3-1_all.deb  Unable to connect to archive.ubuntu.com:http:
Mar 05 01:50:00 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/n/node-slide/node-slide_1.1.6-1_all.deb  Unable to connect to archive.ubuntu.com:http:
Mar 05 01:50:00 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/n/npm/npm_3.5.2-0ubuntu4_all.deb  Unable to connect to archive.ubuntu.com:http:
Mar 05 01:50:00 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Mar 05 01:50:00 + cleanup
Mar 05 01:50:00 + retcode=100
Mar 05 01:50:00 + set +x
Mar 05 01:50:00 =================== sccache compilation log ===================
Mar 05 01:50:00 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 05 01:50:00 Compile requests                    4849
Mar 05 01:50:00 Compile requests executed           4527
Mar 05 01:50:00 Cache hits                          3090
Mar 05 01:50:00 Cache hits (C/C++)                  3090

ci.pytorch.org: 1 failed


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions to the (internal) Dr. CI Users group.

@wenleix
Copy link
Contributor Author

wenleix commented Mar 4, 2021

Confirmed the Scalar size is reduced to 16 bytes with this PR. However, the following micro-benchmark shows ~1% regression. Will dig into.

from torch.utils.benchmark import Timer
counts = Timer(
    stmt="""auto out = t.add(a, b);""",
    setup="auto t = torch::ones({1}); auto a = torch::Scalar(3); auto b = torch::Scalar(1);",
    language="cpp",
).collect_callgrind(number=1_000)
print(counts)

Use ComplexHolder in Scalar (4bd9eeb) : 29,024,819
Baseline (79944f7) : 28,707,818

}
}

Scalar(Scalar&& rhs) noexcept : tag(rhs.tag), v(rhs.v) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

this is likely a bug causing a double free. After this, you now have two Scalar objects that both are going to destroy the same complex. Could be fixed by setting the *this scalar to not store a complex anymore similar to what you're doing in the move assignment operator

Copy link
Contributor

Choose a reason for hiding this comment

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

as a side note: Having all four copy/move constructors and assignment operators implemented explicitly is some code duplication with the chance of bugs like this one. There's a nice pattern where you can implement all four of those in terms of just one implementation of swap, and then you have all the refcounting or destroying of state in just one function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smessmer : Nice catch! The RHS complex will be cleaned up in move assignment but forget to to the same cleanup in move constructor.

Summary:

Test Plan:
USE_CUDA=0 BUILD_TEST=0 python setup.py install

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D26810622](https://our.internmc.facebook.com/intern/diff/D26810622)

[ghstack-poisoned]
return *this;
}

C10_ALWAYS_INLINE Scalar& operator=(Scalar&& rhs) & noexcept {
Copy link
Contributor

Choose a reason for hiding this comment

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

any specific reason for using C10_ALWAYS_INLINE here? In almost all cases, the compiler knows better and forcing them to inline is a bad idea. Without this, for example, the compiler can make different decisions like say inlining it in server code but not on mobile.

Copy link
Contributor Author

@wenleix wenleix Mar 5, 2021

Choose a reason for hiding this comment

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

@smessmer : Got it. Originally when I start to write these move/copy methods, I followed the corresponding implementation in IValue and didn't reove C10_ALWAYS_INLINE:

C10_ALWAYS_INLINE IValue& operator=(IValue&& rhs) & noexcept {


Side note: during benchmark, sometimes I found manually inline (i.e. copy the method impl) or some (seemingly unrelated) method code change can result in tiny (0.02%- 0.04%) instruction count noise . (is it due to inline decisions at certain callsites?) So a small potential small benefit of C10_ALWAYS_INLINE is to make the result more deterministic? Not a big advantage , though :)

@wenleix
Copy link
Contributor Author

wenleix commented Mar 12, 2021

Superseded by the pass-by reference solution (#53583) due to overhead of non-trivial constructors.

@wenleix wenleix closed this Mar 12, 2021
@wenleix wenleix deleted the gh/wenlei.xie@gmail.com/6/head branch March 12, 2021 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants