Skip to content

[ExecuTorch] Make ForcedUnroll usage in bf16 BlasKernel actually work for -Oz builds #5247

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions kernels/optimized/blas/BlasKernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static_assert(kF32RegistersPerIteration == 1 << kF32RegistersPerIterationShift);
static inline double reduce(float32x4_t x[kF32RegistersPerIteration]) {
int offset = kF32RegistersPerIteration;
utils::ForcedUnroll<kF32RegistersPerIterationShift>{}(
[&offset, &x](auto idx) {
[&offset, &x](auto idx) ET_INLINE_ATTRIBUTE {
offset /= 2;
for (int i = 0; i < offset; ++i) {
x[i] = vaddq_f32(x[i], x[offset + i]);
Expand Down Expand Up @@ -115,7 +115,7 @@ float dot_with_fp32_arith(const T* vec1, const T* vec2, int64_t len) {
const auto* vec1_ = vec1 + j;
const auto* vec2_ = vec2 + j;
utils::ForcedUnroll<kF32RegisterPairsPerIteration>{}(
[vec1_, vec2_, &sum](auto k) {
[vec1_, vec2_, &sum](auto k) ET_INLINE_ATTRIBUTE {
dot_with_fp32_arith_main_inner_loop(vec1_, vec2_, sum, k);
});
}
Expand Down
1 change: 1 addition & 0 deletions runtime/platform/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#define ET_NORETURN [[noreturn]]
#define ET_NOINLINE __attribute__((noinline))
#define ET_INLINE __attribute__((always_inline)) inline
#define ET_INLINE_ATTRIBUTE __attribute__((always_inline))

#if defined(__GNUC__)

Expand Down
Loading