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

Embedding Projector: perform consistent knn calculation #6274

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alicialics
Copy link
Contributor

@alicialics alicialics commented Mar 26, 2023

Motivation for features / changes

Remove limitations on firefox when running embedding projectors
Using GPU-accelerated tensorflow.js to compute knn speed up computation time for firefox on M1 Pro from 25s to 15s (~40% speedup)

Technical description of changes

  1. Remove webgl check since the app won't work with webgl disabled anyway.
  2. Removed firefox limitation. The only firefox issue I know of is that firefox has a smaller MAX_TEXTURE_SIZE of 8192x8192 (compared to Chrome's 16384x16384) on M1 pro, so knn calculation work fine with <16384 points (t-SNE is limited to 10k points). On Chrome we can do 16000 points before a memory allocation errors occurs. On Safari we can actually get more than 16384 points to work but its very slow.
    If GPU computation fails we always fall back to CPU calculations.

This also have the added benefit of being 2x faster than naive computation on M1 Pro.

Screenshots of UI changes

N/A

Detailed steps to verify changes work correctly (as executed by you)

Build and run Embedding Projector to ensure t-SNE and UMAP works as expected on Firefox

Alternate designs / implementations considered

@bileschi
Copy link
Collaborator

bileschi commented Apr 7, 2023

Have you verified that this works on a recent Firefox build?

@alicialics
Copy link
Contributor Author

alicialics commented Apr 7, 2023

@bileschi
thanks for taking a look! yes firefox worked great on M1 Mac Pro and computing knn using tensorflow.js via GPU greatly speedup the process (40% speedup from 25s to 15s)!
I did also try it on my very low-end Windows 11 machine. Both (Chromium-based) Edge and Firefox was having some performance issues with t-SNE (10k points) but UMAP (5k points) worked great. I am hoping #6275 can improve perf further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants