Data race in aom_highbd_upsampled_pred_sse2

What version / commit were you testing with?

700b1c2b

What steps will reproduce the problem?

  1. Build with thread sanitizer by setting AOM_SANITIZER_TYPE=thread as per: https://gitlab.com/AOMediaCodec/avm/-/wikis/Reproducing-CI-Test-Failures-Locally#build-unit-tests-with-sanitizers
  2. Run with thread sanitizer by setting filter=AV1/AVxEncoderThreadTestLarge.EncoderResultTest/0 as per: https://gitlab.com/AOMediaCodec/avm/-/wikis/Reproducing-CI-Test-Failures-Locally#run-unit-tests-with-sanitizers

What is the expected output?

No warnings

What do you see instead?

Thread sanitizer reports following warnings:

[ RUN      ] AV1/AVxEncoderThreadTestLarge.EncoderResultTest/0
==================
WARNING: ThreadSanitizer: data race (pid=14)
  Write of size 8 at 0x7f8f865c3010 by thread T47 (mutexes: write M0):
    #0 aom_highbd_upsampled_pred_sse2 /builds/AOMediaCodec/avm/aom_dsp/x86/highbd_variance_sse2.c:855:11 (test_libaom+0xc135b8) (BuildId: dfaafafddb94041405c7af7daff74f722074c9b2)
    #1 upsampled_pref_error /builds/AOMediaCodec/avm/av1/encoder/mcomp.c:3390:5 (test_libaom+0xeded90) (BuildId: dfaafafddb94041405c7af7daff74f722074c9b2)
    #2 upsampled_setup_center_error /builds/AOMediaCodec/avm/av1/encoder/mcomp.c:3715:26 (test_libaom+0xed2bb7) (BuildId: dfaafafddb94041405c7af7daff74f722074c9b2)
    #3 av1_find_best_sub_pixel_tree /builds/AOMediaCodec/avm/av1/encoder/mcomp.c:4771:13 (test_libaom+0xed2bb7)
    #4 motion_estimation /builds/AOMediaCodec/avm/av1/encoder/tpl_model.c:255:13 (test_libaom+0xf61fcc) (BuildId: dfaafafddb94041405c7af7daff74f722074c9b2)
    #5 mode_estimation /builds/AOMediaCodec/avm/av1/encoder/tpl_model.c:476:26 (test_libaom+0xf61fcc)
    #6 av1_mc_flow_dispenser_row /builds/AOMediaCodec/avm/av1/encoder/tpl_model.c:925:5 (test_libaom+0xf61fcc)
    #7 tpl_worker_hook /builds/AOMediaCodec/avm/av1/encoder/ethread.c:1248:5 (test_libaom+0xeb2694) (BuildId: dfaafafddb94041405c7af7daff74f722074c9b2)
    #8 execute /builds/AOMediaCodec/avm/aom_util/aom_thread.c:164:27 (test_libaom+0xceeaa3) (BuildId: dfaafafddb94041405c7af7daff74f722074c9b2)
    #9 thread_loop /builds/AOMediaCodec/avm/aom_util/aom_thread.c:73:7 (test_libaom+0xceeaa3)
  Previous write of size 8 at 0x7f8f865c3010 by main thread:
    #0 aom_highbd_upsampled_pred_sse2 /builds/AOMediaCodec/avm/aom_dsp/x86/highbd_variance_sse2.c:855:11 (test_libaom+0xc135b8) (BuildId: dfaafafddb94041405c7af7daff74f722074c9b2)
    #1 upsampled_pref_error /builds/AOMediaCodec/avm/av1/encoder/mcomp.c:3390:5 (test_libaom+0xeded90) (BuildId: dfaafafddb94041405c7af7daff74f722074c9b2)
    #2 upsampled_setup_center_error /builds/AOMediaCodec/avm/av1/encoder/mcomp.c:3715:26 (test_libaom+0xed2bb7) (BuildId: dfaafafddb94041405c7af7daff74f722074c9b2)
    #3 av1_find_best_sub_pixel_tree /builds/AOMediaCodec/avm/av1/encoder/mcomp.c:4771:13 (test_libaom+0xed2bb7)
    #4 motion_estimation /builds/AOMediaCodec/avm/av1/encoder/tpl_model.c:255:13 (test_libaom+0xf61fcc) (BuildId: dfaafafddb94041405c7af7daff74f722074c9b2)
    #5 mode_estimation /builds/AOMediaCodec/avm/av1/encoder/tpl_model.c:476:26 (test_libaom+0xf61fcc)
    #6 av1_mc_flow_dispenser_row /builds/AOMediaCodec/avm/av1/encoder/tpl_model.c:925:5 (test_libaom+0xf61fcc)
    #7 tpl_worker_hook /builds/AOMediaCodec/avm/av1/encoder/ethread.c:1248:5 (test_libaom+0xeb2694) (BuildId: dfaafafddb94041405c7af7daff74f722074c9b2)
    #8 execute /builds/AOMediaCodec/avm/aom_util/aom_thread.c:164:27 (test_libaom+0xcee7d7) (BuildId: dfaafafddb94041405c7af7daff74f722074c9b2)
    #9 launch_enc_workers /builds/AOMediaCodec/avm/av1/encoder/ethread.c (test_libaom+0xeb2337) (BuildId: dfaafafddb94041405c7af7daff74f722074c9b2)
    #10 av1_mc_flow_dispenser_mt /builds/AOMediaCodec/avm/av1/encoder/ethread.c:1362:3 (test_libaom+0xeb2337)
    #11 av1_tpl_setup_stats /builds/AOMediaCodec/avm/av1/encoder/tpl_model.c:1285:7 (test_libaom+0xf64dfa) (BuildId: dfaafafddb94041405c7af7daff74f722074c9b2)
    #12 denoise_and_encode /builds/AOMediaCodec/avm/av1/encoder/encode_strategy.c:909:18 (test_libaom+0x11e9e55) (BuildId: dfaafafddb94041405c7af7daff74f722074c

Please use labels and text to provide additional information.

See example failed job: https://gitlab.com/AOMediaCodec/avm/-/jobs/6896570582/viewer