A high-performance inference engine for AI models
smol reexport cleanup (#212)
uuuvnc0ba3f8fcb6c
diff --git a/crates/uzu/build/metal/compiler.rs b/crates/uzu/build/metal/compiler.rsindex d2c16efd8..1120c6848 100644--- a/crates/uzu/build/metal/compiler.rs+++ b/crates/uzu/build/metal/compiler.rs@@ -283,16 +283,15 @@ impl MetalCompiler {.collect::<anyhow::Result<(Vec<TokenStream>, Vec<TokenStream>)>>()?;let tokens = quote! {- use objc2::{runtime::ProtocolObject, rc::Retained};- use metal::{MTLFunctionConstantValues, MTLSize, MTLBuffer, MTLComputeCommandEncoder, MTLComputePipelineState};+ use metal::{MTLBuffer, MTLComputeCommandEncoder, MTLComputePipelineState, MTLFunctionConstantValues, MTLSize};+ use objc2::{rc::Retained, runtime::ProtocolObject};use crate::backends::metal::{- ComputeEncoderSetValue,- FunctionConstantValuesSetValue,- data_type::MetalDataTypeExt,- MetalContext,- MetalError,- metal_extensions::ComputeEncoderConditional,+ context::MetalContext,+ error::MetalError,+ metal_extensions::{+ ComputeEncoderConditional, ComputeEncoderSetValue, FunctionConstantValuesSetValue, MetalDataTypeExt,+ },};#(#bindings)*diff --git a/crates/uzu/src/backends/common/command_buffer.rs b/crates/uzu/src/backends/common/command_buffer.rsindex 13ad56878..7bd73f81e 100644--- a/crates/uzu/src/backends/common/command_buffer.rs+++ b/crates/uzu/src/backends/common/command_buffer.rs@@ -15,4 +15,6 @@ pub trait CommandBuffer {fn submit(&self);fn wait_until_completed(&self);++ fn gpu_execution_time_ms(&self) -> Option<f64>;}diff --git a/crates/uzu/src/backends/metal/backend.rs b/crates/uzu/src/backends/metal/backend.rsindex d4b7447c7..1a5186643 100644--- a/crates/uzu/src/backends/metal/backend.rs+++ b/crates/uzu/src/backends/metal/backend.rs@@ -1,7 +1,7 @@use metal::{MTLBlitCommandEncoder, MTLBuffer, MTLCommandBuffer, MTLComputeCommandEncoder, MTLEvent};use objc2::{rc::Retained, runtime::ProtocolObject};-use super::{MetalContext, MetalError, MetalKernels};+use super::{context::MetalContext, error::MetalError, kernel::dsl::MetalKernels};use crate::backends::common::Backend;#[derive(Debug, Clone)]diff --git a/crates/uzu/src/backends/metal/command_buffer.rs b/crates/uzu/src/backends/metal/command_buffer.rsindex 5523cea83..958b9a5c3 100644--- a/crates/uzu/src/backends/metal/command_buffer.rs+++ b/crates/uzu/src/backends/metal/command_buffer.rs@@ -1,6 +1,6 @@use std::ops::Deref;-use metal::{MTLCommandBuffer, MTLCommandEncoder};+use metal::{MTLCommandBuffer, MTLCommandBufferExt, MTLCommandEncoder};use objc2::{rc::Retained, runtime::ProtocolObject};use super::Metal;@@ -42,4 +42,11 @@ impl CommandBuffer for Retained<ProtocolObject<dyn MTLCommandBuffer>> {fn wait_until_completed(&self) {self.deref().wait_until_completed();}++ fn gpu_execution_time_ms(&self) -> Option<f64> {+ match (self.kernel_start_time(), self.kernel_end_time()) {+ (Some(start), Some(end)) => Some((end - start) * 1000.0),+ _ => None,+ }+ }}diff --git a/crates/uzu/src/backends/metal/context.rs b/crates/uzu/src/backends/metal/context.rsindex 3b263b467..87dadbc6c 100644--- a/crates/uzu/src/backends/metal/context.rs+++ b/crates/uzu/src/backends/metal/context.rs@@ -56,6 +56,7 @@ impl DeviceClass {pub struct DeviceArchitecture {pub generation: DeviceGeneration,pub device_class: DeviceClass,+ #[allow(dead_code)]pub arch_string: String,}diff --git a/crates/uzu/src/backends/metal/kernel/matmul/dispatch_descriptor.rs b/crates/uzu/src/backends/metal/kernel/matmul/dispatch_descriptor.rsindex 103714ddb..4b3585b17 100644--- a/crates/uzu/src/backends/metal/kernel/matmul/dispatch_descriptor.rs+++ b/crates/uzu/src/backends/metal/kernel/matmul/dispatch_descriptor.rs@@ -1,7 +1,7 @@use super::{common::MatmulArguments, gemm, gemv, split_k};use crate::{DataType,- backends::metal::{MetalContext, MetalError},+ backends::metal::{context::MetalContext, error::MetalError},};#[derive(Debug, Clone, Copy, PartialEq, Eq)]diff --git a/crates/uzu/src/backends/metal/kernel/matmul/gemm/dispatch_descriptor.rs b/crates/uzu/src/backends/metal/kernel/matmul/gemm/dispatch_descriptor.rsindex 1f82cfc0e..5765c3836 100644--- a/crates/uzu/src/backends/metal/kernel/matmul/gemm/dispatch_descriptor.rs+++ b/crates/uzu/src/backends/metal/kernel/matmul/gemm/dispatch_descriptor.rs@@ -4,7 +4,8 @@ use super::{pipeline_configuration::PipelineConfiguration, tile_configuration::Tuse crate::{DataType,backends::metal::{- DeviceClass, MetalContext, MetalError,+ context::{DeviceClass, MetalContext},+ error::MetalError,kernel::matmul::common::{GEMMAddMMParams, GEMMParams, MatmulArguments},},};diff --git a/crates/uzu/src/backends/metal/kernel/matmul/gemm/kernel.rs b/crates/uzu/src/backends/metal/kernel/matmul/gemm/kernel.rsindex c48a6e25c..493b03e46 100644--- a/crates/uzu/src/backends/metal/kernel/matmul/gemm/kernel.rs+++ b/crates/uzu/src/backends/metal/kernel/matmul/gemm/kernel.rs@@ -7,8 +7,10 @@ use super::{DispatchDescriptor, pipeline_configuration::PipelineConfiguration, tuse crate::{DataType,backends::metal::{- ComputeEncoderSetValue, FunctionConstantValuesSetValue, MetalContext, MetalError,+ context::MetalContext,+ error::MetalError,kernel::matmul::common::{MatmulArguments, transpose_configuration},+ metal_extensions::{ComputeEncoderSetValue, FunctionConstantValuesSetValue},},};diff --git a/crates/uzu/src/backends/metal/kernel/matmul/gemv/dispatch_descriptor.rs b/crates/uzu/src/backends/metal/kernel/matmul/gemv/dispatch_descriptor.rsindex 4caf6e5c9..b72ad7cc0 100644--- a/crates/uzu/src/backends/metal/kernel/matmul/gemv/dispatch_descriptor.rs+++ b/crates/uzu/src/backends/metal/kernel/matmul/gemv/dispatch_descriptor.rs@@ -5,7 +5,7 @@ use metal::MTLSize;use super::pipeline_configuration::{PipelineConfiguration, select_configuration};use crate::{DataType,- backends::metal::{MetalContext, MetalError, kernel::matmul::common::MatmulArguments},+ backends::metal::{context::MetalContext, error::MetalError, kernel::matmul::common::MatmulArguments},};const DEFAULT_GEMV_MAX_BATCH: i32 = 8;diff --git a/crates/uzu/src/backends/metal/kernel/matmul/gemv/kernel.rs b/crates/uzu/src/backends/metal/kernel/matmul/gemv/kernel.rsindex 50ea1b67a..883b9ae69 100644--- a/crates/uzu/src/backends/metal/kernel/matmul/gemv/kernel.rs+++ b/crates/uzu/src/backends/metal/kernel/matmul/gemv/kernel.rs@@ -9,7 +9,10 @@ use super::{};use crate::{DataType,- backends::metal::{ComputeEncoderSetValue, MetalContext, MetalError, kernel::matmul::common::MatmulArguments},+ backends::metal::{+ context::MetalContext, error::MetalError, kernel::matmul::common::MatmulArguments,+ metal_extensions::ComputeEncoderSetValue,+ },};fn gemv_kernel_name(diff --git a/crates/uzu/src/backends/metal/kernel/matmul/kernel.rs b/crates/uzu/src/backends/metal/kernel/matmul/kernel.rsindex 51f7fd804..4fdd13cb3 100644--- a/crates/uzu/src/backends/metal/kernel/matmul/kernel.rs+++ b/crates/uzu/src/backends/metal/kernel/matmul/kernel.rs@@ -12,7 +12,7 @@ use crate::{DataType,backends::{common::kernel::TensorAddBiasKernel,- metal::{MetalContext, MetalError, kernel::dsl::TensorAddBiasMetalKernel},+ metal::{context::MetalContext, error::MetalError, kernel::dsl::TensorAddBiasMetalKernel},},};diff --git a/crates/uzu/src/backends/metal/kernel/matmul/mod.rs b/crates/uzu/src/backends/metal/kernel/matmul/mod.rsindex 870d81566..050733c0a 100644--- a/crates/uzu/src/backends/metal/kernel/matmul/mod.rs+++ b/crates/uzu/src/backends/metal/kernel/matmul/mod.rs@@ -19,7 +19,7 @@ use crate::{common::kernel::matmul::{FullPrecisionMatmulArguments, FullPrecisionMatmulKernel as FullPrecisionMatmulKernelTrait,},- metal::{Metal, MetalContext, MetalError},+ metal::{Metal, context::MetalContext, error::MetalError},},};diff --git a/crates/uzu/src/backends/metal/kernel/matmul/split_k/dispatch_descriptor.rs b/crates/uzu/src/backends/metal/kernel/matmul/split_k/dispatch_descriptor.rsindex 2490dcfe9..21c0e7523 100644--- a/crates/uzu/src/backends/metal/kernel/matmul/split_k/dispatch_descriptor.rs+++ b/crates/uzu/src/backends/metal/kernel/matmul/split_k/dispatch_descriptor.rs@@ -4,7 +4,8 @@ use super::{pipeline_configuration::PipelineConfiguration, tile_configuration::suse crate::{DataType,backends::metal::{- MetalContext, MetalError,+ context::MetalContext,+ error::MetalError,kernel::matmul::common::{GEMMSpiltKParams as SplitKGEMMParams, MatmulArguments},},};diff --git a/crates/uzu/src/backends/metal/kernel/matmul/split_k/kernel.rs b/crates/uzu/src/backends/metal/kernel/matmul/split_k/kernel.rsindex 824c031d7..713481877 100644--- a/crates/uzu/src/backends/metal/kernel/matmul/split_k/kernel.rs+++ b/crates/uzu/src/backends/metal/kernel/matmul/split_k/kernel.rs@@ -9,8 +9,10 @@ use crate::{backends::{common::Context,metal::{- ComputeEncoderSetValue, MetalContext, MetalError,+ context::MetalContext,+ error::MetalError,kernel::matmul::common::{MatmulArguments, transpose_configuration},+ metal_extensions::ComputeEncoderSetValue,},},};diff --git a/crates/uzu/src/backends/metal/metal_extensions/command_buffer_timing.rs b/crates/uzu/src/backends/metal/metal_extensions/command_buffer_timing.rsdeleted file mode 100644index 32c96313e..000000000--- a/crates/uzu/src/backends/metal/metal_extensions/command_buffer_timing.rs+++ /dev/null@@ -1,19 +0,0 @@-use metal::{MTLCommandBuffer, MTLCommandBufferExt};-use objc2::runtime::ProtocolObject;--/// Extension trait providing convenience timing methods for command buffers.-pub trait CommandBufferTimingExt {- /// Returns the GPU execution time in milliseconds.- ///- /// This is a convenience method that calculates `(kernel_end_time - kernel_start_time) * 1000`.- fn gpu_execution_time_ms(&self) -> Option<f64>;-}--impl CommandBufferTimingExt for ProtocolObject<dyn MTLCommandBuffer> {- fn gpu_execution_time_ms(&self) -> Option<f64> {- match (self.kernel_start_time(), self.kernel_end_time()) {- (Some(start), Some(end)) => Some((end - start) * 1000.0),- _ => None,- }- }-}diff --git a/crates/uzu/src/backends/metal/metal_extensions/compute_command_encoder_extensions_dispatch.rs b/crates/uzu/src/backends/metal/metal_extensions/compute_command_encoder_extensions_dispatch.rsdeleted file mode 100644index 51d5c75c8..000000000--- a/crates/uzu/src/backends/metal/metal_extensions/compute_command_encoder_extensions_dispatch.rs+++ /dev/null@@ -1,235 +0,0 @@-use metal::{MTLCommandEncoderExt, MTLComputeCommandEncoder, MTLComputePipelineState, MTLSize};-use objc2::runtime::ProtocolObject;--use super::{- compute_pipeline_state_extensions_threads::ComputePipelineStateThreads,- device_extensions_features::{DeviceFeatures, Feature},-};--/// Extensions for MTLComputeCommandEncoder to simplify dispatch operations-pub trait ComputeEncoderDispatch {- /// Dispatches a 1D compute grid, covering at least the specified size.- fn dispatch_1d_covering(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: usize,- threadgroup_width: Option<usize>,- );-- /// Dispatches a 1D compute grid with exactly the specified size.- fn dispatch_1d_exactly(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: usize,- threadgroup_width: Option<usize>,- );-- /// Dispatches a 1D compute grid, using the most efficient method available on the device.- fn dispatch_1d(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: usize,- threadgroup_width: Option<usize>,- );-- /// Dispatches a 2D compute grid, covering at least the specified size.- fn dispatch_2d_covering(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: MTLSize,- threadgroup_size: Option<MTLSize>,- );-- /// Dispatches a 2D compute grid with exactly the specified size.- fn dispatch_2d_exactly(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: MTLSize,- threadgroup_size: Option<MTLSize>,- );-- /// Dispatches a 2D compute grid, using the most efficient method available on the device.- fn dispatch_2d(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: MTLSize,- threadgroup_size: Option<MTLSize>,- );-- /// Dispatches a 3D compute grid, covering at least the specified size.- fn dispatch_3d_covering(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: MTLSize,- threadgroup_size: Option<MTLSize>,- );-- /// Dispatches a 3D compute grid with exactly the specified size.- fn dispatch_3d_exactly(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: MTLSize,- threadgroup_size: Option<MTLSize>,- );-- /// Dispatches a 3D compute grid, using the most efficient method available on the device.- fn dispatch_3d(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: MTLSize,- threadgroup_size: Option<MTLSize>,- );-}--impl ComputeEncoderDispatch for ProtocolObject<dyn MTLComputeCommandEncoder> {- fn dispatch_1d_covering(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: usize,- threadgroup_width: Option<usize>,- ) {- let tg_width = threadgroup_width.unwrap_or(state.thread_execution_width() as usize);- let tg_size = MTLSize {- width: tg_width,- height: 1,- depth: 1,- };-- let count = MTLSize {- width: (size + tg_width - 1) / tg_width,- height: 1,- depth: 1,- };-- self.set_compute_pipeline_state(state);- self.dispatch_threadgroups(count, tg_size);- }-- fn dispatch_1d_exactly(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: usize,- threadgroup_width: Option<usize>,- ) {- let tg_size = MTLSize {- width: threadgroup_width.unwrap_or(state.thread_execution_width() as usize),- height: 1,- depth: 1,- };-- self.set_compute_pipeline_state(state);- self.dispatch_threads(- MTLSize {- width: size,- height: 1,- depth: 1,- },- tg_size,- );- }-- fn dispatch_1d(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: usize,- threadgroup_width: Option<usize>,- ) {- let device = self.device();-- if device.supports_feature(Feature::NonUniformThreadgroups) {- self.dispatch_1d_exactly(state, size, threadgroup_width);- } else {- self.dispatch_1d_covering(state, size, threadgroup_width);- }- }-- fn dispatch_2d_covering(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: MTLSize,- threadgroup_size: Option<MTLSize>,- ) {- let tg_size = threadgroup_size.unwrap_or_else(|| state.max_2d_threadgroup_size());-- let count = MTLSize {- width: (size.width + tg_size.width - 1) / tg_size.width,- height: (size.height + tg_size.height - 1) / tg_size.height,- depth: 1,- };-- self.set_compute_pipeline_state(state);- self.dispatch_threadgroups(count, tg_size);- }-- fn dispatch_2d_exactly(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: MTLSize,- threadgroup_size: Option<MTLSize>,- ) {- let tg_size = threadgroup_size.unwrap_or_else(|| state.max_2d_threadgroup_size());-- self.set_compute_pipeline_state(state);- self.dispatch_threads(size, tg_size);- }-- fn dispatch_2d(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: MTLSize,- threadgroup_size: Option<MTLSize>,- ) {- let device = self.device();-- if device.supports_feature(Feature::NonUniformThreadgroups) {- self.dispatch_2d_exactly(state, size, threadgroup_size);- } else {- self.dispatch_2d_covering(state, size, threadgroup_size);- }- }-- fn dispatch_3d_covering(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: MTLSize,- threadgroup_size: Option<MTLSize>,- ) {- let tg_size = threadgroup_size.unwrap_or_else(|| state.max_2d_threadgroup_size());-- let count = MTLSize {- width: (size.width + tg_size.width - 1) / tg_size.width,- height: (size.height + tg_size.height - 1) / tg_size.height,- depth: (size.depth + tg_size.depth - 1) / tg_size.depth,- };-- self.set_compute_pipeline_state(state);- self.dispatch_threadgroups(count, tg_size);- }-- fn dispatch_3d_exactly(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: MTLSize,- threadgroup_size: Option<MTLSize>,- ) {- let tg_size = threadgroup_size.unwrap_or_else(|| state.max_2d_threadgroup_size());-- self.set_compute_pipeline_state(state);- self.dispatch_threads(size, tg_size);- }-- fn dispatch_3d(- &self,- state: &ProtocolObject<dyn MTLComputePipelineState>,- size: MTLSize,- threadgroup_size: Option<MTLSize>,- ) {- let device = self.device();-- if device.supports_feature(Feature::NonUniformThreadgroups) {- self.dispatch_3d_exactly(state, size, threadgroup_size);- } else {- self.dispatch_3d_covering(state, size, threadgroup_size);- }- }-}diff --git a/crates/uzu/src/backends/metal/metal_extensions/compute_pipeline_state_extensions_threads.rs b/crates/uzu/src/backends/metal/metal_extensions/compute_pipeline_state_extensions_threads.rsdeleted file mode 100644index 07da56b03..000000000--- a/crates/uzu/src/backends/metal/metal_extensions/compute_pipeline_state_extensions_threads.rs+++ /dev/null@@ -1,76 +0,0 @@-use metal::{MTLComputePipelineState, MTLSize};-use objc2::runtime::ProtocolObject;--/// Extensions for ComputePipelineState to provide optimized threadgroup sizes-pub trait ComputePipelineStateThreads {- /// Returns a threadgroup size based on the pipeline's thread execution width.- ///- /// This size is optimized for 1D compute kernels.- fn execution_width_threadgroup_size(&self) -> MTLSize;-- /// Returns the maximum threadgroup size for a 1D compute kernel.- ///- /// This size uses the maximum total threads per threadgroup.- fn max_1d_threadgroup_size(&self) -> MTLSize;-- /// Returns the maximum threadgroup size for a 2D compute kernel.- ///- /// This size balances the thread execution width and the maximum total threads per threadgroup.- fn max_2d_threadgroup_size(&self) -> MTLSize;-- /// Calculates the maximum threadgroup size for a 3D compute kernel with a specified depth.- ///- /// - Parameter depth: The desired depth of the threadgroup.- /// - Returns: The maximum threadgroup size that can be used for a 3D compute kernel.- fn max_3d_threadgroup_size(- &self,- depth: usize,- ) -> MTLSize;-}--impl ComputePipelineStateThreads for ProtocolObject<dyn MTLComputePipelineState> {- fn execution_width_threadgroup_size(&self) -> MTLSize {- let w = self.thread_execution_width();-- MTLSize {- width: w,- height: 1,- depth: 1,- }- }-- fn max_1d_threadgroup_size(&self) -> MTLSize {- let w = self.max_total_threads_per_threadgroup();-- MTLSize {- width: w,- height: 1,- depth: 1,- }- }-- fn max_2d_threadgroup_size(&self) -> MTLSize {- let w = self.thread_execution_width();- let h = self.max_total_threads_per_threadgroup() / w;-- MTLSize {- width: w,- height: h,- depth: 1,- }- }-- fn max_3d_threadgroup_size(- &self,- depth: usize,- ) -> MTLSize {- let w = self.thread_execution_width() / depth;- let h = self.max_total_threads_per_threadgroup() / w;-- MTLSize {- width: w,- height: h,- depth,- }- }-}diff --git a/crates/uzu/src/backends/metal/data_type.rs b/crates/uzu/src/backends/metal/metal_extensions/data_type.rssimilarity index 100%rename from crates/uzu/src/backends/metal/data_type.rsrename to crates/uzu/src/backends/metal/metal_extensions/data_type.rsdiff --git a/crates/uzu/src/backends/metal/metal_extensions/device_extensions_features.rs b/crates/uzu/src/backends/metal/metal_extensions/device_extensions_features.rsdeleted file mode 100644index ac253d378..000000000--- a/crates/uzu/src/backends/metal/metal_extensions/device_extensions_features.rs+++ /dev/null@@ -1,109 +0,0 @@-use std::collections::HashSet;--use metal::{MTLDevice, MTLDeviceExt, MTLFeatureSet, MTLGPUFamily, MTLPixelFormat, MTLReadWriteTextureTier};-use objc2::runtime::ProtocolObject;--/// Enum representing various Metal features that may or may not be supported by a device.-#[derive(Debug, Clone, PartialEq, Eq)]-pub enum Feature {- /// Non-uniform threadgroups allow for more flexible compute kernel dispatches.- NonUniformThreadgroups,- /// Tile shaders enable efficient rendering of tiled resources.- TileShaders,- /// Read-write textures allow both reading from and writing to textures in a shader.- ReadWriteTextures(MTLPixelFormat),- /// Ability to read and write to cube map textures in Metal functions.- ReadWriteCubeMapTexturesInFunctions,-}--/// Extensions for metal::Device to provide feature checking capabilities-pub trait DeviceFeatures {- /// Checks if the device supports a specific Metal feature.- ///- /// - Parameter feature: The feature to check for support.- /// - Returns: A boolean indicating whether the feature is supported.- fn supports_feature(- &self,- feature: Feature,- ) -> bool;-}--impl DeviceFeatures for ProtocolObject<dyn MTLDevice> {- fn supports_feature(- &self,- feature: Feature,- ) -> bool {- match feature {- Feature::NonUniformThreadgroups => {- #[allow(deprecated)]- #[cfg(target_os = "ios")]- {- self.supports_feature_set(MTLFeatureSet::iOS_GPUFamily4_v1)- }- #[cfg(target_os = "macos")]- {- self.supports_feature_set(MTLFeatureSet::macOS_GPUFamily1_v3)- }- #[cfg(not(any(target_os = "ios", target_os = "macos")))]- {- false- }- },- Feature::TileShaders => self.supports_family(MTLGPUFamily::Apple4),- Feature::ReadWriteTextures(pixel_format) => {- let tier_one_supported_formats: HashSet<MTLPixelFormat> =- [MTLPixelFormat::R32Float, MTLPixelFormat::R32Uint, MTLPixelFormat::R32Sint].into();-- let tier_two_supported_formats: HashSet<MTLPixelFormat> = tier_one_supported_formats- .union(- &[- MTLPixelFormat::RGBA32Float,- MTLPixelFormat::RGBA32Uint,- MTLPixelFormat::RGBA32Sint,- MTLPixelFormat::RGBA16Float,- MTLPixelFormat::RGBA16Uint,- MTLPixelFormat::RGBA16Sint,- MTLPixelFormat::RGBA8Unorm,- MTLPixelFormat::RGBA8Uint,- MTLPixelFormat::RGBA8Sint,- MTLPixelFormat::R16Float,- MTLPixelFormat::R16Uint,- MTLPixelFormat::R16Sint,- MTLPixelFormat::R8Unorm,- MTLPixelFormat::R8Uint,- MTLPixelFormat::R8Sint,- ]- .into_iter()- .collect(),- )- .cloned()- .collect();-- match self.read_write_texture_support() {- MTLReadWriteTextureTier::Tier1 => tier_one_supported_formats.contains(&pixel_format),- MTLReadWriteTextureTier::Tier2 => tier_two_supported_formats.contains(&pixel_format),- MTLReadWriteTextureTier::None => false,- }- },- Feature::ReadWriteCubeMapTexturesInFunctions => {- let families_with_read_write_cube_map_support = [- MTLGPUFamily::Apple4,- MTLGPUFamily::Apple5,- MTLGPUFamily::Apple6,- MTLGPUFamily::Apple7,- MTLGPUFamily::Apple8,- MTLGPUFamily::Mac2,- // Note: Metal3 family is not included since we'd need to check for availability- // and conditional compilation- ];-- for family in families_with_read_write_cube_map_support {- if self.supports_family(family) {- return true;- }- }- false- },- }- }-}diff --git a/crates/uzu/src/backends/metal/metal_extensions/mod.rs b/crates/uzu/src/backends/metal/metal_extensions/mod.rsindex 2fe7c5f0d..fd8b90ecb 100644--- a/crates/uzu/src/backends/metal/metal_extensions/mod.rs+++ b/crates/uzu/src/backends/metal/metal_extensions/mod.rs@@ -1,17 +1,11 @@-#![allow(dead_code, unused_variables, unused_imports)]--mod command_buffer_timing;mod compute_command_encoder_extensions_conditional;-mod compute_command_encoder_extensions_dispatch;mod compute_command_encoder_extensions_set_value;-mod compute_pipeline_state_extensions_threads;-mod device_extensions_features;+mod data_type;mod function_constant_values_extensions_set_value;mod library_extensions_pipeline;-pub use command_buffer_timing::CommandBufferTimingExt;pub use compute_command_encoder_extensions_conditional::ComputeEncoderConditional;-pub use compute_command_encoder_extensions_dispatch::ComputeEncoderDispatch;pub use compute_command_encoder_extensions_set_value::ComputeEncoderSetValue;+pub use data_type::MetalDataTypeExt;pub use function_constant_values_extensions_set_value::FunctionConstantValuesSetValue;pub use library_extensions_pipeline::LibraryPipelineExtensions;diff --git a/crates/uzu/src/backends/metal/mod.rs b/crates/uzu/src/backends/metal/mod.rsindex 71c284584..8b6b5b189 100644--- a/crates/uzu/src/backends/metal/mod.rs+++ b/crates/uzu/src/backends/metal/mod.rs@@ -2,15 +2,11 @@ mod backend;mod command_buffer;mod context;mod copy_encoder;-mod data_type;-pub mod error;+mod error;mod event;pub mod kernel;-pub mod metal_extensions;+mod metal_extensions;mod native_buffer;pub use backend::Metal;-pub use context::{DeviceArchitecture, DeviceClass, DeviceGeneration, MetalContext};-pub use error::MetalError;-pub use kernel::dsl::MetalKernels;-pub use metal_extensions::{ComputeEncoderSetValue, FunctionConstantValuesSetValue};+pub use context::MetalContext;diff --git a/crates/uzu/tests/attention_kernel_test.rs b/crates/uzu/tests/attention_kernel_test.rsindex 40838afea..e817e2bac 100644--- a/crates/uzu/tests/attention_kernel_test.rs+++ b/crates/uzu/tests/attention_kernel_test.rs@@ -12,7 +12,7 @@ use uzu::{DataType,backends::{common::{- Context,+ CommandBuffer, Context,kernel::{AttentionSinglePassKernel, AttentionTwoPass1Kernel, AttentionTwoPass2Kernel,attention::{AttentionGemmArguments, AttentionGemmBlock},@@ -21,7 +21,6 @@ use uzu::{metal::{Metal, MetalContext,kernel::dsl::{AttentionSinglePassMetalKernel, AttentionTwoPass1MetalKernel, AttentionTwoPass2MetalKernel},- metal_extensions::CommandBufferTimingExt,},},};diff --git a/crates/uzu/tests/rms_norm_kernel_test.rs b/crates/uzu/tests/rms_norm_kernel_test.rsindex ed8cd0b9a..2d514f320 100644--- a/crates/uzu/tests/rms_norm_kernel_test.rs+++ b/crates/uzu/tests/rms_norm_kernel_test.rs@@ -8,13 +8,12 @@ use uzu::{DataType,backends::{common::{- Context,+ CommandBuffer, Context,kernel::{QKNormKernel, RMSNormKernel},},metal::{MetalContext,kernel::dsl::{QKNormMetalKernel, RMSNormMetalKernel},- metal_extensions::CommandBufferTimingExt,},},};diff --git a/crates/uzu/tests/sampling_test.rs b/crates/uzu/tests/sampling_test.rsindex 79fe22056..f89ae0bd1 100644--- a/crates/uzu/tests/sampling_test.rs+++ b/crates/uzu/tests/sampling_test.rs@@ -7,7 +7,7 @@ use uzu::{DataType,backends::{common::{- Context,+ CommandBuffer, Context,kernel::{GumbelKernel, MinPKernel, TemperatureKernel, TopKKernel, TopPKernel,sampling::{ArgmaxStrategy, SamplingKernel},@@ -18,7 +18,6 @@ use uzu::{kernel::dsl::{GumbelMetalKernel, MinPMetalKernel, TemperatureMetalKernel, TopKMetalKernel, TopPMetalKernel,},- metal_extensions::CommandBufferTimingExt,},},language_model::gumbel::{gumbel_float, revidx},