Skip to content

Commit 1dde7c6

Browse files
authored
feat(coprocessor): enable re-randomisation on GPU (#1837)
1 parent 35beead commit 1dde7c6

File tree

1 file changed

+1
-47
lines changed

1 file changed

+1
-47
lines changed

coprocessor/fhevm-engine/scheduler/src/dfg/scheduler.rs

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -299,29 +299,6 @@ fn re_randomise_transaction_inputs(
299299
}
300300
Ok(())
301301
}
302-
fn decompress_transaction_inputs(
303-
inputs: &mut HashMap<Handle, Option<DFGTxInput>>,
304-
transaction_id: &Handle,
305-
gpu_idx: usize,
306-
_cpk: tfhe::CompactPublicKey,
307-
) -> Result<()> {
308-
// TODO: implement re-randomisation on GPU. For now just decompress inputs
309-
for txinput in inputs.values_mut() {
310-
match txinput {
311-
Some(DFGTxInput::Value(_)) => {}
312-
Some(DFGTxInput::Compressed(((t, c), allowed))) => {
313-
let decomp = SupportedFheCiphertexts::decompress(*t, c, gpu_idx)?;
314-
*txinput = Some(DFGTxInput::Value((decomp, *allowed)));
315-
}
316-
None => {
317-
error!(target: "scheduler", { transaction_id = ?hex::encode(transaction_id) },
318-
"Missing transaction input while trying to decompress");
319-
return Err(SchedulerError::MissingInputs.into());
320-
}
321-
}
322-
}
323-
Ok(())
324-
}
325302

326303
type ComponentSet = Vec<(DFGraph, HashMap<Handle, Option<DFGTxInput>>, Handle, usize)>;
327304
fn execute_partition(
@@ -366,7 +343,7 @@ fn execute_partition(
366343
}
367344
}
368345

369-
if !cfg!(feature = "gpu") {
346+
{
370347
let mut s = tracer.start_with_context("rerandomise_inputs", &loop_ctx);
371348
telemetry::set_txn_id(&mut s, &tid);
372349
let started_at = std::time::Instant::now();
@@ -395,29 +372,6 @@ fn execute_partition(
395372
let elapsed = started_at.elapsed();
396373
RERAND_LATENCY_BATCH_HISTOGRAM.observe(elapsed.as_secs_f64());
397374
drop(s);
398-
} else {
399-
let mut s = tracer.start_with_context("decompress_transaction_inputs", &loop_ctx);
400-
telemetry::set_txn_id(&mut s, &tid);
401-
// If re-randomisation is not available (e.g., on GPU),
402-
// only decompress ciphertexts
403-
if let Err(e) = decompress_transaction_inputs(tx_inputs, &tid, gpu_idx, cpk.clone()) {
404-
error!(target: "scheduler", {transaction_id = ?hex::encode(tid), error = ?e },
405-
"Error while decompressing inputs");
406-
for nidx in dfg.graph.node_identifiers() {
407-
let Some(node) = dfg.graph.node_weight_mut(nidx) else {
408-
error!(target: "scheduler", {index = ?nidx.index() }, "Wrong dataflow graph index");
409-
continue;
410-
};
411-
if node.is_allowed {
412-
res.insert(
413-
node.result_handle.clone(),
414-
Err(SchedulerError::ReRandomisationError.into()),
415-
);
416-
}
417-
}
418-
continue 'tx;
419-
}
420-
drop(s);
421375
}
422376

423377
// Prime the scheduler with ready ops from the transaction's subgraph

0 commit comments

Comments
 (0)