Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions COORDINATOR.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,21 @@ When `last_proof_block_hash` changes, the feeder drives the round state
machine. Startup drives the same machine. Mining is the last state. A new
qblock head in any state returns the machine to the first state.

### Probe screen (optional)

With `QUIP_SCREEN_BIN` pointing at `quip-screen` (quip-miner-cuda), the feeder
starts it as a sidecar on the first poll. It writes the snapshot's topology to
`$TMPDIR/quip-screen-<hash>.json`, passes `--spec` and `QUIP_SCREEN_ARGS`, and
sends `R <generation> <prev hash> <identity>` on every round change. The
sidecar probes fresh salts with the same `derive_nonce` and prints the deepest
as `K <generation> <salt> <energy>`. When topping up a `cuda*` miner, the
feeder pops the deepest queued salt of the current generation and derives the
job from it with `derive_pow_job`, so validation, stash and submission do not
change. With the queue empty it stages nothing for that miner, which leaves the
GPU to the screen; `QUIP_SCREEN_FALLBACK=1` tops it up with counter salts
instead. If the sidecar exits, the feeder uses counter salts. A topology change
restarts the sidecar with a new spec. Module: `screen.rs`.

### Round state machine

The states, in order:
Expand Down
1 change: 1 addition & 0 deletions crates/quip-coordinator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub mod readiness;
pub mod round;
pub mod router;
pub mod runtime;
pub mod screen;
pub mod session;
pub mod stash;
pub mod supervisor;
Expand Down
22 changes: 20 additions & 2 deletions crates/quip-coordinator/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,11 @@ pub async fn feeder_loop<C>(
// and emitted off-lock below. The completion pair is (window,
// total): window is completions since the last heartbeat.
let mut stats: Vec<(String, u64, u64, usize, usize)> = Vec::new();
// Probe screen: tell the sidecar which round to screen.
let screen_on = crate::screen::enabled();
if screen_on {
crate::screen::announce(generation, &snap, params.miner_identity);
}
for id in st.router.miner_ids() {
let consumed_raw = st.router.take_consumed(&id);
let consumed = f64::from(consumed_raw);
Expand All @@ -1005,8 +1010,21 @@ pub async fn feeder_loop<C>(
params.buffer_depth,
));
while st.router.staged_len(&id) < depth {
salt_ctr = salt_ctr.saturating_add(1);
let salt = salt_from_counter(salt_ctr);
// Probe screen: the CUDA miner gets the deepest screened
// salt; counter salts only as the configured fallback.
let salt = if screen_on && id.starts_with("cuda") {
match crate::screen::pop(generation) {
Some(s) => s,
None if crate::screen::fallback() => {
salt_ctr = salt_ctr.saturating_add(1);
salt_from_counter(salt_ctr)
}
None => break,
}
} else {
salt_ctr = salt_ctr.saturating_add(1);
salt_from_counter(salt_ctr)
};
let job = match derive_pow_job(
&snap,
params.miner_identity,
Expand Down
Loading
Loading