From 0925af43b041f01c3309f1b3c52bf040898b3189 Mon Sep 17 00:00:00 2001 From: Jack Mousseau Date: Sun, 18 Feb 2024 12:50:10 -0800 Subject: [PATCH] Remove unused variables (#706) --- mlx/backend/accelerate/quantized.cpp | 2 -- mlx/backend/common/compiled.cpp | 1 - mlx/backend/metal/conv.cpp | 1 - mlx/backend/metal/indexing.cpp | 4 ---- mlx/backend/metal/primitives.cpp | 1 - mlx/io/gguf_quants.cpp | 1 - mlx/primitives.cpp | 1 - 7 files changed, 11 deletions(-) diff --git a/mlx/backend/accelerate/quantized.cpp b/mlx/backend/accelerate/quantized.cpp index cc31c88a3..e9fec1303 100644 --- a/mlx/backend/accelerate/quantized.cpp +++ b/mlx/backend/accelerate/quantized.cpp @@ -24,8 +24,6 @@ void _qmm_t_4_64( constexpr int bitmask = (1 << bits) - 1; constexpr int pack_factor = 32 / bits; constexpr int packs_in_group = group_size / pack_factor; - const int Kg = K / group_size; - const int Kw = K / pack_factor; for (int m = 0; m < M; m++) { const uint32_t* w_local = w; diff --git a/mlx/backend/common/compiled.cpp b/mlx/backend/common/compiled.cpp index 8bf1f43e4..914b85ae3 100644 --- a/mlx/backend/common/compiled.cpp +++ b/mlx/backend/common/compiled.cpp @@ -410,7 +410,6 @@ void Compiled::eval_cpu( // Get the kernel name from the lib int ndim = shape.size(); - bool dynamic = ndim >= 8; auto kernel_name = kernel_lib_ + (contiguous ? "_contiguous" : "_strided_"); if (!contiguous) { kernel_name += std::to_string(shape.size()); diff --git a/mlx/backend/metal/conv.cpp b/mlx/backend/metal/conv.cpp index 9fbbffb33..4ade8da17 100644 --- a/mlx/backend/metal/conv.cpp +++ b/mlx/backend/metal/conv.cpp @@ -182,7 +182,6 @@ void implicit_gemm_conv_2D_gpu( int implicit_M = conv_params.N * conv_params.oS[0] * conv_params.oS[1]; int implicit_N = conv_params.O; - int implicit_K = conv_params.wS[0] * conv_params.wS[1] * conv_params.C; size_t grid_dim_x = (implicit_N + bn - 1) / bn; size_t grid_dim_y = (implicit_M + bm - 1) / bm; diff --git a/mlx/backend/metal/indexing.cpp b/mlx/backend/metal/indexing.cpp index 6908f8684..4eeb8858e 100644 --- a/mlx/backend/metal/indexing.cpp +++ b/mlx/backend/metal/indexing.cpp @@ -167,10 +167,6 @@ void Scatter::eval_gpu(const std::vector& inputs, array& out) { auto& upd = inputs.back(); size_t nthreads = upd.size(); - NS::UInteger thread_group_size = kernel->maxTotalThreadsPerThreadgroup(); - if (thread_group_size > nthreads) { - thread_group_size = nthreads; - } compute_encoder->setComputePipelineState(kernel); diff --git a/mlx/backend/metal/primitives.cpp b/mlx/backend/metal/primitives.cpp index 757888a66..38ec5993c 100644 --- a/mlx/backend/metal/primitives.cpp +++ b/mlx/backend/metal/primitives.cpp @@ -691,7 +691,6 @@ void RandomBits::eval_gpu(const std::vector& inputs, array& out) { // organize into grid nkeys x elem_per_key MTL::Size grid_dims = MTL::Size(num_keys, half_size + odd, 1); NS::UInteger thread_group_size = kernel->maxTotalThreadsPerThreadgroup(); - auto nthreads = std::min(num_keys * (half_size + odd), thread_group_size); MTL::Size group_dims = MTL::Size(thread_group_size, 1, 1); auto compute_encoder = d.get_command_encoder(s.index); compute_encoder->setComputePipelineState(kernel); diff --git a/mlx/io/gguf_quants.cpp b/mlx/io/gguf_quants.cpp index 636648bc7..b9fe1e3bf 100644 --- a/mlx/io/gguf_quants.cpp +++ b/mlx/io/gguf_quants.cpp @@ -114,7 +114,6 @@ void gguf_load_quantized( << "has incompatible last dim shape: " << shape[shape.size() - 1]; throw std::runtime_error(msg.str()); } - const uint64_t num_blocks = tensor.num_weights / weights_per_block; std::vector weights_shape = shape; weights_shape.back() /= (weights_per_byte * 4); diff --git a/mlx/primitives.cpp b/mlx/primitives.cpp index a7e1d205d..b78f8d405 100644 --- a/mlx/primitives.cpp +++ b/mlx/primitives.cpp @@ -628,7 +628,6 @@ std::vector Convolution::vjp( auto& wt = primals[1]; auto cotan = cotangents[0]; - int N = in.shape(0); int O = wt.shape(0); // Resolve Padded input shapes and strides