Skip to content

Commit

Permalink
Hotfix m1 build (#1715)
Browse files Browse the repository at this point in the history
* fix apple m1 clang 13.1 compile error

* fix unit test compile error

Co-authored-by: quinnrong <quinnrong@quinnrongs-MacBook-Pro.local>
Co-authored-by: ealinli <37806708+1627180283@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 7, 2022
1 parent dfa2e85 commit 16d6a9a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
37 changes: 19 additions & 18 deletions source/tnn/device/arm/acc/compute/gemm_function.cc
Original file line number Diff line number Diff line change
Expand Up @@ -720,26 +720,24 @@ void Kernel_1x8(int m, int n, int k, const float *sa, const float *sb, float *sc
#ifdef __aarch64__
int64_t ldc_offset = ldc * sizeof(float) - 16;
int64_t k_64 = k;
asm volatile(
".macro INIT1x8 \n"
" mov x9, %2 \n"
" ld1 {v8.4s}, [x9], #16 \n"
" ld1 {v20.4s}, [x9], %3 \n"
" movi v9.4s, #0 \n"

#define INIT1x8 \
" mov x9, %2 \n" \
" ld1 {v8.4s}, [x9], #16 \n" \
" ld1 {v20.4s}, [x9], %3 \n" \
" movi v9.4s, #0 \n" \
" movi v21.4s, #0 \n"
".endm \n"
" \n"
".macro SAVE1x8 \n"
" mov x9, %2 \n"
" fadd v8.4s, v8.4s, v9.4s \n"
" fadd v20.4s, v20.4s, v21.4s \n"
" st1 {v8.4s}, [x9], #16 \n"
" st1 {v20.4s}, [x9], %3 \n"
".endm \n"
" \n"
#define SAVE1x8 \
" mov x9, %2 \n" \
" fadd v8.4s, v8.4s, v9.4s \n" \
" fadd v20.4s, v20.4s, v21.4s \n" \
" st1 {v8.4s}, [x9], #16 \n" \
" st1 {v20.4s}, [x9], %3 \n" \

asm volatile(
" ld1 {v0.4s}, [%0], #16 \n"
" ld1 {v2.4s}, [%1], #16 \n"
"INIT1x8 \n"
INIT1x8
"mov x8,%4 \n"
"0: \n"
" subs x9, x8, #4 \n"
Expand Down Expand Up @@ -775,11 +773,14 @@ void Kernel_1x8(int m, int n, int k, const float *sa, const float *sb, float *sc
" ld1 {v2.4s}, [%1], #16 \n"
" bne 1b \n"
"2: \n"
" SAVE1x8 \n"
SAVE1x8
" \n"
: "=r"(b), "=r"(a), "=r"(c), "=r"(ldc_offset), "=r"(k_64)
: "0"(b), "1"(a), "2"(c), "3"(ldc_offset), "4"(k_64)
: "memory", "cc", "x8", "x9", "v0", "v1", "v2", "v3", "v4", "v8", "v9", "v20", "v21");

#undef INIT1x8
#undef SAVE1x8
#else
int ldc_offset = ldc * sizeof(float) - 16;
asm volatile(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ if (MSVC)
src/gmock-all.cc
src/gmock_main.cc)
else()
set(cxx_strict "${cxx_strict} -Wno-deprecated-copy")
cxx_library(gmock "${cxx_strict}" src/gmock-all.cc)
target_link_libraries(gmock PUBLIC gtest)
cxx_library(gmock_main "${cxx_strict}" src/gmock_main.cc)
Expand Down

0 comments on commit 16d6a9a

Please sign in to comment.