Comments (7)
At present, I suspect that qume's floating-point fmadd are not accurate enough.
from v8.
nice catch.
if it is a QEMU bug, the simulator team in PLCT would fix it.
you can report the issue to
https://github.com/isrc-cas/plct-qemu/issues
and mention Junqiang Wang or Weiwei Li. They would have a look for us.
from v8.
At present, I suspect that fmadd are not accurate enough.
I run the code on hifive unleashed:
int main() {
float a = 67.56f, b = -1012.01f, c = 3456.13f;
float acc = a * b + c;
float exxpected = 67.56f * (-1012.01f) + 3456.13f;
std::cout << (exxpected == acc) << " " << exxpected << " " << acc << std::endl;
asm(
"fmadd.s %0,%1,%2,%3\n"
:"=f"(acc)
:"f"(a),"f"(b),"f"(c)
:
);
std::cout << (exxpected == acc) << " " << exxpected << " " << acc << std::endl;
return 0;
}
output:
1 -64915.3 -64915.3
0 -64915.3 -64915.3
compile command:
riscv64-unknown-linux-gnu-g++ ./test.cpp -o test
from v8.
#include <limits>
#include<iostream>
#include<string.h>
int main() {
float a = 67.56f, b = -1012.01f, c = 3456.13f;
float acc;
float exxpected = 67.56f * (-1012.01f) + 3456.13f;
asm(
"fmul.s %0,%1,%2\n"
"fadd.s %0,%0,%3\n"
:"=f"(acc)
:"f"(a),"f"(b),"f"(c)
:
);
std::cout << (exxpected == acc) << " " << exxpected << " " << acc << std::endl;
asm(
"fmadd.s %0,%1,%2,%3\n"
:"=f"(acc)
:"f"(a),"f"(b),"f"(c)
:
);
std::cout << (exxpected == acc) << " " << exxpected << " " << acc << std::endl;
return 0;
}
from v8.
I run cctest/test-assembler-riscv64/RISCV_UTEST_swlwu
On qemu
Linux fedora-riscv 5.4.0-0.rc7.git0.1.1.riscv64.fc32.riscv64 #1 SMP Thu Nov 21 16:53:49 UTC 2019 riscv64 riscv64 riscv64 GNU/Linux
=== cctest/test-assembler-riscv64/RISCV_UTEST_swlwu ===
converted_res:int 2238380180 856af894
expected_res:int -2056587116 856af894
0
#
# Fatal error in ../../test/cctest/test-assembler-riscv64.cc, line 149
# Check failed: converted_res == expected_res (2238380180 vs. -2056587116).
#
#
#
#FailureMessage Object: 0x3fffc80ad8
==== C stack trace ===============================
/root/cctest(v8::base::debug::StackTrace::StackTrace()+0x18) [0x2aba73f6ba]
/root/cctest(+0x3c2e488) [0x2aba6aa488]
/root/cctest(V8_Fatal(char const*, int, char const*, ...)+0xe2) [0x2aba4a4456]
/root/cctest(+0x17b94c8) [0x2ab82354c8]
/root/cctest(+0x17bfc54) [0x2ab823bc54]
/root/cctest(CcTest::Run()+0x9e) [0x2ab7b61caa]
/root/cctest(main+0x36e) [0x2ab7ae99de]
/lib64/lp64d/libc.so.6(__libc_start_main+0xa0) [0x3fc12362a2]
/root/cctest(_start+0x2c) [0x2ab7b5f1ec]
Command: cctest test-assembler-riscv64/RISCV_UTEST_swlwu --random-seed=1431394633 --nohard-abort --enable-slow-asserts --verify-heap --testing-d8-test-runner
[00:08|% 0|+ 0|- 1]: Done
>>> 6579 base tests produced 1 (0%) non-filtered tests
>>> 1 tests ran
riscv64 toolchain
Using built-in specs.
COLLECT_GCC=riscv64-unknown-linux-gnu-g++
COLLECT_LTO_WRAPPER=/home/user/opt/riscv64/libexec/gcc/riscv64-unknown-linux-gnu/10.1.0/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with: /home/user/qemu/plct-toolbox/riscv-gnu-toolchain/riscv-gcc/configure --target=riscv64-unknown-linux-gnu --prefix=/home/user/opt/riscv64 --with-sysroot=/home/user/opt/riscv64/sysroot --with-system-zlib --enable-shared --enable-tls --enable-languages=c,c++,fortran --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libsanitizer --disable-nls --disable-bootstrap --src=.././riscv-gcc --disable-multilib --with-abi=lp64d --with-arch=rv64imafdc --with-tune=rocket 'CFLAGS_FOR_TARGET=-O2 -mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-O2 -mcmodel=medlow'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.1.0 (GCC)
Output on x86 by clang or gcc7.5:
converted_res: -2056587116 856af894
expected_res: -2056587116 856af894
1
from v8.
I run cctest/test-assembler-riscv64/RISCV_UTEST_swlwu
My code
https://github.com/luyahan/v8/blob/fix-macroassembler-test-macro_float_minmax_f64/test/cctest/test-assembler-riscv64.cc#L146
On qemu
Linux fedora-riscv 5.4.0-0.rc7.git0.1.1.riscv64.fc32.riscv64 #1 SMP Thu Nov 21 16:53:49 UTC 2019 riscv64 riscv64 riscv64 GNU/Linux=== cctest/test-assembler-riscv64/RISCV_UTEST_swlwu ===
converted_res:int 2238380180 856af894
expected_res:int -2056587116 856af894
0Fatal error in ../../test/cctest/test-assembler-riscv64.cc, line 149
Check failed: converted_res == expected_res (2238380180 vs. -2056587116).
#FailureMessage Object: 0x3fffc80ad8
==== C stack trace ===============================/root/cctest(v8::base::debug::StackTrace::StackTrace()+0x18) [0x2aba73f6ba] /root/cctest(+0x3c2e488) [0x2aba6aa488] /root/cctest(V8_Fatal(char const*, int, char const*, ...)+0xe2) [0x2aba4a4456] /root/cctest(+0x17b94c8) [0x2ab82354c8] /root/cctest(+0x17bfc54) [0x2ab823bc54] /root/cctest(CcTest::Run()+0x9e) [0x2ab7b61caa] /root/cctest(main+0x36e) [0x2ab7ae99de] /lib64/lp64d/libc.so.6(__libc_start_main+0xa0) [0x3fc12362a2] /root/cctest(_start+0x2c) [0x2ab7b5f1ec]
Command: cctest test-assembler-riscv64/RISCV_UTEST_swlwu --random-seed=1431394633 --nohard-abort --enable-slow-asserts --verify-heap --testing-d8-test-runner
[00:08|% 0|+ 0|- 1]: Done6579 base tests produced 1 (0%) non-filtered tests
1 tests ranriscv64 toolchain
Using built-in specs.
COLLECT_GCC=riscv64-unknown-linux-gnu-g++
COLLECT_LTO_WRAPPER=/home/user/opt/riscv64/libexec/gcc/riscv64-unknown-linux-gnu/10.1.0/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with: /home/user/qemu/plct-toolbox/riscv-gnu-toolchain/riscv-gcc/configure --target=riscv64-unknown-linux-gnu --prefix=/home/user/opt/riscv64 --with-sysroot=/home/user/opt/riscv64/sysroot --with-system-zlib --enable-shared --enable-tls --enable-languages=c,c++,fortran --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libsanitizer --disable-nls --disable-bootstrap --src=.././riscv-gcc --disable-multilib --with-abi=lp64d --with-arch=rv64imafdc --with-tune=rocket 'CFLAGS_FOR_TARGET=-O2 -mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-O2 -mcmodel=medlow'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.1.0 (GCC)Output on x86 by clang or gcc7.5:
converted_res: -2056587116 856af894
expected_res: -2056587116 856af894
1
On qemu
./cctest test-assembler-riscv64/RISCV_UTEST_swlwu --random-seed=-842269837 --nohard-abort --enable-slow-asserts --verify-heap --testing-d8-test-runner
report error.
b ValidateResult<int, int> ()
Thread 1 "cctest" hit Breakpoint 4, ValidateResult<int, int> ()
(gdb) info r a0
a0 0x856af894 2238380180
(gdb) info r a1
a1 0xffffffff856af894 -2056587116
(gdb)
may be the value 0x856af894 is zero extend in a0, and sign extend in a1?
from v8.
This issue had be fixed by #38 .
from v8.
Related Issues (20)
- regress-1125951.js failed after #661 HOT 1
- Test riscv32 native release HOT 2
- cctest test-code-generator/Regress_1171759 fails on native test mode HOT 1
- cctest test-macro-assembler-riscv32/macro_float_minmax_f32(64) fails on native test mode HOT 4
- mjsunit/regress/regress-crbug-1209152.js fails on native test mode HOT 1
- test/mjsunit/regress/regress-crbug-1041232.js fails on native test mode HOT 3
- RVC cases fails on native test mode
- check failed: *instance == frame_finder.frame()->wasm_instance() HOT 2
- cctest/test-api/TurboAsmDisablesDetach fails HOT 1
- cctest/test-run-wasm-module/Run_WasmModule_CompilationHintsLazy fails
- Cross build v8 failed with error: unrecognized command-line option '--target=riscv64-linux-gnu' HOT 7
- TraceMemRd/Wr for double in simulator should be refactor HOT 1
- [doc] How to cross compile v8 for riscv32 architecture on x86_64 linux
- cctest run-wasm RunWasmLiftoff_I32Binop_DivS fails HOT 1
- Record regression status for commit ddc083 HOT 1
- Octane failed on Unmatched HOT 3
- rv32 debug stress mode failed
- generic-wrapper test failed HOT 1
- v8 run test failed HOT 4
- Tracking the test262 and mozilla test status of V8 RISC-V
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v8.