Skip to content

Vectorize f16 conversion#4253

Closed
Nicoshev wants to merge 1 commit into
pytorch:mainfrom
Nicoshev:export-D75926678
Closed

Vectorize f16 conversion#4253
Nicoshev wants to merge 1 commit into
pytorch:mainfrom
Nicoshev:export-D75926678

Conversation

@Nicoshev

@Nicoshev Nicoshev commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

Summary:
X-link: https://github.com/facebookresearch/FBGEMM/pull/1330

Use C++ language extension type '__fp16' to let clang vectorize float16 conversion, on aarch64 compilation.

'float16 to float' will now be vectorized
'float to float16' gets improved

before (higher is better):

 M elements_per_ns_ref elements_per_ns_simd
 1     0.0302            0.0242
10     0.205             0.231
32     0.328             0.579
40     0.354             0.697

129 0.442 1.87
256 0.466 1.92
1024 0.488 2.38
8000 0.494 2.55

after:

 M elements_per_ns_ref elements_per_ns_simd
 1     0.0307           0.0253
10     0.301            0.256
32     0.898            0.793
40     1.12             0.967

129 2.76 2.59
256 4.09 3.7
1024 5.67 5.47
8000 6.3 6.31

Differential Revision: D75926678

@netlify

netlify Bot commented Jun 4, 2025

Copy link
Copy Markdown

Deploy Preview for pytorch-fbgemm-docs failed.

Name Link
🔨 Latest commit da33d89
🔍 Latest deploy log https://app.netlify.com/projects/pytorch-fbgemm-docs/deploys/6841284c909b420008914141

@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@Nicoshev Nicoshev force-pushed the export-D75926678 branch from 621eaa9 to f682345 Compare June 4, 2025 17:34
Nicoshev added a commit to Nicoshev/FBGEMM that referenced this pull request Jun 4, 2025
Summary:

X-link: facebookresearch/FBGEMM#1330

Use C++ language extension type '__fp16' to let clang vectorize float16 conversion, on aarch64 compilation.

'float16 to float' will now be vectorized
'float to float16' gets improved

before (higher is better):

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0302            0.0242
    10     0.205             0.231
    32     0.328             0.579
    40     0.354             0.697
   129     0.442             1.87
   256     0.466             1.92
  1024     0.488             2.38 
  8000     0.494             2.55

after:

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0307           0.0253
    10     0.301            0.256
    32     0.898            0.793
    40     1.12             0.967
   129     2.76             2.59
   256     4.09             3.7
  1024     5.67             5.47 
  8000     6.3              6.31

Differential Revision: D75926678
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

Nicoshev added a commit to Nicoshev/FBGEMM that referenced this pull request Jun 4, 2025
Summary:
Pull Request resolved: pytorch#4253

X-link: facebookresearch/FBGEMM#1330

Use C++ language extension type '__fp16' to let clang vectorize float16 conversion, on aarch64 compilation.

'float16 to float' will now be vectorized
'float to float16' gets improved

before (higher is better):

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0302            0.0242
    10     0.205             0.231
    32     0.328             0.579
    40     0.354             0.697
   129     0.442             1.87
   256     0.466             1.92
  1024     0.488             2.38
  8000     0.494             2.55

after:

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0307           0.0253
    10     0.301            0.256
    32     0.898            0.793
    40     1.12             0.967
   129     2.76             2.59
   256     4.09             3.7
  1024     5.67             5.47
  8000     6.3              6.31

Differential Revision: D75926678
@Nicoshev Nicoshev force-pushed the export-D75926678 branch 2 times, most recently from a42bc58 to d5f0c8b Compare June 4, 2025 17:55
Nicoshev added a commit to Nicoshev/FBGEMM that referenced this pull request Jun 4, 2025
Summary:

X-link: facebookresearch/FBGEMM#1330

Use C++ language extension type '__fp16' to let clang vectorize float16 conversion, on aarch64 compilation.

'float16 to float' will now be vectorized
'float to float16' gets improved

before (higher is better):

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0302            0.0242
    10     0.205             0.231
    32     0.328             0.579
    40     0.354             0.697
   129     0.442             1.87
   256     0.466             1.92
  1024     0.488             2.38 
  8000     0.494             2.55

after:

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0307           0.0253
    10     0.301            0.256
    32     0.898            0.793
    40     1.12             0.967
   129     2.76             2.59
   256     4.09             3.7
  1024     5.67             5.47 
  8000     6.3              6.31

Reviewed By: MatzeB

Differential Revision: D75926678
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@Nicoshev Nicoshev force-pushed the export-D75926678 branch from d5f0c8b to 4e4ad3a Compare June 4, 2025 17:59
Nicoshev added a commit to Nicoshev/FBGEMM that referenced this pull request Jun 4, 2025
Summary:
Pull Request resolved: pytorch#4253

