patrick-kidger / patrick-kidger/diffrax

Create custom more-efficient `searchsorted` implementation.

Open
#81 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

refactor
Dominant language
Python
Stars
2.1k
Forks
189
Avg merge
3d 18h
Merged PRs (30d)
1

Description

The current JAX implementation of searchsorted, available here:

https://github.com/google/jax/blob/f7df3ee9c4221a202959e67816d485c35eb98102/jax/_src/numpy/lax_numpy.py#L4219

has some flaws.

  • It uses a for loop to run to iteration, rather than early-stopping once the best value has been found.
  • It doesn't allow for any kind of hint for where to start.

In particular once hints are in then we can improve the efficiency of our own use of it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the JAX searchsorted implementation linked in jax/_src/numpy/lax_numpy.py around line 4219. Determine how the current loop and starting position work, then design the custom implementation around early stopping and optional hints. Done means the implementation supports those efficiency improvements and improves Diffrax's own use of searchsorted.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.