functions to control nonce space and timeouts for all chip topologies#420
functions to control nonce space and timeouts for all chip topologies#420adammwest wants to merge 23 commits intobitaxeorg:masterfrom
Conversation
|
There is an off-by-one error somewhere: coming from this code in I set the Should it be: Not sure where the Other than that, it seems to be hashing fine with these settings on my Supra. |
7ea45fe to
1138572
Compare
|
Is the BM1397 still unknown, as it doesn't set register |
By the way, literal This implies that — see Section 6.3.1.8 ("Usual arithmetic conversions") — the other term of the division will be automatically converted to So the idiomatic way of writing such expression should be Useless cast can confuse expert C programmers because they seem to imply that the standard can't be expected to hold (for some unspecified reason). |
|
That's pretty exciting! I assume this won't work on the BM1397 (bitaxeMax) and prolly not on the upcoming BZM2 as they don't roll version. Nonetheless I think this is worth implementing. |
Removed nonce_percentage and timeout_percentage to simplify the code
It's super interesting, there is code for the BM1397, not sure how it'll handle though, I only have a Supra and Gamma. And how does it need to be controlled? Having the full scan range and the maximum ASIC job timeout clearly causes issues, both with the pool as well as with ESP-Miner itself, as jobs are active way too long. |
Only if we have rolling nonce for BM1397. |
2cf61c7 to
5156662
Compare
components/asic/asic.c
Outdated
| // no version-rolling so same Nonce Space is splitted between Big Cores | ||
| return calculate_bm_timeout_ms(freq, asic_count, small_cores, cores, 4.0, ASIC_SET_TIMEOUT_PERCENT, 20); | ||
| case BM1366: | ||
| // ASIC_calculate_bm_timeout_ms(GLOBAL_STATE, GLOBAL_STATE->version_mask >> 13, 1.0); |
There was a problem hiding this comment.
change comment ASIC_calculate_bm_timeout_ms to calculate_bm_timeout_ms,
consider adding new default config default_timeout to device_config.h
maybe move // ASIC_calculate_bm_timeout_ms(GLOBAL_STATE, GLOBAL_STATE->version_mask >> 13, 1.0);
to the PR description rather than have a comment for future use


What
relavent Issues/Prs
Goals
Search Space
there is the nonce space 32 bits
there is the version space 16 bits (BIP320)
there is ntime space ~12 bits (mpt, current time + 7200)
there is extranonce2 space ~64+bits
General mining info for ASICS
Typically ASICs will mine nonces first, but now they are so fast they have to mine more things,
in terms of cheapness ntime is good and versions are good due to ASICBOOST.
The general hierarchy is
hash boards -> chips -> cores
The older chips (Bitaxe Max), were supplied midstates
BM1397
the bitcoin header is to big to fit in 1 SHA compression so its split into 2
block0 block1
[midstate0][0,2,3,....]
[midstate1][0,2,3,....]
[midstate2][0,2,3,....]
[midstate3][0,2,3,....]
the purpose is share the message scheduler of SHA1 (first sha second block)
but this budens the controller to send work very fast to the chips
anyway there were 4 midstates and 672 small cores
so that means 168 cores on the chip each core does a independant search on the nonce range
core0 [0,2,3,....]
core1 [0,2,3,....] * offset1
...
core167 [0,2,3,....] * offset167
but how do we divide 168 cores into 2^32, we cant so this means there is a hole in the search.
168/256 = ~62.5% of the nonce space is covered due to the HW cores
in more recent BITMAIN chips
BM1370 we have version rolling
with version rolling
we manipulate the nversion field so we have more space to search, we have 2^16 available values
the BM1370 has 128 cores and 2040 small cores, there are 8 cores missing, 4 cores are missing on core 15 and 4 on core 127
these are the version generators
now our pipeline is more advanced
we generate 16 versions and supply then to each core
core 0 [0,1,2,3,....]
...
core 127 [0,1,2,3,....] * offset128
then we repeat, until 2^16 have run out or 4096 iterations.
Finally these ideas easily extend to multiple chips
when we have multiple chips we must also divide the nonce/version space per chip, then we can parellize.
CHIP 0
core n CHIP0 offset + [0,1,2,3,....] * n
CHIP 1
core n CHIP1 offset + [0,1,2,3,....] * n
In a simple system we have the following equation
time = size / freqthe PR tries to figure out the above timeout equation for different configurations
Finally, the nonce and version space is configurable as well.
currently in ESP-miner the nonce range is roughly 1/64
To control nonces we need hash counting number register
The hcn is a nonce limiter, and after it completes and restarts a new version is generated
figuring out the Maximum HCN is a solution to a dynamic equation, this enables setting the whole nonce space for different frequencies, chip length chains and core counts.
Note: The size is dependent on frequency which is odd.
after calculating the HCN max which is the equivalent to nonce space 100%, the timeout is easy, you just need non parallel space of the chip and frequency
Additional Note
This should work for any versions/hcn value/frequency/chip count
Testing TODO
hex
gammaturbo
gamma
supra
ultra
max
naja