Skip to content

Conversation

vtavana
Copy link
Collaborator

@vtavana vtavana commented Aug 28, 2025

drop support for maximum and minimum for both float and complex dtypes since they do not bring performance improvement compared to stock NumPy implementation.

timing on: Intel(R) Xeon(R) Platinum 8480+ OpenCL 3.0 (Build 0) [2025.20.7.0.08_160000.prerelease]

on the main branch:
Function maximum:

Function: maximum | Dtype: float64
      Size |   NumPy (ms) |  MKL_umath (ms)
---------------------------------------------
     10**4 |        0.003 |           0.039
     10**5 |        0.053 |           0.514
     10**6 |        0.730 |           5.165
     10**7 |       22.584 |          62.269
     10**8 |      279.800 |         647.993

Function: maximum | Dtype: complex128
      Size |   NumPy (ms) |  MKL_umath (ms)
---------------------------------------------
     10**4 |        0.041 |           0.087
     10**5 |        0.522 |           0.877
     10**6 |        4.829 |           8.758
     10**7 |       74.019 |         113.827
     10**8 |      751.199 |        1150.744

Function minimum:

Function: minimum | Dtype: float64
      Size |   NumPy (ms) |  MKL_umath (ms)
---------------------------------------------
     10**4 |        0.003 |           0.038
     10**5 |        0.051 |           0.515
     10**6 |        0.929 |           5.153
     10**7 |       22.894 |          62.631
     10**8 |      278.826 |         647.707
     
Function: minimum | Dtype: complex128
      Size |   NumPy (ms) |  MKL_umath (ms)
---------------------------------------------
     10**4 |        0.042 |           0.083
     10**5 |        0.489 |           0.852
     10**6 |        4.854 |           8.416
     10**7 |       73.240 |         108.444
     10**8 |      764.019 |        1125.169 

@vtavana vtavana self-assigned this Aug 28, 2025
@vtavana vtavana marked this pull request as ready for review August 28, 2025 12:45
Copy link
Collaborator

@ndgrigorian ndgrigorian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

considering the significant slowdown this LGTM

I wonder if this performance issue should be passed to MKL team

@vtavana
Copy link
Collaborator Author

vtavana commented Aug 29, 2025

considering the significant slowdown this LGTM

I wonder if this performance issue should be passed to MKL team

MKL does not have any equivalent function for maximum and minimum and mkl_umath implementation was based on primitive/built-in operators. This implementation is similar to what was used in numpy-1.22. However, stock numpy-1.23, the implementation was updated which is faster and so current numpy is faster than mkl_umath.

MKL only has equivalent function for float loops of fmax and fmin which are already been used in mkl_umath.
And I am going to drop support for complex loop of fmax and fmin as well since there is no performance improvement there.

@vtavana vtavana merged commit d3183fe into main Aug 29, 2025
40 checks passed
@vtavana vtavana deleted the drop-max-min branch August 29, 2025 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants