Issue warning on known-bad combinations for UCGate
synthesis
#10906
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.
Summary
The combination of AVX2-enabled Intel Macs with versions of NumPy compiled with Apple clang 14.0.0 has problems with the complex128
multiply
ufunc that makes it non-deterministic. The PyPI releases of the entire NumPy 1.25 series and the current newest 1.26.0 are all known to have this issue.This causes a severe instability in the
UCGate
synthesis code, to the degree of the returned results being (non-deterministically) completely invalid. This commit causes Qiskit to query the host platform and runtime NumPy features to guess if the bug is likely to be present; the results are so incorrect that we need to warn users so they can work around them.Details and comments
See #10305 for more detail, including the link to discussions on NumPy and the current set of known work-arounds for affected users.
If #10901 merges before this commit, I should be able to update this PR to relax the
numpy<1.25
constraint in CI, which in turn would mean #10305 could be resolved.The https://qisk.it/cmul-avx2-numpy-bug shortlink used in the warning and the release note currently points to #10305 (comment).