Skip to content

Allow user to choose which kernel to use for nbit-CPU-TBE through env variables#2299

Closed
excelle08 wants to merge 1 commit into
pytorch:mainfrom
excelle08:export-D53275825
Closed

Allow user to choose which kernel to use for nbit-CPU-TBE through env variables#2299
excelle08 wants to merge 1 commit into
pytorch:mainfrom
excelle08:export-D53275825

Conversation

@excelle08

Copy link
Copy Markdown
Contributor

Summary:
Allow user to choose which kernel (asmjit / autovec / ref) to use for nbit-CPU-TBE through env variables.

Choosing which kernel (autovec/asmjit/ref) to use for nbit-CPU-TBE

Available kernels:

  • ref: non-optimized, reference implementation that focuses on
    correctness, not performance
  • asmjit: hand-optimized kernel by having asmjit emit SIMD
    instructions during runtime. Only supports x86_64 CPUs with
    AVX2/AVX512 instruction sets
  • autovec: the kernel written in regular C++ code but in a
    way that makes compilers easier to generate vectorized SIMD
    instructions out of it. Supports both x86_64 and aarch64 CPUs.
    Currently only available on Linux.

How to set environment variables:

  • No environment variables: on x86_64 we will default to asmjit
    kernel, and on aarch64 and linux we will default to autovec.
    On non-linux aarch64 we will fall back to ref.
  • FBGEMM_NO_AUTOVEC=1: on aarch64 linux we will use ref. On other
    platforms this will have no effect.
  • FBGEMM_NO_ASMJIT=1: on x86_64 we will use ref. On other
    platforms this will have no effect.
  • FBGEMM_NO_ASMJIT=1 AND FBGEMM_FORCE_AUTOVEC=1: on x86_64 we will
    use autovec if these two variables are set at the same time.
    No effect on other platforms.
  • FBGEMM_FORCE_AUTOVEC will override FBGEMM_NO_AUTOVEC if they
    are set at the same time.
  • These variables are considered set as long as they exist, even
    if their content is set to "0", "no" or "false".

Differential Revision: D53275825

@netlify

netlify Bot commented Jan 31, 2024

Copy link
Copy Markdown

Deploy Preview for pytorch-fbgemm-docs ready!

Name Link
🔨 Latest commit 6547a86
🔍 Latest deploy log https://app.netlify.com/sites/pytorch-fbgemm-docs/deploys/65bab70bb510d00008e7c547
😎 Deploy Preview https://deploy-preview-2299--pytorch-fbgemm-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D53275825

