Repository navigation
Spelling #342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Spelling #342
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
647f80d
spelling: accumulates
jsoref 73272bb
spelling: across
jsoref b698ce3
spelling: additional
jsoref 33be1a2
spelling: against
jsoref 7057f13
spelling: among
jsoref 27f640e
spelling: array
jsoref 5097cd7
spelling: at least
jsoref f28bcda
spelling: available
jsoref 9ad62ea
spelling: axes
jsoref acde6e4
spelling: basically
jsoref c8c2d6c
spelling: bfloat
jsoref 94f71e5
spelling: bounds
jsoref 1604608
spelling: broadcast
jsoref edc830d
spelling: buffer
jsoref d81a841
spelling: class
jsoref 35c5530
spelling: coefficients
jsoref 76ac49c
spelling: collision
jsoref 272f695
spelling: combinations
jsoref d26e758
spelling: committing
jsoref 2a5a690
spelling: computation
jsoref 956cac5
spelling: consider
jsoref 0f34dc1
spelling: constructing
jsoref 30e9fdc
spelling: conversions
jsoref e34205b
spelling: correctly
jsoref b647328
spelling: corresponding
jsoref 8cae2e1
spelling: declaration
jsoref c249816
spelling: default
jsoref 61aa866
spelling: dependency
jsoref a14e197
spelling: destination
jsoref 1c9eea2
spelling: destructor
jsoref f4fcfb4
spelling: dimensions
jsoref 07cb2f7
spelling: divided
jsoref f242b42
spelling: element-wise
jsoref 3cce74a
spelling: elements
jsoref 586ac7d
spelling: endianness
jsoref dc0661b
spelling: equivalent
jsoref d1db947
spelling: explicitly
jsoref 64baf05
spelling: github
jsoref e54c872
spelling: indices
jsoref fe3c914
spelling: irregularly
jsoref 6c1cd87
spelling: memory
jsoref 0112fca
spelling: metallib
jsoref 0778209
spelling: negative
jsoref 0219a05
spelling: notable
jsoref 0ddb83c
spelling: optional
jsoref 116a5b3
spelling: otherwise
jsoref 8f39b89
spelling: overridden
jsoref c18cb06
spelling: partially
jsoref 979ae32
spelling: partition
jsoref f890871
spelling: perform
jsoref 039ee91
spelling: perturbations
jsoref 94eeae4
spelling: positively
jsoref 684e946
spelling: primitive
jsoref 61823aa
spelling: repeat
jsoref e254286
spelling: repeats
jsoref 538f523
spelling: respect
jsoref f48a352
spelling: respectively
jsoref 69142ef
spelling: result
jsoref 6b0d08a
spelling: rounding
jsoref 2fb5fe3
spelling: separate
jsoref 31b24c2
spelling: skipping
jsoref 3a54373
spelling: structure
jsoref 9557a8f
spelling: the
jsoref 072f7e0
spelling: transpose
jsoref 59b779b
spelling: unnecessary
jsoref 381712a
spelling: unneeded
jsoref c373f86
spelling: unsupported
jsoref File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -26,7 +26,7 @@ python -m http.server <port> | |
|
|
||
| and point your browser to `http://localhost:<port>`. | ||
|
|
||
| ### Push to Github Pages | ||
| ### Push to GitHub Pages | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. brand |
||
|
|
||
| Check-out the `gh-pages` branch (`git switch gh-pages`) and build | ||
| the docs. Then force add the `build/html` directory: | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ Introducing the Example | |
| ----------------------- | ||
|
|
||
| Let's say that you would like an operation that takes in two arrays, | ||
| ``x`` and ``y``, scales them both by some coefficents ``alpha`` and ``beta`` | ||
| ``x`` and ``y``, scales them both by some coefficients ``alpha`` and ``beta`` | ||
| respectively, and then adds them together to get the result | ||
| ``z = alpha * x + beta * y``. Well, you can very easily do that by just | ||
| writing out a function as follows: | ||
|
|
@@ -69,7 +69,7 @@ C++ API: | |
| .. code-block:: C++ | ||
|
|
||
| /** | ||
| * Scale and sum two vectors elementwise | ||
| * Scale and sum two vectors element-wise | ||
| * z = alpha * x + beta * y | ||
| * | ||
| * Follow numpy style broadcasting between x and y | ||
|
|
@@ -230,7 +230,7 @@ Let's re-implement our operation now in terms of our :class:`Axpby` primitive. | |
|
|
||
| This operation now handles the following: | ||
|
|
||
| #. Upcast inputs and resolve the the output data type. | ||
| #. Upcast inputs and resolve the output data type. | ||
| #. Broadcast the inputs and resolve the output shape. | ||
| #. Construct the primitive :class:`Axpby` using the given stream, ``alpha``, and ``beta``. | ||
| #. Construct the output :class:`array` using the primitive and the inputs. | ||
|
|
@@ -284,14 +284,14 @@ pointwise. This is captured in the templated function :meth:`axpby_impl`. | |
| T alpha = static_cast<T>(alpha_); | ||
| T beta = static_cast<T>(beta_); | ||
|
|
||
| // Do the elementwise operation for each output | ||
| // Do the element-wise operation for each output | ||
| for (size_t out_idx = 0; out_idx < out.size(); out_idx++) { | ||
| // Map linear indices to offsets in x and y | ||
| auto x_offset = elem_to_loc(out_idx, x.shape(), x.strides()); | ||
| auto y_offset = elem_to_loc(out_idx, y.shape(), y.strides()); | ||
|
|
||
| // We allocate the output to be contiguous and regularly strided | ||
| // (defaults to row major) and hence it doesn't need additonal mapping | ||
| // (defaults to row major) and hence it doesn't need additional mapping | ||
| out_ptr[out_idx] = alpha * x_ptr[x_offset] + beta * y_ptr[y_offset]; | ||
| } | ||
| } | ||
|
|
@@ -305,7 +305,7 @@ if we encounter an unexpected type. | |
|
|
||
| /** Fall back implementation for evaluation on CPU */ | ||
| void Axpby::eval(const std::vector<array>& inputs, array& out) { | ||
| // Check the inputs (registered in the op while contructing the out array) | ||
| // Check the inputs (registered in the op while constructing the out array) | ||
| assert(inputs.size() == 2); | ||
| auto& x = inputs[0]; | ||
| auto& y = inputs[1]; | ||
|
|
@@ -485,7 +485,7 @@ each data type. | |
|
|
||
| instantiate_axpby(float32, float); | ||
| instantiate_axpby(float16, half); | ||
| instantiate_axpby(bflot16, bfloat16_t); | ||
| instantiate_axpby(bfloat16, bfloat16_t); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ?? |
||
| instantiate_axpby(complex64, complex64_t); | ||
|
|
||
| This kernel will be compiled into a metal library ``mlx_ext.metallib`` as we | ||
|
|
@@ -537,7 +537,7 @@ below. | |
| compute_encoder->setComputePipelineState(kernel); | ||
|
|
||
| // Kernel parameters are registered with buffer indices corresponding to | ||
| // those in the kernel decelaration at axpby.metal | ||
| // those in the kernel declaration at axpby.metal | ||
| int ndim = out.ndim(); | ||
| size_t nelem = out.size(); | ||
|
|
||
|
|
@@ -568,7 +568,7 @@ below. | |
| // Fix the 3D size of the launch grid (in terms of threads) | ||
| MTL::Size grid_dims = MTL::Size(nelem, 1, 1); | ||
|
|
||
| // Launch the grid with the given number of threads divded among | ||
| // Launch the grid with the given number of threads divided among | ||
| // the given threadgroups | ||
| compute_encoder->dispatchThreads(grid_dims, group_dims); | ||
| } | ||
|
|
@@ -581,7 +581,7 @@ to give us the active metal compute command encoder instead of building a | |
| new one and calling :meth:`compute_encoder->end_encoding` at the end. | ||
| MLX keeps adding kernels (compute pipelines) to the active command encoder | ||
| until some specified limit is hit or the compute encoder needs to be flushed | ||
| for synchronization. MLX also handles enqueuing and commiting the associated | ||
| for synchronization. MLX also handles enqueuing and committing the associated | ||
| command buffers as needed. We suggest taking a deeper dive into | ||
| :class:`metal::Device` if you would like to study this routine further. | ||
|
|
||
|
|
@@ -601,8 +601,8 @@ us the following :meth:`Axpby::jvp` and :meth:`Axpby::vjp` implementations. | |
| const std::vector<array>& tangents, | ||
| const std::vector<int>& argnums) { | ||
| // Forward mode diff that pushes along the tangents | ||
| // The jvp transform on the the primitive can built with ops | ||
| // that are scheduled on the same stream as the primtive | ||
| // The jvp transform on the primitive can built with ops | ||
| // that are scheduled on the same stream as the primitive | ||
|
|
||
| // If argnums = {0}, we only push along x in which case the | ||
| // jvp is just the tangent scaled by alpha | ||
|
|
@@ -642,7 +642,7 @@ own :class:`Primitive`. | |
|
|
||
| .. code-block:: C++ | ||
|
|
||
| /** Vectorize primitve along given axis */ | ||
| /** Vectorize primitive along given axis */ | ||
| std::pair<array, int> Axpby::vmap( | ||
| const std::vector<array>& inputs, | ||
| const std::vector<int>& axes) { | ||
|
|
@@ -666,7 +666,7 @@ Let's look at the overall directory structure first. | |
| | └── setup.py | ||
|
|
||
| * ``extensions/axpby/`` defines the C++ extension library | ||
| * ``extensions/mlx_sample_extensions`` sets out the strucutre for the | ||
| * ``extensions/mlx_sample_extensions`` sets out the structure for the | ||
| associated python package | ||
| * ``extensions/bindings.cpp`` provides python bindings for our operation | ||
| * ``extensions/CMakeLists.txt`` holds CMake rules to build the library and | ||
|
|
@@ -697,7 +697,7 @@ are already provided, adding our :meth:`axpby` becomes very simple! | |
| py::kw_only(), | ||
| "stream"_a = py::none(), | ||
| R"pbdoc( | ||
| Scale and sum two vectors elementwise | ||
| Scale and sum two vectors element-wise | ||
| ``z = alpha * x + beta * y`` | ||
|
|
||
| Follows numpy style broadcasting between ``x`` and ``y`` | ||
|
|
@@ -840,7 +840,7 @@ This will result in a directory structure as follows: | |
| | ... | ||
|
|
||
| When you try to install using the command ``python -m pip install .`` | ||
| (in ``extensions/``), the package will be installed with the same strucutre as | ||
| (in ``extensions/``), the package will be installed with the same structure as | ||
| ``extensions/mlx_sample_extensions`` and the C++ and metal library will be | ||
| copied along with the python binding since they are specified as ``package_data``. | ||
|
|
||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a guess...