brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.9 KiB · fa0e0b2 Raw
57 lines · plain
1// Check that types, widths, __CLANG_ATOMIC* macros, etc. match on the host and2// device sides of CUDA compilations. Note that we filter out long double and3// maxwidth of _BitInt(), as this is intentionally different on host and device.4//5// Also ignore __CLANG_ATOMIC_LLONG_LOCK_FREE on i386. The default host CPU for6// an i386 triple is typically at least an i586, which has cmpxchg8b (Clang7// feature, "cx8"). Therefore, __CLANG_ATOMIC_LLONG_LOCK_FREE is 2 on the host,8// but the value should be 1 for the device.9//10// Unlike CUDA, the width of SPIR-V POINTER type could differ between host and11// device, because SPIR-V explicitly sets POINTER type width. So it is the12// user's responsibility to choose the offload with the right POINTER size,13// otherwise the values for __CLANG_ATOMIC_POINTER_LOCK_FREE could be different.14 15// RUN: mkdir -p %t16 17// RUN: %clang --cuda-host-only -nocudainc -nocudalib --offload=spirv32 -target i386-unknown-linux-gnu -x cuda -emit-llvm -E -dM -o - /dev/null \18// RUN:   | grep -E '__CLANG_ATOMIC' \19// RUN:   | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/i386-host-defines-filtered20// RUN: %clang --cuda-device-only -nocudainc -nocudalib --offload=spirv32 -target i386-unknown-linux-gnu -x cuda -emit-llvm -E -dM -o - /dev/null \21// RUN:   | grep -E '__CLANG_ATOMIC' \22// RUN:   | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/i386-device-defines-filtered23// RUN: diff %t/i386-host-defines-filtered %t/i386-device-defines-filtered24 25// RUN: %clang --cuda-host-only -nocudainc -nocudalib --offload=spirv32 -target i386-windows-msvc -x cuda -emit-llvm -E -dM -o - /dev/null \26// RUN:   | grep -E '__CLANG_ATOMIC' \27// RUN:   | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/i386-msvc-host-defines-filtered28// RUN: %clang --cuda-device-only -nocudainc -nocudalib --offload=spirv32 -target i386-windows-msvc -x cuda -emit-llvm -E -dM -o - /dev/null \29// RUN:   | grep -E '__CLANG_ATOMIC' \30// RUN:   | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/i386-msvc-device-defines-filtered31// RUN: diff %t/i386-msvc-host-defines-filtered %t/i386-msvc-device-defines-filtered32 33// RUN: %clang --cuda-host-only -nocudainc -nocudalib --offload=spirv64 -target x86_64-unknown-linux-gnu -x cuda -emit-llvm -E -dM -o - /dev/null \34// RUN:   | grep -E '__CLANG_ATOMIC' \35// RUN:   | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/x86_64-host-defines-filtered36// RUN: %clang --cuda-device-only -nocudainc -nocudalib --offload=spirv64 -target x86_64-unknown-linux-gnu -x cuda -emit-llvm -E -dM -o - /dev/null \37// RUN:   | grep -E '__CLANG_ATOMIC' \38// RUN:   | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/x86_64-device-defines-filtered39// RUN: diff %t/x86_64-host-defines-filtered %t/x86_64-device-defines-filtered40 41// RUN: %clang --cuda-host-only -nocudainc -nocudalib --offload=spirv64 -target powerpc64-unknown-linux-gnu -x cuda -emit-llvm -E -dM -o - /dev/null \42// RUN:   | grep -E '__CLANG_ATOMIC' \43// RUN:   | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/powerpc64-host-defines-filtered44// RUN: %clang --cuda-device-only -nocudainc -nocudalib --offload=spirv64 -target powerpc64-unknown-linux-gnu -x cuda -emit-llvm -E -dM -o - /dev/null \45// RUN:   | grep -E '__CLANG_ATOMIC' \46// RUN:   | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/powerpc64-device-defines-filtered47// RUN: diff %t/powerpc64-host-defines-filtered %t/powerpc64-device-defines-filtered48 49// RUN: %clang --cuda-host-only -nocudainc -nocudalib --offload=spirv64 -target x86_64-windows-msvc -x cuda -emit-llvm -E -dM -o - /dev/null \50// RUN:   | grep -E '__CLANG_ATOMIC' \51// RUN:   | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/x86_64-msvc-host-defines-filtered52// RUN: %clang --cuda-device-only -nocudainc -nocudalib --offload=spirv64 -target x86_64-windows-msvc -x cuda -emit-llvm -E -dM -o - /dev/null \53// RUN:   | grep -E '__CLANG_ATOMIC' \54// RUN:   | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/x86_64-msvc-device-defines-filtered55// RUN: diff %t/x86_64-msvc-host-defines-filtered %t/x86_64-msvc-device-defines-filtered56 57