Skip to content
Draft
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
1 change: 0 additions & 1 deletion crates/cubecl-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ web-time = { workspace = true }

thiserror = { workspace = true }
ahash = { version = "0.8.12", default-features = false }
md5 = { workspace = true }

# Persistent cache deps - has to match the cfg(std_io) cfg.
[target.'cfg(any(target_os = "windows", target_os = "linux", target_os = "macos", target_os = "android"))'.dependencies]
Expand Down
13 changes: 10 additions & 3 deletions crates/cubecl-runtime/src/tune/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ use alloc::vec::Vec;
use core::fmt::{Debug, Display};
use core::hash::Hash;

use alloc::format;

use super::{
AutotuneError, input_generator::InputGenerator, key_generator::KeyGenerator,
tune_inputs::TuneInputs,
Expand Down Expand Up @@ -93,12 +91,21 @@ impl<K: AutotuneKey, F: TuneInputs, Output: 'static> TunableSet<K, F, Output> {

/// Compute a checksum that invalidates outdated cached auto-tune results when the
/// set of tunable names changes.
#[cfg(std_io)]
pub fn compute_checksum(&self) -> String {
let mut checksum = String::new();
for tune in &self.tunables {
checksum += &tune.function.name;
}
format!("{:x}", md5::compute(checksum))
alloc::format!(
"{:x}",
cubecl_common::hash::StableHasher::hash_one(&checksum)
)
}

#[cfg(not(std_io))]
pub fn compute_checksum(&self) -> String {
String::new()
}

/// Generate a key from a set of inputs
Expand Down