From 167b759a389cc5f826efb3e8528057ef66210f1e Mon Sep 17 00:00:00 2001 From: hdeng-apple Date: Tue, 29 Apr 2025 22:26:05 +0800 Subject: [PATCH] Fix typos (#2136) --- mlx/array.h | 2 +- mlx/backend/metal/kernels/fft/readwrite.h | 2 +- .../metal/kernels/steel/attn/kernels/steel_attention.h | 4 ++-- mlx/backend/metal/kernels/steel/attn/loader.h | 4 ++-- .../metal/kernels/steel/conv/kernels/steel_conv_general.h | 2 +- mlx/backend/metal/kernels/steel/gemm/loader.h | 2 +- mlx/backend/no_cpu/compiled.cpp | 2 +- mlx/ops.h | 2 +- mlx/random.cpp | 4 ++-- python/src/random.cpp | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/mlx/array.h b/mlx/array.h index 66a4702a6..d9fcfc58e 100644 --- a/mlx/array.h +++ b/mlx/array.h @@ -356,7 +356,7 @@ class array { } enum Status { - // The ouptut of a computation which has not been scheduled. + // The output of a computation which has not been scheduled. // For example, the status of `x` in `auto x = a + b`. unscheduled, diff --git a/mlx/backend/metal/kernels/fft/readwrite.h b/mlx/backend/metal/kernels/fft/readwrite.h index ab699e136..f6724820d 100644 --- a/mlx/backend/metal/kernels/fft/readwrite.h +++ b/mlx/backend/metal/kernels/fft/readwrite.h @@ -10,7 +10,7 @@ For many sizes, GPU FFTs are memory bandwidth bound so read/write performance is important. Where possible, we read 128 bits sequentially in each thread, -coalesced with accesses from adajcent threads for optimal performance. +coalesced with accesses from adjacent threads for optimal performance. We implement specialized reading/writing for: - FFT diff --git a/mlx/backend/metal/kernels/steel/attn/kernels/steel_attention.h b/mlx/backend/metal/kernels/steel/attn/kernels/steel_attention.h index 2e27ea06f..34d5bf58a 100644 --- a/mlx/backend/metal/kernels/steel/attn/kernels/steel_attention.h +++ b/mlx/backend/metal/kernels/steel/attn/kernels/steel_attention.h @@ -95,7 +95,7 @@ template < Q += tidl.z * params->Q_strides[0] + // Batch tidl.y * params->Q_strides[1] + // Head - tidl.x * BQ * params->Q_strides[2]; // Seqeunce + tidl.x * BQ * params->Q_strides[2]; // Sequence ulong kv_head_idx = int(tid.y) / params->gqa_factor; K += tidl.z * params->K_strides[0] + // Batch @@ -106,7 +106,7 @@ template < O += tidl.z * params->O_strides[0] + // Batch tidl.y * params->O_strides[1] + // Head - tidl.x * BQ * params->O_strides[2]; // Seqeunce + tidl.x * BQ * params->O_strides[2]; // Sequence if (has_mask) { mask += tidl.z * mask_params->M_strides[0] + // Batch diff --git a/mlx/backend/metal/kernels/steel/attn/loader.h b/mlx/backend/metal/kernels/steel/attn/loader.h index 2849c00f1..7ec798146 100644 --- a/mlx/backend/metal/kernels/steel/attn/loader.h +++ b/mlx/backend/metal/kernels/steel/attn/loader.h @@ -113,7 +113,7 @@ struct BlockLoader { tmp_val[j] = src[(tmp_idx[j] ? i * src_ld + j : 0)]; } - // Zero out uneeded values + // Zero out unneeded values STEEL_PRAGMA_UNROLL for (short j = 0; j < vec_size; j++) { tmp_val[j] = tmp_idx[j] ? tmp_val[j] : T(0); @@ -240,7 +240,7 @@ struct BlockLoaderT { tmp_val[j] = src[(tmp_idx[j] ? i * src_ld + j : 0)]; } - // Zero out uneeded values + // Zero out unneeded values STEEL_PRAGMA_UNROLL for (short j = 0; j < vec_size; j++) { tmp_val[j] = tmp_idx[j] ? tmp_val[j] : T(0); diff --git a/mlx/backend/metal/kernels/steel/conv/kernels/steel_conv_general.h b/mlx/backend/metal/kernels/steel/conv/kernels/steel_conv_general.h index e4b662cd3..8253638f1 100644 --- a/mlx/backend/metal/kernels/steel/conv/kernels/steel_conv_general.h +++ b/mlx/backend/metal/kernels/steel/conv/kernels/steel_conv_general.h @@ -141,7 +141,7 @@ implicit_gemm_conv_2d_general( // Store results to device memory { - // Adjust for simdgroup and thread locatio + // Adjust for simdgroup and thread location int offset_m = c_row + mma_op.sm; int offset_n = c_col + mma_op.sn; C += offset_n; diff --git a/mlx/backend/metal/kernels/steel/gemm/loader.h b/mlx/backend/metal/kernels/steel/gemm/loader.h index 3f084d8ec..d421b2d1f 100644 --- a/mlx/backend/metal/kernels/steel/gemm/loader.h +++ b/mlx/backend/metal/kernels/steel/gemm/loader.h @@ -113,7 +113,7 @@ struct BlockLoader { tmp_val[j] = src[(tmp_idx[j] ? i * src_ld + j : 0)]; } - // Zero out uneeded values + // Zero out unneeded values STEEL_PRAGMA_UNROLL for (short j = 0; j < vec_size; j++) { tmp_val[j] = tmp_idx[j] ? tmp_val[j] : T(0); diff --git a/mlx/backend/no_cpu/compiled.cpp b/mlx/backend/no_cpu/compiled.cpp index c1c42c735..2eeddab47 100644 --- a/mlx/backend/no_cpu/compiled.cpp +++ b/mlx/backend/no_cpu/compiled.cpp @@ -18,7 +18,7 @@ void Compiled::eval_cpu( const std::vector& inputs, std::vector& outputs) { throw std::runtime_error( - "[Compiled::eval_cpu] CPU compialtion not supported on the platform."); + "[Compiled::eval_cpu] CPU compilation not supported on the platform."); } } // namespace mlx::core diff --git a/mlx/ops.h b/mlx/ops.h index 12e896af6..af3cdb5bd 100644 --- a/mlx/ops.h +++ b/mlx/ops.h @@ -569,7 +569,7 @@ inline array std(const array& a, StreamOrDevice s = {}) { return std(a, false, 0, to_stream(s)); } -/** Computes the standard deviatoin of the elements of an array along the given +/** Computes the standard deviation of the elements of an array along the given * axes */ array std( const array& a, diff --git a/mlx/random.cpp b/mlx/random.cpp index d6ce5bb0e..89a027b17 100644 --- a/mlx/random.cpp +++ b/mlx/random.cpp @@ -223,7 +223,7 @@ array multivariate_normal( auto n = mean.shape(-1); - // Check shapes comatibility of mean and cov + // Check shapes compatibility of mean and cov if (cov.shape(-1) != cov.shape(-2)) { throw std::invalid_argument( "[multivariate_normal] last two dimensions of cov must be equal."); @@ -402,7 +402,7 @@ array categorical( if (broadcast_shapes(shape, reduced_shape) != shape) { std::ostringstream msg; msg << "[categorical] Requested shape " << shape - << " is not broadcast compatable with reduced logits shape" + << " is not broadcast compatible with reduced logits shape" << reduced_shape << "."; throw std::invalid_argument(msg.str()); } diff --git a/python/src/random.cpp b/python/src/random.cpp index e9c0a87fc..22b706174 100644 --- a/python/src/random.cpp +++ b/python/src/random.cpp @@ -422,7 +422,7 @@ void init_random(nb::module_& parent_module) { axis (int, optional): The axis which specifies the distribution. Default: ``-1``. shape (list(int), optional): The shape of the output. This must - be broadcast compatable with ``logits.shape`` with the ``axis`` + be broadcast compatible with ``logits.shape`` with the ``axis`` dimension removed. Default: ``None`` num_samples (int, optional): The number of samples to draw from each of the categorical distributions in ``logits``. The output will have