-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Neon Dot QP8 ukernels, tests, benchmarks
- Loading branch information
Showing
16 changed files
with
629 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// This source code is licensed under the BSD-style license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
// | ||
// Auto-generated file. Do not edit! | ||
// Specification: test/qp8-f32-qb4w-gemm-minmax.yaml | ||
// Generator: tools/generate-gemm-test.py | ||
|
||
#include <benchmark/benchmark.h> | ||
#include "bench/gemm-benchmark.h" | ||
#include "bench/utils.h" | ||
#include "xnnpack/common.h" | ||
#include "xnnpack/gemm.h" | ||
#include "xnnpack/isa-checks.h" | ||
#include "xnnpack/microfnptr.h" | ||
#include "xnnpack/microparams-init.h" | ||
#include "xnnpack/pack.h" | ||
#include "xnnpack/packw.h" | ||
|
||
|
||
#if XNN_ENABLE_ARM_DOTPROD && XNN_ARCH_ARM64 | ||
#if XNN_ENABLE_KLEIDIAI | ||
static void qp8_f32_qb4w_gemm_minmax_ukernel_1x4c16s2__aarch64_neondot(benchmark::State& state, const char* net) { | ||
GEMMBenchmark(state, | ||
xnn_qp8_f32_qb4w_gemm_minmax_ukernel_1x4c16s2__aarch64_neondot, | ||
xnn_init_f32_qb4w_minmax_scalar_params, | ||
xnn_pack_kai_qb4_weights_and_biases, | ||
xnn_packed_stride_kai_qb4_weights_and_biases, | ||
/*mr=*/1, /*nr=*/4, /*kr=*/16, /*sr=*/2, | ||
/*mr_packed=*/1, | ||
benchmark::utils::CheckNEONDOT); | ||
} | ||
|
||
BENCHMARK_GEMM_BL(qp8_f32_qb4w_gemm_minmax_ukernel_1x4c16s2__aarch64_neondot) | ||
|
||
static void qp8_f32_qb4w_gemm_minmax_ukernel_1x8c16s2__aarch64_neondot(benchmark::State& state, const char* net) { | ||
GEMMBenchmark(state, | ||
xnn_qp8_f32_qb4w_gemm_minmax_ukernel_1x8c16s2__aarch64_neondot, | ||
xnn_init_f32_qb4w_minmax_scalar_params, | ||
xnn_pack_kai_qb4_weights_and_biases, | ||
xnn_packed_stride_kai_qb4_weights_and_biases, | ||
/*mr=*/1, /*nr=*/8, /*kr=*/16, /*sr=*/2, | ||
/*mr_packed=*/1, | ||
benchmark::utils::CheckNEONDOT); | ||
} | ||
|
||
BENCHMARK_GEMM_BL(qp8_f32_qb4w_gemm_minmax_ukernel_1x8c16s2__aarch64_neondot) | ||
#endif // XNN_ENABLE_KLEIDIAI | ||
#endif // XNN_ENABLE_ARM_DOTPROD && XNN_ARCH_ARM64 | ||
|
||
|
||
#ifndef XNNPACK_BENCHMARK_NO_MAIN | ||
BENCHMARK_MAIN(); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/qp8-f32-qb4w-gemm/qp8-f32-qb4w-gemm-minmax-1x4c16s2-aarch64-neondot.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2024 Google LLC | ||
// | ||
// This source code is licensed under the BSD-style license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
#include <stddef.h> | ||
#include "xnnpack/log.h" | ||
#include "xnnpack/microparams.h" | ||
|
||
#if XNN_ENABLE_KLEIDIAI | ||
#include "kai/ukernels/matmul/matmul_clamp_f32_qai8dxp_qsi4c32p/kai_matmul_clamp_f32_qai8dxp1x8_qsi4c32p4x8_1x4x32_neon_dotprod.h" | ||
#endif // XNN_ENABLE_KLEIDIAI | ||
|
||
// Wraps the | ||
// `kai_run_matmul_clamp_f32_qai8dxp1x8_qsi4cxp4x8_1x4x32_neon_dotprod` GEMM | ||
// microkernel with a name that is compatible with our tooling. | ||
void xnn_qp8_f32_qb4w_gemm_minmax_ukernel_1x4c16s2__aarch64_neondot( | ||
size_t m, size_t n, size_t k, const void* lhs_packed, | ||
const void* rhs_packed, float* dst, size_t dst_stride_row, | ||
size_t dst_stride_col, | ||
const union xnn_f32_qb4w_minmax_params | ||
minmax_params[XNN_RESTRICT XNN_MIN_ELEMENTS(1)]) { | ||
#if XNN_ENABLE_KLEIDIAI | ||
kai_run_matmul_clamp_f32_qai8dxp1x8_qsi4c32p4x8_1x4x32_neon_dotprod( | ||
m, n, k, minmax_params->scalar.blocksize, lhs_packed, rhs_packed, dst, dst_stride_row, dst_stride_col, | ||
minmax_params->scalar.min, minmax_params->scalar.max); | ||
#else | ||
xnn_log_fatal( | ||
"Calling KleidiAI microkernel wrapper, but XNNPACK was compiled without " | ||
"`XNN_ENABLE_KLEIDIAI`."); | ||
#endif // XNN_ENABLE_KLEIDIAI | ||
} |
32 changes: 32 additions & 0 deletions
32
src/qp8-f32-qb4w-gemm/qp8-f32-qb4w-gemm-minmax-1x8c16s2-aarch64-neondot.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2024 Google LLC | ||
// | ||
// This source code is licensed under the BSD-style license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
#include <stddef.h> | ||
#include "xnnpack/log.h" | ||
#include "xnnpack/microparams.h" | ||
|
||
#if XNN_ENABLE_KLEIDIAI | ||
#include "kai/ukernels/matmul/matmul_clamp_f32_qai8dxp_qsi4c32p/kai_matmul_clamp_f32_qai8dxp1x8_qsi4c32p8x8_1x8x32_neon_dotprod.h" | ||
#endif // XNN_ENABLE_KLEIDIAI | ||
|
||
// Wraps the | ||
// `kai_run_matmul_clamp_f32_qai8dxp1x8_qsi4cxp8x8_1x8x32_neon_dotprod` GEMM | ||
// microkernel with a name that is compatible with our tooling. | ||
void xnn_qp8_f32_qb4w_gemm_minmax_ukernel_1x8c16s2__aarch64_neondot( | ||
size_t m, size_t n, size_t k, const void* lhs_packed, | ||
const void* rhs_packed, float* dst, size_t dst_stride_row, | ||
size_t dst_stride_col, | ||
const union xnn_f32_qb4w_minmax_params | ||
minmax_params[XNN_RESTRICT XNN_MIN_ELEMENTS(1)]) { | ||
#if XNN_ENABLE_KLEIDIAI | ||
kai_run_matmul_clamp_f32_qai8dxp1x8_qsi4c32p8x8_1x8x32_neon_dotprod( | ||
m, n, k, minmax_params->scalar.blocksize, lhs_packed, rhs_packed, dst, dst_stride_row, dst_stride_col, | ||
minmax_params->scalar.min, minmax_params->scalar.max); | ||
#else | ||
xnn_log_fatal( | ||
"Calling KleidiAI microkernel wrapper, but XNNPACK was compiled without " | ||
"`XNN_ENABLE_KLEIDIAI`."); | ||
#endif // XNN_ENABLE_KLEIDIAI | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.