Comments (7)
Ok, I found the old fix I did for XMRig: xmrig/xmrig@75c57f7
This is now in #9042 and #9043
from monero.
There is no point to optimize this part of the code. Even when Cryptonight was Monero's PoW, this function accounted for < 0.1% of the hashing time, at best. Right now Cryptonight is only used as a key derivation function (KDF) for wallet files.
from monero.
This is a compiler bug, because gcc 9.4.0 compiles it correctly:
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # ls -la
total 44
drwxr-xr-x 2 root root 4096 Oct 27 13:56 .
drwx------ 8 root root 4096 Oct 27 13:55 ..
-rw-r--r-- 1 root root 25746 Aug 27 2021 jh.c
-rw-r--r-- 1 root root 849 Aug 27 2021 jh.h
-rw-r--r-- 1 root root 1489 Oct 27 13:55 main.c
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # gcc -O3 *.c -o test
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # ./test
0xea252e4fe0d223d17925f61058e2809da4896f12db26fce35faa5534575b8ce0
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # gcc -Ofast *.c -o test
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # ./test
0xea252e4fe0d223d17925f61058e2809da4896f12db26fce35faa5534575b8ce0
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
from monero.
Incorrect result for gcc 11.4.0 confirmed:
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # gcc-11 -O3 *.c -o test
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # ./test
0x48e84a3a785b8d5038d46c46ad4a09e2b8e019a6a8450acec7f36851c8dab0a7
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # gcc-11 --version
gcc-11 (Ubuntu 11.4.0-2ubuntu1~20.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
from monero.
If I compile with UB sanitizer, the error magically disappears, and no undefined behavior is found:
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # gcc-11 -O3 *.c -o test -fsanitize=undefined
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # ./test
0xea252e4fe0d223d17925f61058e2809da4896f12db26fce35faa5534575b8ce0
So it's a compiler bug.
from monero.
@SChernykh Thanks for your fix.
from monero.
I have seen https://www3.ntu.edu.sg/home/wuhj/research/jh/jh_sse2_opt64.h is optimize for sse2 and it 3 times faster. Do you have a plan to support it ? @SChernykh thanks!
from monero.
Related Issues (20)
- Mon
- Feature request: Add operating system and platform to get_info HOT 6
- Feature Request: Truly random subaddress generation by default HOT 7
- "Exception in main! Error adding spent key image to db transaction: MDB_BAD_TXN..." On Mac OS Sonoma HOT 14
- Protobuf Now Mandatory HOT 4
- monerod killed with SIGSEGV after loading blockchain (Segmentation fault after "setting m_height") on archlinux HOT 3
- start of monerod gives "Segmentation fault (core dumped)" on Archlinux HOT 3
- Monerod crashing on Macbook Pro M1 HOT 3
- Incorrect amounts for wallet transaction after key image sync HOT 2
- Add recurring payments HOT 3
- openalias starting with any digit is invalid HOT 1
- Troubleshooting monerod, pauses at 2688969 finds no new blocks HOT 6
- possible error with priority node connection HOT 15
- WRONG DATA CONVERSION: from type=d to type m HOT 8
- print_height displays higher by 1 number on stagenet HOT 4
- Fast Sync checkpoints for stagenet HOT 1
- Can't create cold transaction! HOT 12
- Error with blockchain after abnormal shutdown HOT 7
- Algorithm for getting Mnemonic Seed from 256-bitsHexadecimal Seed HOT 12
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 monero.