1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use super::logger::{LogLevel, LoggerConfig};
/// Configuration for compilation settings in `CubeCL`.
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct CompilationConfig {
/// Logger configuration for compilation logs, using binary log levels.
#[serde(default)]
pub logger: LoggerConfig<CompilationLogLevel>,
/// Whether compiled kernels are cached in the active environment.
#[serde(default)]
#[cfg(std_io)]
pub cache: bool,
/// Controls whether kernel launches enforce bounds checks.
#[serde(default)]
pub check_mode: BoundsCheckMode,
}
/// Bounds checks options.
#[derive(Default, Clone, Copy, Debug, serde::Serialize, serde::Deserialize)]
pub enum BoundsCheckMode {
#[serde(rename = "enforce")]
/// Always enforce bounds checks on every kernel launch.
Enforce,
#[serde(rename = "validate")]
/// Always enforce bounds checks on every kernel launch, and validate unchecked kernels for OOB.
Validate,
/// Enforce bounds checking on standard launches, but skip checks on
/// explicitly unchecked launches for better performance.
#[default]
#[serde(rename = "auto")]
Auto,
}
/// Log levels for compilation in `CubeCL`.
#[derive(Default, Clone, Copy, Debug, serde::Serialize, serde::Deserialize)]
pub enum CompilationLogLevel {
/// Compilation logging is disabled.
#[default]
#[serde(rename = "disabled")]
Disabled,
/// Basic compilation information is logged such as when kernels are compiled.
#[serde(rename = "basic")]
Basic,
/// Full compilation details are logged including source code.
#[serde(rename = "full")]
Full,
}
impl LogLevel for CompilationLogLevel {}