Skip to content
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

[gpuCI] Forward-merge branch-22.06 to branch-22.08 [skip gpuci] #281

Merged
merged 2 commits into from
May 20, 2022

Conversation

GPUtester
Copy link
Contributor

Forward-merge triggered by push to branch-22.06 that creates a PR to keep branch-22.08 up-to-date. If this PR is unable to be immediately merged due to conflicts, it will remain open for the team to manually merge.

This PR fuses many kernels into a single kernel when computing the analytical 2x2 eigenvalues in `hessian_matrix_eigvals`. This gives a substantial performance improvement:

```Python
import cupy as cp
from cupyx.profiler import benchmark
from skimage import data

from cucim.skimage.feature import hessian_matrix, hessian_matrix_eigvals


img = cp.array(data.camera())
H = hessian_matrix(img)

perf = benchmark(hessian_matrix_eigvals, (H,), n_warmup=20, n_repeat=10000)
print(f"hessian_matrix_eigvals: {1000 * perf.gpu_times.mean()} ms")
```

Prior to this PR, the duration was: 
0.238 ms
with kernel fusion it is:
0.069 ms

Authors:
  - Gregory Lee (https://github.com/grlee77)

Approvers:
  - Gigon Bae (https://github.com/gigony)
  - https://github.com/jakirkham

URL: #280
)

This is a performance-related PR that will result in casting of small integer dtypes (8 and 16-bit) to 32-bit floats rather than the current use of 64-bit floats. The current behavior is consistent with scikit-image, although I have raised an issue there to potentially change to the behavior proposed here: scikit-image/scikit-image#6310. 

The changes required are quite small with the key one being the change to the `new_float_type` dict that gets used when promoting dtypes to a floating point type. Most other changes are in the tests where we sometimes have to bump up the tolerance when computations that were previously in double precision now get run in single precision instead.

I marked this as **breaking** because the output of various floating-point functions for integer inputs may now be `cp.float32` in cases where it was previously `cp.float64`.

Authors:
  - Gregory Lee (https://github.com/grlee77)

Approvers:
  - Gigon Bae (https://github.com/gigony)
  - https://github.com/jakirkham

URL: #278
@GPUtester GPUtester requested a review from a team as a code owner May 20, 2022 08:49
@GPUtester GPUtester merged commit a0be50d into branch-22.08 May 20, 2022
@GPUtester
Copy link
Contributor Author

SUCCESS - forward-merge complete.

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