fp16-abi: add test to check that Float16 ABI matches with clang
This commit is contained in:
parent
60a9f71c70
commit
ec1f44228b
3 changed files with 61 additions and 0 deletions
32
fp16-abi/main.fmf
Normal file
32
fp16-abi/main.fmf
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
summary: Test that Float16 ABI matches with clang
|
||||
test: "$WITH_SCL ./test.sh"
|
||||
framework: shell
|
||||
tier: 1
|
||||
component:
|
||||
- llvm-toolset
|
||||
- compiler-rt
|
||||
|
||||
adjust:
|
||||
- because: "Float16 not supported on s390x or ppc64le"
|
||||
enabled: false
|
||||
when: arch == s390x or arch == ppc64le
|
||||
|
||||
# Common requirements when LLVM is not SCL-ized
|
||||
- require+:
|
||||
- clang
|
||||
- compiler-rt
|
||||
when: collection is not defined
|
||||
|
||||
# Requirements for SCL-ized LLVM
|
||||
- require+:
|
||||
- llvm-toolset-13.0-clang
|
||||
- llvm-toolset-13.0-compiler-rt
|
||||
when: collection == llvm-toolset-13.0
|
||||
- require+:
|
||||
- llvm-toolset-14.0-clang
|
||||
- llvm-toolset-14.0-compiler-rt
|
||||
when: collection == llvm-toolset-14.0
|
||||
- require+:
|
||||
- llvm-toolset-15.0-clang
|
||||
- llvm-toolset-15.0-compiler-rt
|
||||
when: collection == llvm-toolset-15.0
|
||||
14
fp16-abi/test.cpp
Normal file
14
fp16-abi/test.cpp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Reproducer based on this code from Steve Leung (evetsso):
|
||||
// https://github.com/ROCmSoftwarePlatform/rocFFT/issues/439#issuecomment-1693835987
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
int main()
|
||||
{
|
||||
_Float16 one_f16 = 0.123;
|
||||
float one_f32 = one_f16;
|
||||
std::cout << one_f32 << std::endl;
|
||||
return 0;
|
||||
}
|
||||
15
fp16-abi/test.sh
Executable file
15
fp16-abi/test.sh
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh -ux
|
||||
# Do NOT set exit after error flag (set -e). Let all the optimizations to be run
|
||||
|
||||
tmp=$(mktemp -d)
|
||||
result=0
|
||||
# Test the reproducer with all the optimization levels
|
||||
for opt_level in 0 1 2 3; do
|
||||
clang++ --rtlib=compiler-rt -O$opt_level test.cpp -o $tmp/test_O$opt_level
|
||||
$tmp/test_O$opt_level | grep '0.122986' || result=1
|
||||
done
|
||||
|
||||
rm -rf $tmp
|
||||
if [[ "$result" == 1 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue