Skip to content

armgit / uzu

Public Imported from GitHub
0

A high-performance inference engine for AI models

Remove CompilationConfig (#182)

uuuvnd426af35f322
diff --git a/crates/uzu/src/backends/metal/classifier_context.rs b/crates/uzu/src/backends/metal/classifier_context.rs
index 63f2843e1..a39f5db70 100644
--- a/crates/uzu/src/backends/metal/classifier_context.rs
+++ b/crates/uzu/src/backends/metal/classifier_context.rs
@@ -2,7 +2,6 @@ use std::{cell::RefCell, fs::File, io::BufReader, path::Path, rc::Rc};
use super::{
MTLCommandBuffer, MTLCommandQueue, MTLContext, ProtocolObject, Retained,
- compilation_parameters::CompilationConfig,
encodable_block::{
Activation, ClassifierLayer, ClassifierPredictionHead, Normalization, Pooling, Rope,
transformer_layer::{embed_block, linear_block},
@@ -69,7 +68,6 @@ impl ClassifierContext {
Rc::new(classifier_model_config.model_config.to_decoder_config().map_err(|_| Error::UnableToLoadConfig)?);
let model_shape = ModelShape::from_decoder_config(&decoder_config);
- let compilation_config = Rc::new(CompilationConfig::default());
let weights_path = model_path.join("model.safetensors");
if !weights_path.exists() {
return Err(Error::UnableToLoadWeights);
@@ -147,7 +145,6 @@ impl ClassifierContext {
Ok(ClassifierLayer::new(
context.clone(),
layer_config,
- compilation_config.clone(),
layer_index,
classifier_model_config.model_config.model_dim,
classifier_model_config.model_config.transformer_config.hidden_dim,
diff --git a/crates/uzu/src/backends/metal/compilation_parameters.rs b/crates/uzu/src/backends/metal/compilation_parameters.rs
deleted file mode 100644
index 1bae0ea58..000000000
--- a/crates/uzu/src/backends/metal/compilation_parameters.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-#[derive(Debug, Clone, Copy)]
-pub struct CompilationConfig {}
-
-impl CompilationConfig {
- pub fn default() -> Self {
- Self {}
- }
-}
diff --git a/crates/uzu/src/backends/metal/encodable_block/classifier_layer.rs b/crates/uzu/src/backends/metal/encodable_block/classifier_layer.rs
index d548afdb6..5d9c7990b 100644
--- a/crates/uzu/src/backends/metal/encodable_block/classifier_layer.rs
+++ b/crates/uzu/src/backends/metal/encodable_block/classifier_layer.rs
@@ -7,10 +7,7 @@ use super::{Attention, EncodableBlock, Normalization, QKNorm, TensorAddSwap, Ten
use crate::backends::metal::MTLCommandEncoder;
use crate::{
DataType,
- backends::metal::{
- MTLCommandBuffer, MTLComputeCommandEncoder, MTLContext, Metal, ProtocolObject, Retained,
- compilation_parameters::CompilationConfig,
- },
+ backends::metal::{MTLCommandBuffer, MTLComputeCommandEncoder, MTLContext, Metal, ProtocolObject, Retained},
config::TransformerLayerConfig,
encodable_block::EncodingParameters,
forward_pass::state::{ArrayId, ForwardPassState},
@@ -40,7 +37,6 @@ impl ClassifierLayer {
pub fn new(
mtl_context: Rc<MTLContext>,
layer_config: &TransformerLayerConfig,
- _compilation_config: Rc<CompilationConfig>,
layer_index: usize,
model_dim: usize,
hidden_dim: usize,
diff --git a/crates/uzu/src/backends/metal/encodable_block/decoder.rs b/crates/uzu/src/backends/metal/encodable_block/decoder.rs
index 782ad05a9..9f816e00c 100644
--- a/crates/uzu/src/backends/metal/encodable_block/decoder.rs
+++ b/crates/uzu/src/backends/metal/encodable_block/decoder.rs
@@ -7,7 +7,6 @@ use crate::{
DataType, DecoderConfig,
backends::metal::{
MTLCommandBuffer, MTLComputeCommandEncoder, MTLContext, Metal, ProtocolObject, Retained,
- compilation_parameters::CompilationConfig,
encodable_block::transformer_layer::{embed_block, readout_block},
},
config::{DecoderLayerType, MixerConfig},
@@ -34,7 +33,6 @@ impl Decoder {
mtl_context: Rc<MTLContext>,
decoder_config: Rc<DecoderConfig>,
root_weight_loader: &ParameterTree<MTLContext>,
- compilation_config: Rc<CompilationConfig>,
) -> Self {
let decoder_weight_loader = root_weight_loader.subtree("transformer").expect("transformer subtree not found");
@@ -106,7 +104,6 @@ impl Decoder {
mtl_context.clone(),
layer_config,
layer_type,
- compilation_config.clone(),
layer_index,
decoder_config.model_dim,
decoder_config.hidden_dim,
diff --git a/crates/uzu/src/backends/metal/encodable_block/layer/executables.rs b/crates/uzu/src/backends/metal/encodable_block/layer/executables.rs
index 8955a3296..eed7deb01 100644
--- a/crates/uzu/src/backends/metal/encodable_block/layer/executables.rs
+++ b/crates/uzu/src/backends/metal/encodable_block/layer/executables.rs
@@ -15,10 +15,7 @@ use super::{
use crate::backends::metal::MTLCommandEncoder;
use crate::{
DataType, DecoderLayerConfig,
- backends::metal::{
- MTLCommandBuffer, MTLComputeCommandEncoder, MTLContext, Metal, ProtocolObject, Retained,
- compilation_parameters::CompilationConfig,
- },
+ backends::metal::{MTLCommandBuffer, MTLComputeCommandEncoder, MTLContext, Metal, ProtocolObject, Retained},
config::{DecoderLayerType, MixerConfig},
encodable_block::EncodingParameters,
forward_pass::state::{ArrayId, ForwardPassState},
@@ -44,7 +41,6 @@ impl LayerExecutables {
mtl_context: Rc<MTLContext>,
layer_config: &DecoderLayerConfig,
layer_type: &DecoderLayerType,
- compilation_config: Rc<CompilationConfig>,
layer_index: usize,
model_dim: usize,
hidden_dim: usize,
@@ -157,7 +153,6 @@ impl LayerExecutables {
ctx,
layer_type.clone(),
mamba_config.clone(),
- compilation_config.clone(),
layer_index,
model_dim,
num_heads,
@@ -174,7 +169,6 @@ impl LayerExecutables {
ctx,
layer_type.clone(),
short_conv_config.clone(),
- compilation_config.clone(),
layer_index,
model_dim,
decoder_layer_loader,
diff --git a/crates/uzu/src/backends/metal/encodable_block/mamba_mixer.rs b/crates/uzu/src/backends/metal/encodable_block/mamba_mixer.rs
index 578ab69e8..0023390ad 100644
--- a/crates/uzu/src/backends/metal/encodable_block/mamba_mixer.rs
+++ b/crates/uzu/src/backends/metal/encodable_block/mamba_mixer.rs
@@ -1,6 +1,6 @@
//! Mamba2 SSM mixer encodable.
-use std::{env, rc::Rc};
+use std::env;
use super::{EncodableBlock, Metal, transformer_layer};
use crate::{
@@ -10,7 +10,6 @@ use crate::{
metal::{
MTLCommandBuffer, MTLCommandEncoder, MTLComputeCommandEncoder, MTLContext, MetalArray, ProtocolObject,
Retained,
- compilation_parameters::CompilationConfig,
kernel::{
dsl::{SSDUpdateMetalKernel, SplitInProjMetalKernel},
ssm::{
@@ -49,7 +48,6 @@ impl MambaMixer {
mtl_context: &MTLContext,
layer_type: DecoderLayerType,
mamba_config: Mamba2Config,
- _compilation_config: Rc<CompilationConfig>,
layer_index: usize,
model_dim: usize,
num_heads: usize,
diff --git a/crates/uzu/src/backends/metal/encodable_block/short_conv_mixer.rs b/crates/uzu/src/backends/metal/encodable_block/short_conv_mixer.rs
index 5dca379e9..c3328ecfe 100644
--- a/crates/uzu/src/backends/metal/encodable_block/short_conv_mixer.rs
+++ b/crates/uzu/src/backends/metal/encodable_block/short_conv_mixer.rs
@@ -1,5 +1,3 @@
-use std::rc::Rc;
-
use super::{EncodableBlock, Metal, transformer_layer};
use crate::{
DataType,
@@ -8,7 +6,6 @@ use crate::{
metal::{
MTLCommandBuffer, MTLCommandEncoder, MTLComputeCommandEncoder, MTLContext, MetalArray, ProtocolObject,
Retained,
- compilation_parameters::CompilationConfig,
kernel::short_conv::{
ShortConvDecodeArguments, ShortConvKernel, ShortConvPackArguments, ShortConvPrefillArguments,
ShortConvTrieArguments,
@@ -50,7 +47,6 @@ impl ShortConvMixer {
mtl_context: &MTLContext,
layer_type: DecoderLayerType,
short_conv_config: ShortConvConfig,
- _compilation_config: Rc<CompilationConfig>,
layer_index: usize,
model_dim: usize,
decoder_layer_loader: &ParameterTree<MTLContext>,
diff --git a/crates/uzu/src/backends/metal/language_model_generator_context.rs b/crates/uzu/src/backends/metal/language_model_generator_context.rs
index 6fcdafb97..af2d74154 100644
--- a/crates/uzu/src/backends/metal/language_model_generator_context.rs
+++ b/crates/uzu/src/backends/metal/language_model_generator_context.rs
@@ -6,7 +6,7 @@ use std::{
rc::Rc,
};
-use super::{Decoder, KVCacheUpdate, MTLContext, Metal, compilation_parameters::CompilationConfig};
+use super::{Decoder, KVCacheUpdate, MTLContext, Metal};
use crate::{
DataType,
backends::{
@@ -180,7 +180,6 @@ impl LanguageModelGeneratorContext {
let max_prefix_length: usize = decoding_config.context_length.resolve(language_model_config);
let max_suffix_length: usize = std::cmp::max(prefill_step_size, generate_suffix_length);
- let compilation_config = Rc::new(CompilationConfig::default());
let weights_path = model_path.join("model.safetensors");
if !weights_path.exists() {
return Err(Error::UnableToLoadWeights);
@@ -195,8 +194,7 @@ impl LanguageModelGeneratorContext {
let scratch_buffers =
ScratchBuffers::new(context.as_ref(), &decoder_config, &model_shape, max_prefix_length, max_suffix_length);
- let executables =
- Decoder::new(context.clone(), decoder_config.clone(), &root_loader_view, compilation_config.clone());
+ let executables = Decoder::new(context.clone(), decoder_config.clone(), &root_loader_view);
let cache_layers = Rc::new(RefCell::new(CacheLayers::new(
context.as_ref(),
diff --git a/crates/uzu/src/backends/metal/mod.rs b/crates/uzu/src/backends/metal/mod.rs
index 5aed4dd6f..a7acdf0d2 100644
--- a/crates/uzu/src/backends/metal/mod.rs
+++ b/crates/uzu/src/backends/metal/mod.rs
@@ -3,7 +3,6 @@ mod array;
mod backend;
mod classifier_context;
mod command_buffer;
-pub mod compilation_parameters;
mod context;
mod copy_encoder;
mod data_type;