1use ruda_kernel::dsl as kernel_dsl;
2use ruda_kernel::dsl::ir::StorageType;
3use ruda_kernel::dsl::server::LaunchError;
4use thiserror::Error;
5
6#[derive(Error, Debug, Clone)]
7pub enum ReduceError {
9 #[error(
11 "Trying to launch a kernel using plane instructions, but there are not supported by the hardware."
12 )]
13 PlanesUnavailable,
14 #[error("The ruda count is larger than the max supported.")]
16 RudaCountTooLarge,
17
18 #[error("A generic validation error: {details}")]
20 Validation { details: &'static str },
21
22 #[error(
24 "Trying to launch a kernel using plane instructions, but the min and max plane dimensions are different."
25 )]
26 ImprecisePlaneDim,
27 #[error("The provided axis ({axis}) must be smaller than the input tensor rank ({rank}).")]
29 InvalidAxis { axis: usize, rank: usize },
30 #[error(
32 "The input reduce axis length (currently {axis_length:?}) should be at least k ({k:?})."
33 )]
34 ReduceAxisTooSmall { axis_length: usize, k: usize },
35 #[error("The output shape (currently {output_shape:?}) should be {expected_shape:?}.")]
37 MismatchOutputShape {
38 expected_shape: Vec<usize>,
39 output_shape: Vec<usize>,
40 },
41 #[error("Atomic add not supported by the client for {0}")]
43 MissingAtomicAdd(StorageType),
44
45 #[error("An error happened during launch\nCaused by:\n {0}")]
47 Launch(LaunchError),
48}