use cubecl::prelude::CubePrimitive;
use cubek_matmul::{
components::stage::PartitionBuffering,
definition::{MatmulElems, MatmulGlobalElems, TilingScheme},
};
use cubek_std::{PartitionSize, StageSize, SwizzleModes, TileSize};
use crate::suite::launcher_strategy::ConvolutionSize;
pub(crate) fn f16_dtypes() -> MatmulElems {
let f16 = half::f16::as_type_native_unchecked().storage_type();
MatmulElems::from_globals(&MatmulGlobalElems {
lhs: f16,
rhs: f16,
out: f16,
})
}
#[cfg(target_os = "macos")]
pub(crate) fn default_tile_size() -> TileSize {
TileSize { m: 8, n: 8, k: 8 }
}
#[cfg(not(target_os = "macos"))]
pub(crate) fn default_tile_size() -> TileSize {
TileSize {
m: 16,
n: 16,
k: 16,
}
}
pub(crate) fn small_partition() -> PartitionSize {
PartitionSize { m: 1, n: 1, k: 1 }
}
pub(crate) fn small_stage() -> StageSize {
StageSize { m: 2, n: 2, k: 1 }
}
pub(crate) fn default_tiling_scheme() -> TilingScheme {
TilingScheme::builder()
.with_tile_size(default_tile_size())
.with_partition_size(small_partition())
.with_stage_size(small_stage())
.build()
.unwrap()
}
pub(crate) fn default_swizzle() -> SwizzleModes {
SwizzleModes::default()
}
pub(crate) fn default_partition_buffering() -> PartitionBuffering {
PartitionBuffering::Single
}
pub(crate) fn small_size() -> ConvolutionSize {
ConvolutionSize {
h: 16,
w: 16,
c: 16,
out_c: 32,
}
}
pub(crate) fn medium_size() -> ConvolutionSize {
ConvolutionSize {
h: 32,
w: 32,
c: 32,
out_c: 16,
}
}