core: optimize convert arrays - #430
Draft
kennykos wants to merge 7 commits into
Draft
Conversation
Speeds up convert array on 6 arrays from 2.8 ms --> 1.5 ms
Each call to is_array cost ~40\mu s
The call to inspect signature alone cost ~300 mu s
kennykos
marked this pull request as draft
July 3, 2026 13:43
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.
Description
convert_arrayswas taking ~2.2 ms for 6 CuPy arrays, versus ~0.1 ms of actual time-in-workunit.This PR applies the optimizations enumerated in the commit history to bring
convert_arraysdown to ~0.7 ms, a 3x speedup.Remaining bottleneck:
_init_viewinpykokkos/interface/views.pynow dominates the remaining cost at ~0.5 ms per array. I think that closing that gap will require optimizing Kokkos view initialization itself, which is out of scope here and left for a follow-up PR.Type of Change
Checklist
black==25.12.0(CI will enforce this)python3 runtests.pytestdirectory where applicableexamples/pykokkosfor large feature changesmodule: featurenaming conventionTesting
Tested with standard test suite.
Additional Notes
Function and kernel timings where done with the tau scripts