Skip to content

core: optimize convert arrays - #430

Draft
kennykos wants to merge 7 commits into
mainfrom
kennykos/convert-arrays
Draft

core: optimize convert arrays#430
kennykos wants to merge 7 commits into
mainfrom
kennykos/convert-arrays

Conversation

@kennykos

@kennykos kennykos commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Description

convert_arrays was 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_arrays down to ~0.7 ms, a 3x speedup.

Remaining bottleneck: _init_view in pykokkos/interface/views.py now 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

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactor / code cleanup
  • Other: runtime optimization

Checklist

  • Code is formatted with black==25.12.0 (CI will enforce this)
  • Tests pass locally with python3 runtests.py
  • New or updated unit tests added in the test directory where applicable
  • Examples added in examples/pykokkos for large feature changes
  • PR title follows the module: feature naming convention

Testing

Tested with standard test suite.

Additional Notes

Function and kernel timings where done with the tau scripts

#!/bin/bash

echo "Uninstrumented: "

python3 script.py

echo "With TAU:"
export TAU_TRACE=1
/bin/rm -f *.trc *.edf 

tau_python script.py

tau_treemerge.pl

tau_trace2json tau.trc tau.edf -chrome -ignoreatomic -o "convert_arrays_$(date +"%Y%m%d").json"

#firefox https://perfetto.dev & 

@kennykos
kennykos marked this pull request as draft July 3, 2026 13:43
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.

1 participant