X-link: facebookresearch/FBGEMM#1330

Use C++ language extension type '__fp16' to let clang vectorize float16 conversion, on aarch64 compilation.

'float16 to float' will now be vectorized
'float to float16' gets improved

before (higher is better):

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0302            0.0242
    10     0.205             0.231
    32     0.328             0.579
    40     0.354             0.697
   129     0.442             1.87
   256     0.466             1.92
  1024     0.488             2.38
  8000     0.494             2.55

after:

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0307           0.0253
    10     0.301            0.256
    32     0.898            0.793
    40     1.12             0.967
   129     2.76             2.59
   256     4.09             3.7
  1024     5.67             5.47
  8000     6.3              6.31

Reviewed By: MatzeB

Differential Revision: D75926678
@Nicoshev Nicoshev force-pushed the export-D75926678 branch from 4e4ad3a to 309115a Compare June 5, 2025 05:04
Nicoshev added a commit to Nicoshev/FBGEMM that referenced this pull request Jun 5, 2025
Summary:

X-link: facebookresearch/FBGEMM#1330

Use C++ language extension type '__fp16' to let clang vectorize float16 conversion, on aarch64 compilation.

'float16 to float' will now be vectorized
'float to float16' gets improved

before (higher is better):

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0302            0.0242
    10     0.205             0.231
    32     0.328             0.579
    40     0.354             0.697
   129     0.442             1.87
   256     0.466             1.92
  1024     0.488             2.38 
  8000     0.494             2.55

after:

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0307           0.0253
    10     0.301            0.256
    32     0.898            0.793
    40     1.12             0.967
   129     2.76             2.59
   256     4.09             3.7
  1024     5.67             5.47 
  8000     6.3              6.31

Reviewed By: MatzeB

Differential Revision: D75926678
Nicoshev added a commit to Nicoshev/FBGEMM that referenced this pull request Jun 5, 2025
Summary:

X-link: facebookresearch/FBGEMM#1330

Use C++ language extension type '__fp16' to let clang vectorize float16 conversion, on aarch64 compilation.

'float16 to float' will now be vectorized
'float to float16' gets improved

before (higher is better):

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0302            0.0242
    10     0.205             0.231
    32     0.328             0.579
    40     0.354             0.697
   129     0.442             1.87
   256     0.466             1.92
  1024     0.488             2.38 
  8000     0.494             2.55

after:

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0307           0.0253
    10     0.301            0.256
    32     0.898            0.793
    40     1.12             0.967
   129     2.76             2.59
   256     4.09             3.7
  1024     5.67             5.47 
  8000     6.3              6.31

Reviewed By: MatzeB

Differential Revision: D75926678
@Nicoshev Nicoshev force-pushed the export-D75926678 branch from 309115a to e026a54 Compare June 5, 2025 05:05
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

Nicoshev added a commit to Nicoshev/FBGEMM that referenced this pull request Jun 5, 2025
Summary:
Pull Request resolved: pytorch#4253

X-link: facebookresearch/FBGEMM#1330

Use C++ language extension type '__fp16' to let clang vectorize float16 conversion, on aarch64 compilation.

'float16 to float' will now be vectorized
'float to float16' gets improved

before (higher is better):

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0302            0.0242
    10     0.205             0.231
    32     0.328             0.579
    40     0.354             0.697
   129     0.442             1.87
   256     0.466             1.92
  1024     0.488             2.38
  8000     0.494             2.55

after:

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0307           0.0253
    10     0.301            0.256
    32     0.898            0.793
    40     1.12             0.967
   129     2.76             2.59
   256     4.09             3.7
  1024     5.67             5.47
  8000     6.3              6.31

Reviewed By: MatzeB

Differential Revision: D75926678
@Nicoshev Nicoshev force-pushed the export-D75926678 branch from e026a54 to 78b4c61 Compare June 5, 2025 05:10
Summary:
Pull Request resolved: pytorch#4253

X-link: facebookresearch/FBGEMM#1330

Use C++ language extension type '__fp16' to let clang vectorize float16 conversion, on aarch64 compilation.

'float16 to float' will now be vectorized
'float to float16' gets improved

before (higher is better):

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0302            0.0242
    10     0.205             0.231
    32     0.328             0.579
    40     0.354             0.697
   129     0.442             1.87
   256     0.466             1.92
  1024     0.488             2.38
  8000     0.494             2.55

after:

     M elements_per_ns_ref elements_per_ns_simd
     1     0.0307           0.0253
    10     0.301            0.256
    32     0.898            0.793
    40     1.12             0.967
   129     2.76             2.59
   256     4.09             3.7
  1024     5.67             5.47
  8000     6.3              6.31

Reviewed By: MatzeB

Differential Revision: D75926678
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request has been merged in 2479717.

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.

3 participants