cubecl_core/codegen/
integrator.rs1use cubecl_ir::{ElemType, Scope, metadata::Info, settings::KernelSettings};
2use cubecl_runtime::kernel::KernelDefinition;
3
4#[derive(Debug)]
7pub struct KernelIntegrator {
8 expansion: KernelExpansion,
9}
10
11#[derive(Debug)]
13pub struct KernelExpansion {
14 pub scope: Scope,
15 pub info: Info,
16}
17
18#[derive(Clone, Debug)]
20pub struct ScalarInfo {
21 pub ty: ElemType,
22 pub count: usize,
23}
24
25impl KernelIntegrator {
26 pub fn new(info: KernelExpansion) -> Self {
28 Self { expansion: info }
29 }
30
31 #[cfg_attr(feature = "tracing", tracing::instrument(level = "trace", skip(self)))]
33 pub fn integrate(self, settings: KernelSettings) -> KernelDefinition {
34 KernelDefinition {
35 body: self.expansion.scope,
36 info: self.expansion.info,
37 settings,
38 }
39 }
40}