SIGN IN SIGN UP

RegCount NITER calculation (#4159)

Summary:
Pull Request resolved: https://github.com/pytorch/executorch/pull/4159

This adds an internal implementation of https://github.com/microsoft/ArchProbe.

This stack introduces a kernel that can be used to get the number of available registers on a mobile GPU by gradually increasing the number of accessed elements and detecting dramatic drops in performance. See [this paper ](https://www.microsoft.com/en-us/research/uploads/prod/2022/02/mobigpu_mobicom22_camera.pdf), page 4, for more information.

This first diff gets the number of iterations (NITER) that can run in 1000us, to be used in the following tests.

The kernel looks like the following for any K number of registers:

  float reg_data0 = float(niter) + 0;
  float reg_data1 = float(niter) + 1;
  ...
  float reg_dataK = float(niter) + K;

  int i = 0;
  for (; i < niter; ++i) {
    reg_data0 *= reg_dataK;
    reg_data1 *= reg_data0;
    reg_data2 *= reg_data1;
    ...
    reg_dataK *= reg_data(K-1);
  }

  i = i >> 31;

  buffer_out.data[0 * i] = reg_data0;
  buffer_out.data[1 * i] = reg_data1;
  ...
  buffer_out.data[K * i] = reg_dataK;

Reviewed By: SS-JIA

Differential Revision: D59405012

fbshipit-source-id: 4445b5759bd8b354a0ded8c764b6fb2c9fe6184d
E
Esteban Padilla Cerdio committed
ac1c7d058151d17bb56ce69b20f2ce16190df0ad
Parent: 63e8025
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 7/11/2024, 5:23:12 PM