-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jemalloc not work in spec06 tests #7
Comments
https://github.com/jemalloc/jemalloc/wiki/Getting-Started |
That is helpful for me, thanks. shellHook = ''
# ...
export LDFLAGS_SUFFIX="${customJemalloc}/lib/libjemalloc.a -lm -pthread"
export LIBS="$LIBS $LDFLAGS_SUFFIX"
" in shell.nix, it linked jemalloc successfully. + LD -> build/471.omnetpp
/nix/store/djy0jdfvdqgn4wl5ys71r1fxki3c1mw4-riscv64-unknown-linux-gnu-binutils-2.43.1/bin/riscv64-unknown-linux-gnu-ld: /nix/store/09x1j6m3w9lnl6znh9hsaw8d8x143nqf-jemalloc-riscv64-unknown-linux-gnu-5.3.0/lib/libjemalloc.a(jemalloc_cpp.o): in function `operator new(unsigned long)':
(.text+0x12c): multiple definition of `operator new(unsigned long)'; /nfs/home/yanyue/tools/CPU2006LiteWrapper/471.omnetpp/build/src/libs/cmdenv/heap.o (symbol from plugin):(.text+0x0): first defined here
/nix/store/djy0jdfvdqgn4wl5ys71r1fxki3c1mw4-riscv64-unknown-linux-gnu-binutils-2.43.1/bin/riscv64-unknown-linux-gnu-ld: /nix/store/09x1j6m3w9lnl6znh9hsaw8d8x143nqf-jemalloc-riscv64-unknown-linux-gnu-5.3.0/lib/libjemalloc.a(jemalloc_cpp.o): in function `operator delete(void*)':
(.text+0x504): multiple definition of `operator delete(void*)'; /nfs/home/yanyue/tools/CPU2006LiteWrapper/471.omnetpp/build/src/libs/cmdenv/heap.o (symbol from plugin):(.text+0x0): first defined here resulted linked error, I used weak attributes for jemalloc operator, but it's not sufficient. preBuild = ''
# Add weak attribute to C++ operators, same as jemalloc_cpp.patch
sed -i 's/void \*operator new/void __attribute__((weak)) *operator new/g' src/jemalloc_cpp.cpp
sed -i 's/void operator delete/void __attribute__((weak)) operator delete/g' src/jemalloc_cpp.cpp
''; only operator delete[] is weak. ➜ CPU2006LiteWrapper git:(main) ✗ riscv64-unknown-linux-gnu-nm -C /nix/store/09x1j6m3w9lnl6znh9hsaw8d8x143nqf-jemalloc-riscv64-unknown-linux-gnu-5.3.0/lib/libjemalloc.a| grep -i "operator"
000000000000050c T operator delete[](void*)
000000000000051c W operator delete[](void*, std::nothrow_t const&)
0000000000000568 T operator delete[](void*, std::align_val_t)
0000000000000578 T operator delete[](void*, std::align_val_t, std::nothrow_t const&)
0000000000000542 T operator delete[](void*, unsigned long)
00000000000005ec T operator delete[](void*, unsigned long, std::align_val_t)
0000000000000504 T operator delete(void*)
0000000000000514 T operator delete(void*, std::nothrow_t const&)
0000000000000560 T operator delete(void*, std::align_val_t)
0000000000000570 T operator delete(void*, std::align_val_t, std::nothrow_t const&)
0000000000000524 T operator delete(void*, unsigned long)
0000000000000580 T operator delete(void*, unsigned long, std::align_val_t)
00000000000001ee T operator new[](unsigned long)
0000000000000372 T operator new[](unsigned long, std::nothrow_t const&)
0000000000000466 T operator new[](unsigned long, std::align_val_t)
00000000000004ce T operator new[](unsigned long, std::align_val_t, std::nothrow_t const&)
000000000000012c T operator new(unsigned long)
00000000000002b0 T operator new(unsigned long, std::nothrow_t const&)
0000000000000434 T operator new(unsigned long, std::align_val_t)
0000000000000498 T operator new(unsigned long, std::align_val_t, std::nothrow_t const&)
I should use jemalloc_cpp.patch like https://github.com/OpenXiangShan/CPU2006LiteWrapper/blob/main/jemalloc_cpp.patch , but it's only useful for specific jemalloc version(da66aa391f853ccf2300845b3873cc8f1cf48f2d or older), not elegant
Is there other way to fix it ? |
I also find some programs do not use jemalloc OpenXiangShan/CPU2006LiteWrapper#18 |
I fix it using jemalloc patch(only support jemalloc v3.5), still running , when I finish performance testing, I will push. |
I believe these two lines should work
|
It looks great for me, I try it locally, it works great. |
Did the nix-run even finish yet? coverage=1 does not mean it has finished. According to my previous experience, coverage is calculated based on m5out or something. So after warmup, the weight of that checkpoint has already been taken into account. This leads to problems like using stats from the warmup period to calculate scores. |
when I use
It shows binary use malloc instead of jemalloc which have lower performance in spec06 checkpoints.
Especially for omnetpp (4% performance lower) and xalancbmk(9% performance lower)!
The text was updated successfully, but these errors were encountered: