-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2da307d
commit 509f05f
Showing
3 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -14,3 +14,4 @@ practices, and helps users solve some common problems. | |
loading_data | ||
storage_backend | ||
chunking | ||
operator_fusion |
This file contains 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.. _operator_fusion: | ||
|
||
=============== | ||
Operator Fusion | ||
=============== | ||
|
||
Xorbits implements operator fusion optimization to reduce memory access overhead and improve computational efficiency. | ||
The fusion engine combines multiple nearby operators into a single fused one. Rather than implementing our own fusion | ||
engine from scratch, Xorbits leverages existing state-of-the-art fusion engines: NumExpr, JAX, or CuPy. Operator Fusion | ||
is available automatically when one of the fusion packages is installed in your Python environment. Operator fusion is | ||
especially effective for ``xorbits.numpy``. | ||
|
||
How It Works | ||
----------- | ||
|
||
The optimization process works as follows: | ||
|
||
1. Identifies sequences of operations that can be fused together. | ||
|
||
Note that NumExpr, JAX, and CuPy are single-machine fusion engines, while Xorbits is a distributed toolkit. | ||
Xorbits will check which operations can be fused. For example, operations like single-axis reduction (``len(op.axis) == 1`` | ||
for ``xorbits.numpy.sum()`` or ``xorbits.numpy.max()``) can be fused, while other reduction operations are not. | ||
|
||
2. Groups compatible operations into a single fused operation. | ||
|
||
3. Executes the fused operation using the appropriate fusion engines (JAX, NumExpr, or CuPy). | ||
|
||
This optimization reduces: | ||
|
||
* Memory allocation/deallocation overhead | ||
* Data movement between operations | ||
|
||
The fusion can optimize chains of element-wise operations and simple reductions, | ||
where memory bandwidth is often the bottleneck rather than computational intensity. |