excelle08 added a commit to excelle08/FBGEMM that referenced this pull request Jan 31, 2024
… variables (pytorch#2299)

Summary:

Allow user to choose which kernel (asmjit / autovec / ref) to use for nbit-CPU-TBE through env variables.

Choosing which kernel (autovec/asmjit/ref) to use for nbit-CPU-TBE

Available kernels:
   * ref: non-optimized, reference implementation that focuses on
      correctness, not performance
   * asmjit: hand-optimized kernel by having asmjit emit SIMD
      instructions during runtime. Only supports x86_64 CPUs with
      AVX2/AVX512 instruction sets
   * autovec: the kernel written in regular C++ code but in a
      way that makes compilers easier to generate vectorized SIMD
      instructions out of it. Supports both x86_64 and aarch64 CPUs.
      Currently only available on Linux.

 How to set environment variables:
   * No environment variables: on x86_64 we will default to asmjit
      kernel, and on aarch64 and linux we will default to autovec.
      On non-linux aarch64 we will fall back to ref.
   * FBGEMM_NO_AUTOVEC=1: on aarch64 linux we will use ref. On other
      platforms this will have no effect.
   * FBGEMM_NO_ASMJIT=1: on x86_64 we will use ref. On other
      platforms this will have no effect.
   * FBGEMM_NO_ASMJIT=1 AND FBGEMM_FORCE_AUTOVEC=1: on x86_64 we will
      use autovec if these two variables are set at the same time.
      No effect on other platforms.
   * FBGEMM_FORCE_AUTOVEC will override FBGEMM_NO_AUTOVEC if they
      are set at the same time.
   * These variables are considered set as long as they exist, even
      if their content is set to "0", "no" or "false".

Differential Revision: D53275825
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D53275825

excelle08 added a commit to excelle08/FBGEMM that referenced this pull request Jan 31, 2024
… variables (pytorch#2299)

Summary:

Allow user to choose which kernel (asmjit / autovec / ref) to use for nbit-CPU-TBE through env variables.

Choosing which kernel (autovec/asmjit/ref) to use for nbit-CPU-TBE

Available kernels:
   * ref: non-optimized, reference implementation that focuses on
      correctness, not performance
   * asmjit: hand-optimized kernel by having asmjit emit SIMD
      instructions during runtime. Only supports x86_64 CPUs with
      AVX2/AVX512 instruction sets
   * autovec: the kernel written in regular C++ code but in a
      way that makes compilers easier to generate vectorized SIMD
      instructions out of it. Supports both x86_64 and aarch64 CPUs.
      Currently only available on Linux.

 How to set environment variables:
   * No environment variables: on x86_64 we will default to asmjit
      kernel, and on aarch64 and linux we will default to autovec.
      On non-linux aarch64 we will fall back to ref.
   * FBGEMM_NO_AUTOVEC=1: on aarch64 linux we will use ref. On other
      platforms this will have no effect.
   * FBGEMM_NO_ASMJIT=1: on x86_64 we will use ref. On other
      platforms this will have no effect.
   * FBGEMM_NO_ASMJIT=1 AND FBGEMM_FORCE_AUTOVEC=1: on x86_64 we will
      use autovec if these two variables are set at the same time.
      No effect on other platforms.
   * FBGEMM_FORCE_AUTOVEC will override FBGEMM_NO_AUTOVEC if they
      are set at the same time.
   * These variables are considered set as long as they exist, even
      if their content is set to "0", "no" or "false".

Reviewed By: jspark1105

Differential Revision: D53275825
excelle08 added a commit to excelle08/FBGEMM that referenced this pull request Jan 31, 2024
… variables (pytorch#2299)

Summary:

Allow user to choose which kernel (asmjit / autovec / ref) to use for nbit-CPU-TBE through env variables.

Choosing which kernel (autovec/asmjit/ref) to use for nbit-CPU-TBE

Available kernels:
   * ref: non-optimized, reference implementation that focuses on
      correctness, not performance
   * asmjit: hand-optimized kernel by having asmjit emit SIMD
      instructions during runtime. Only supports x86_64 CPUs with
      AVX2/AVX512 instruction sets
   * autovec: the kernel written in regular C++ code but in a
      way that makes compilers easier to generate vectorized SIMD
      instructions out of it. Supports both x86_64 and aarch64 CPUs.
      Currently only available on Linux.

 How to set environment variables:
   * No environment variables: on x86_64 we will default to asmjit
      kernel, and on aarch64 and linux we will default to autovec.
      On non-linux aarch64 we will fall back to ref.
   * FBGEMM_NO_AUTOVEC=1: on aarch64 linux we will use ref. On other
      platforms this will have no effect.
   * FBGEMM_NO_ASMJIT=1: on x86_64 we will use ref. On other
      platforms this will have no effect.
   * FBGEMM_NO_ASMJIT=1 AND FBGEMM_FORCE_AUTOVEC=1: on x86_64 we will
      use autovec if these two variables are set at the same time.
      No effect on other platforms.
   * FBGEMM_FORCE_AUTOVEC will override FBGEMM_NO_AUTOVEC if they
      are set at the same time.
   * These variables are considered set as long as they exist, even
      if their content is set to "0", "no" or "false".

Reviewed By: jspark1105

Differential Revision: D53275825
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D53275825

… variables (pytorch#2299)

Summary:

Allow user to choose which kernel (asmjit / autovec / ref) to use for nbit-CPU-TBE through env variables.

Choosing which kernel (autovec/asmjit/ref) to use for nbit-CPU-TBE

Available kernels:
   * ref: non-optimized, reference implementation that focuses on
      correctness, not performance
   * asmjit: hand-optimized kernel by having asmjit emit SIMD
      instructions during runtime. Only supports x86_64 CPUs with
      AVX2/AVX512 instruction sets
   * autovec: the kernel written in regular C++ code but in a
      way that makes compilers easier to generate vectorized SIMD
      instructions out of it. Supports both x86_64 and aarch64 CPUs.
      Currently only available on Linux.

 How to set environment variables:
   * No environment variables: on x86_64 we will default to asmjit
      kernel, and on aarch64 and linux we will default to autovec.
      On non-linux aarch64 we will fall back to ref.
   * FBGEMM_NO_AUTOVEC=1: on aarch64 linux we will use ref. On other
      platforms this will have no effect.
   * FBGEMM_NO_ASMJIT=1: on x86_64 we will use ref. On other
      platforms this will have no effect.
   * FBGEMM_NO_ASMJIT=1 AND FBGEMM_FORCE_AUTOVEC=1: on x86_64 we will
      use autovec if these two variables are set at the same time.
      No effect on other platforms.
   * FBGEMM_FORCE_AUTOVEC will override FBGEMM_NO_AUTOVEC if they
      are set at the same time.
   * These variables are considered set as long as they exist, even
      if their content is set to "0", "no" or "false".

Reviewed By: jspark1105, jasonjk-park

Differential Revision: D53275825
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D53275825

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request has been merged in 3d7af4a.

meta-codesync Bot pushed a commit that referenced this pull request Jan 13, 2026
Summary:
X-link: https://github.com/facebookresearch/FBGEMM/pull/2300
Pull Request resolved: #5308

total_prefetch_duration previously only timed `_prefetch()`, missing `bounds_check_indices_kernel_v2` launched in `prepare_inputs()`. moved timer to wrap both calls for accurate prefetch timing.

Reviewed By: q10

Differential Revision: D90425962

fbshipit-source-id: 0d2fef51c84dc01ee81e54eaa43bfc42e7153c10
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.

2 participants