CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
93 lines
3.0 KiB
C++
93 lines
3.0 KiB
C++
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t 2>&1 | FileCheck %s
|
|
#include "test.h"
|
|
|
|
__m128i data[20];
|
|
|
|
__m128i load(__m128i *v) {
|
|
#if TSAN_VECTORIZE
|
|
return _mm_load_si128(v);
|
|
#else
|
|
return *v;
|
|
#endif
|
|
}
|
|
|
|
void store(__m128i *v, __m128i a) {
|
|
#if TSAN_VECTORIZE
|
|
_mm_store_si128(v, a);
|
|
#else
|
|
*v = a;
|
|
#endif
|
|
}
|
|
|
|
void *Thread(void *arg);
|
|
|
|
int main() {
|
|
barrier_init(&barrier, 2);
|
|
pthread_t th;
|
|
pthread_create(&th, NULL, Thread, NULL);
|
|
barrier_wait(&barrier);
|
|
|
|
print_address("addr0:", 2, &data[0], &data[0]);
|
|
auto v0 = load(&data[1]);
|
|
store(&data[0], v0);
|
|
// CHECK: addr0:[[ADDR0_0:0x[0-9,a-f]+]] [[ADDR0_1:0x[0-9,a-f]+]]
|
|
// CHECK: WARNING: ThreadSanitizer: data race
|
|
// CHECK: Write of size 8 at [[ADDR0_0]] by main thread:
|
|
// CHECK: Previous read of size 8 at [[ADDR0_1]] by thread T1:
|
|
|
|
print_address("addr1:", 2, (char *)&data[2] + 8, (char *)&data[2] + 8);
|
|
((volatile unsigned long long *)(&data[2]))[1] = 42;
|
|
// CHECK: addr1:[[ADDR1_0:0x[0-9,a-f]+]] [[ADDR1_1:0x[0-9,a-f]+]]
|
|
// CHECK: WARNING: ThreadSanitizer: data race
|
|
// CHECK: Write of size 8 at [[ADDR1_0]] by main thread:
|
|
// CHECK: Previous read of size 8 at [[ADDR1_1]] by thread T1:
|
|
|
|
print_address("addr2:", 2, (char *)&data[4] + 15, (char *)&data[4] + 8);
|
|
((volatile char *)(&data[4]))[15] = 42;
|
|
// CHECK: addr2:[[ADDR2_0:0x[0-9,a-f]+]] [[ADDR2_1:0x[0-9,a-f]+]]
|
|
// CHECK: WARNING: ThreadSanitizer: data race
|
|
// CHECK: Write of size 1 at [[ADDR2_0]] by main thread:
|
|
// CHECK: Previous read of size 8 at [[ADDR2_1]] by thread T1:
|
|
|
|
store(&data[12], v0);
|
|
((volatile unsigned long long *)(&data[14]))[1] = 42;
|
|
((volatile char *)(&data[16]))[15] = 42;
|
|
barrier_wait(&barrier);
|
|
pthread_join(th, NULL);
|
|
return 0;
|
|
}
|
|
|
|
void *Thread(void *arg) {
|
|
// Use only even indexes so that compiler does not insert memcpy.
|
|
auto v0 = load(&data[0]);
|
|
auto v1 = load(&data[2]);
|
|
auto v2 = load(&data[4]);
|
|
store(&data[6], v0);
|
|
store(&data[8], v1);
|
|
store(&data[10], v2);
|
|
barrier_wait(&barrier);
|
|
barrier_wait(&barrier);
|
|
|
|
print_address("addr3:", 2, &data[12], &data[12]);
|
|
store(&data[12], v0);
|
|
// CHECK: addr3:[[ADDR3_0:0x[0-9,a-f]+]] [[ADDR3_1:0x[0-9,a-f]+]]
|
|
// CHECK: WARNING: ThreadSanitizer: data race
|
|
// CHECK: Write of size 8 at [[ADDR3_0]] by thread T1:
|
|
// CHECK: Previous write of size 8 at [[ADDR3_1]] by main thread:
|
|
|
|
print_address("addr4:", 2, (char *)&data[14] + 8, (char *)&data[14] + 8);
|
|
store(&data[14], v0);
|
|
// CHECK: addr4:[[ADDR4_0:0x[0-9,a-f]+]] [[ADDR4_1:0x[0-9,a-f]+]]
|
|
// CHECK: WARNING: ThreadSanitizer: data race
|
|
// CHECK: Write of size 8 at [[ADDR4_0]] by thread T1:
|
|
// CHECK: Previous write of size 8 at [[ADDR4_1]] by main thread:
|
|
|
|
print_address("addr5:", 2, (char *)&data[16] + 8, (char *)&data[16] + 15);
|
|
store(&data[16], v0);
|
|
// CHECK: addr5:[[ADDR5_0:0x[0-9,a-f]+]] [[ADDR5_1:0x[0-9,a-f]+]]
|
|
// CHECK: WARNING: ThreadSanitizer: data race
|
|
// CHECK: Write of size 8 at [[ADDR5_0]] by thread T1:
|
|
// CHECK: Previous write of size 1 at [[ADDR5_1]] by main thread:
|
|
return NULL;
|
|
}
|