-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
813f705
commit c0966de
Showing
6 changed files
with
179 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,40 @@ | ||
use alloc::fmt::Debug; | ||
use cranelift::prelude::FunctionBuilder; | ||
use cranelift_codegen::ir::Function; | ||
use cubecl_core::ExecutionMode; | ||
use cubecl_core::{Compiler, ExecutionMode}; | ||
|
||
pub struct FunctionCompiler<'a> { | ||
builder: FunctionBuilder<'a>, | ||
use super::FfiFunction; | ||
|
||
#[derive(Clone)] | ||
pub struct FunctionCompiler { | ||
//builder: FunctionBuilder<'static>, | ||
exec_mode: ExecutionMode, | ||
} | ||
|
||
impl Compiler for FunctionCompiler { | ||
type Representation = FfiFunction; | ||
|
||
type CompilationOptions = (); | ||
|
||
fn compile( | ||
&mut self, | ||
kernel: cubecl_core::prelude::KernelDefinition, | ||
compilation_options: &Self::CompilationOptions, | ||
mode: ExecutionMode, | ||
) -> Self::Representation { | ||
todo!() | ||
} | ||
|
||
fn elem_size(&self, elem: cubecl_core::ir::Elem) -> usize { | ||
todo!() | ||
} | ||
} | ||
|
||
impl Debug for FunctionCompiler { | ||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> std::fmt::Result { | ||
f.debug_struct("FunctionCompiler") | ||
.field("exec_mode", &self.exec_mode) | ||
//.field("builder_func", &self.builder.func) | ||
.finish() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
Corresponds to wgpu/compiler/shader.rs. The compiled executable kernel functions, stored | ||
as dynamically linked libraries. | ||
*/ | ||
|
||
use alloc::fmt::Display; | ||
|
||
use cubecl_core::compute::Binding; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct FfiFunction { | ||
pub inputs: Vec<Binding>, | ||
pub outputs: Vec<Binding>, | ||
pub kernel_name: String, | ||
} | ||
|
||
impl Display for FfiFunction { | ||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> std::fmt::Result { | ||
write!(f, "FfiFunction {{ kernel_name: {} }}", self.kernel_name) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.