Skip to content

Conversation

@larryliu0820
Copy link
Contributor

@larryliu0820 larryliu0820 commented Oct 27, 2025

Getting warnings like the following:

  /home/larryliu/executorch/kernels/portable/cpu/op_maximum.cpp: In lambda function:
  /home/larryliu/executorch/kernels/portable/cpu/op_maximum.cpp:52:9: note: the ABI for passing parameters with 32-byte alignment has changed in GCC 4.6
     52 |         [](const auto val_a, const auto val_b) {
        |         ^
  /home/larryliu/executorch/../executorch/runtime/core/exec_aten/util/scalar_type_util.h:919:7: note: in definition of macro 'ET_INTERNAL_SWITCH'
    919 |       __VA_ARGS__                                              \
        |       ^~~~~~~~~~~
  /home/larryliu/executorch/../executorch/runtime/core/exec_aten/util/scalar_type_util.h:931:3: note: in expansion of macro 'ET_INTERNAL_SWITCH_CASE'
    931 |   ET_INTERNAL_SWITCH_CASE(                                             \
        |   ^~~~~~~~~~~~~~~~~~~~~~~
  /home/larryliu/executorch/../executorch/runtime/core/exec_aten/util/scalar_type_util.h:957:3: note: in expansion of macro 'ET_INTERNAL_SWITCH_CASE_INT_TYPES'
    957 |   ET_INTERNAL_SWITCH_CASE_INT_TYPES(CTYPE_ALIAS, __VA_ARGS__) \
        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/larryliu/executorch/../executorch/runtime/core/exec_aten/util/scalar_type_util.h:1008:3: note: in expansion of macro 'ET_INTERNAL_SWITCH_CASE_REAL_TYPES'
   1008 |   ET_INTERNAL_SWITCH_CASE_REAL_TYPES(CTYPE_ALIAS, __VA_ARGS__)               \
        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/larryliu/executorch/../executorch/runtime/core/exec_aten/util/scalar_type_util.h:1136:7: note: in expansion of macro 'ET_INTERNAL_SWITCH_CASE_REAL_TYPES_AND'
   1136 |       ET_INTERNAL_SWITCH_CASE_REAL_TYPES_AND(          \
        |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/larryliu/executorch/../executorch/runtime/core/exec_aten/util/scalar_type_util.h:1172:3: note: in expansion of macro 'ET_SWITCH_REAL_TYPES_AND'
   1172 |   ET_SWITCH_REAL_TYPES_AND(Bool, TYPE, CONTEXT, NAME, CTYPE_ALIAS, __VA_ARGS__)
        |   ^~~~~~~~~~~~~~~~~~~~~~~~
  /home/larryliu/executorch/kernels/portable/cpu/op_maximum.cpp:47:3: note: in expansion of macro 'ET_SWITCH_REALB_TYPES'
     47 |   ET_SWITCH_REALB_TYPES(compute_type, ctx, op_name, CTYPE_COMPUTE, [&]() {
        |   ^~~~~~~~~~~~~~~~~~~~~

Fixing them in this PR

Overview


This branch addresses GCC compiler warnings related to 32-byte alignment (ABI) when passing SIMD vector types to lambda functions in both portable and optimized kernel implementations.

Key Changes:

  • CMakeLists.txt: Added -Wno-psabi compiler flag to suppress ABI warnings for GNU compiler: $<$<CXX_COMPILER_ID:GNU>:-Wno-psabi>
  • Removed explicit template parameter <CTYPE> and changed lambda parameters from reference & to value (pass by value) from at::vec::map() and at::vec::map3() calls
// Before: 
at::vec::map<CTYPE>([alpha_val, b_val](Vec& x) { return x + Vec(alpha_val * b_val); }, ...);  

// After: 
at::vec::map([alpha_val, b_val](Vec x) { return x + Vec(alpha_val * b_val); }, ...);
  • Changed lambda parameters from value to reference & for lambdas being passed to apply_bitensor_elementwise_fn() and similar functions.
// Before:
[val_alpha](const auto val_a, const auto val_b) {
  return val_a + val_alpha * val_b;
}

// After:
[val_alpha](const auto& val_a, const auto& val_b) {
  return val_a + val_alpha * val_b;
}

Problem Solved


Before: GCC compiler produced numerous warnings like:

note: the ABI for passing parameters with 32-byte alignment has changed in GCC 4.6

These warnings appeared when SIMD vector types (e.g., __m256 from AVX) were passed to lambda functions, cluttering build output and making it difficult to spot real issues.

After: Clean builds with no ABI warnings, while maintaining identical functionality and performance characteristics.

Getting warnings like the following:

```
  /home/larryliu/executorch/kernels/portable/cpu/op_maximum.cpp: In lambda function:
  /home/larryliu/executorch/kernels/portable/cpu/op_maximum.cpp:52:9: note: the ABI for passing parameters with 32-byte alignment has changed in GCC 4.6
     52 |         [](const auto val_a, const auto val_b) {
        |         ^
  /home/larryliu/executorch/../executorch/runtime/core/exec_aten/util/scalar_type_util.h:919:7: note: in definition of macro 'ET_INTERNAL_SWITCH'
    919 |       __VA_ARGS__                                              \
        |       ^~~~~~~~~~~
  /home/larryliu/executorch/../executorch/runtime/core/exec_aten/util/scalar_type_util.h:931:3: note: in expansion of macro 'ET_INTERNAL_SWITCH_CASE'
    931 |   ET_INTERNAL_SWITCH_CASE(                                             \
        |   ^~~~~~~~~~~~~~~~~~~~~~~
  /home/larryliu/executorch/../executorch/runtime/core/exec_aten/util/scalar_type_util.h:957:3: note: in expansion of macro 'ET_INTERNAL_SWITCH_CASE_INT_TYPES'
    957 |   ET_INTERNAL_SWITCH_CASE_INT_TYPES(CTYPE_ALIAS, __VA_ARGS__) \
        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/larryliu/executorch/../executorch/runtime/core/exec_aten/util/scalar_type_util.h:1008:3: note: in expansion of macro 'ET_INTERNAL_SWITCH_CASE_REAL_TYPES'
   1008 |   ET_INTERNAL_SWITCH_CASE_REAL_TYPES(CTYPE_ALIAS, __VA_ARGS__)               \
        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/larryliu/executorch/../executorch/runtime/core/exec_aten/util/scalar_type_util.h:1136:7: note: in expansion of macro 'ET_INTERNAL_SWITCH_CASE_REAL_TYPES_AND'
   1136 |       ET_INTERNAL_SWITCH_CASE_REAL_TYPES_AND(          \
        |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/larryliu/executorch/../executorch/runtime/core/exec_aten/util/scalar_type_util.h:1172:3: note: in expansion of macro 'ET_SWITCH_REAL_TYPES_AND'
   1172 |   ET_SWITCH_REAL_TYPES_AND(Bool, TYPE, CONTEXT, NAME, CTYPE_ALIAS, __VA_ARGS__)
        |   ^~~~~~~~~~~~~~~~~~~~~~~~
  /home/larryliu/executorch/kernels/portable/cpu/op_maximum.cpp:47:3: note: in expansion of macro 'ET_SWITCH_REALB_TYPES'
     47 |   ET_SWITCH_REALB_TYPES(compute_type, ctx, op_name, CTYPE_COMPUTE, [&]() {
        |   ^~~~~~~~~~~~~~~~~~~~~
```

Fixing them in this PR
@pytorch-bot
Copy link

pytorch-bot bot commented Oct 27, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/15405

Note: Links to docs will display an error until the docs builds have been completed.

❗ 2 Active SEVs

There are 2 currently active SEVs. If your PR is affected, please view them below:

⏳ No Failures, 7 Pending

As of commit c23e44f with merge base 72b1fa1 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 27, 2025
@larryliu0820 larryliu0820 added the release notes: none Do not include this in the release notes label Oct 28, 2025
@meta-codesync
Copy link

meta-codesync bot commented Oct 29, 2025

@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this in D85778660.

@larryliu0820 larryliu0820 merged commit 5914f8f into main Oct 29, 2025
153 checks passed
@larryliu0820 larryliu0820 deleted the fix_warning branch October 29, 2025 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants