46 ms·
Can someone explain to me why RandomX miners don't just generate programs without branching? I'm a bit confused on why that's not possible
by OsrsNeedsf2P 6mo ago
Can someone explain to me why RandomX miners don't just generate programs without branching? I'm a bit confused on why that's not possible
- tardedmeme 6mo agoBecause it's designed to be hard to execute on anything that is not a CPU.
- OsrsNeedsf2P 6mo agoRight, but the program is generated by the miner. So the miner could just generate a program that has no branching, and run it on a GPU.
- tardedmeme 6mo agoEach program is guaranteed to have a certain number of certain types of instructions, such as (IIRC) exactly one divide instruction.
- hyc_symas 6mo agoSince the programs are randomly generated, there's no guarantee that any particular program always uses some number of any particular instruction. There's only a probability, X/256 instructions will be somesuch operation.
- captn3m0 6mo agoThe program is randomly generated and I am guessing that the seed for this is deterministically determined from the current block head (or something similar) making it hard to attack. It might lead to scenarios where a miner may optimise block generation itself, I guess? I was more curious about the possibility of generating optimised branchless variants and then running them in parallel on multiple ASICs to ensure you cover every branch and submit all the results and hope you’re fast? Would that be more inefficient than relying on branch prediction and CPUs?
- captn3m0 6mo agoRead a little and turns out Monero requires a chain of programs, each with a Blake hash construction to generate the next one. That makes it very hard to optimise since it adds a layer of “hard to avoid” branching. And this also makes it hard to generate favorable programs.
- kedihacker 6mo agoIt can skip but it has 7 more programs to go and it can only know the program after completing the first one so after first one there is no advantage