Repository navigation
perf: hoist unsupported-dtype blacklist out of the scipy.fft interface hot path - #405
Open
intel-python-devops wants to merge 2 commits into
Open
intel-python-devops wants to merge 2 commits into
intel-python-devops wants to merge 2 commits into
Conversation
intel-python-devops
requested review from
antonwolfy,
jharlow-intel,
ndgrigorian,
vlad-perevezentsev and
xaleryb
as code owners
November 2, 2026 20:04
Comparing a dtype against np.half/np.float128/np.complex256 with `in` on a list coerces each scalar type to a dtype on every call. Storing np.dtype objects in a frozenset turns it into one hash lookup, roughly doubling the per-call saving of the previous commit on small transforms.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Note
This pull request is entirely AI-generated. Please review thoroughly.
_supported_array_or_not_implemented(called once by everymkl_fft.interfaces.scipy_fftentry point via_validate_input) used to rebuild ablack_listlist and re-run twohasattr(np, ...)probes on every call, and_x.dtype in black_listthen coerced each scalar type to a dtype per comparison. The unsupported dtypes are now computed once at import time as_UNSUPPORTED_DTYPES, a module-levelfrozensetofnp.dtypeobjects, so the check is a single hash lookup.Behavior is unchanged: master and this branch accept and reject the same dtypes, including byte-swapped, metadata-carrying, structured, object and
StringDTypeinputs.Per-call time in µs (median of 12 interleaved rounds, Python 3.12, NumPy 2.5.3, i7-1185G7):
mkl_fft.interfaces.scipy_fft.fftscipy.fft.fftwithset_backendLarge transforms (n=65536) are unchanged within noise.