Skip to content

Commit

Permalink
cpu: aarch64: non-global stats mode for ACL lnorm
Browse files Browse the repository at this point in the history
  * Change acl_layer_normalization to support non-global stats and
    inference only
  * Remove mean and variance check for ACL lnorm from benchdnn
  • Loading branch information
michalowski-arm authored and mgouicem committed Dec 3, 2024
1 parent f30310e commit 1cb82ca
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
5 changes: 0 additions & 5 deletions .github/automation/test_aarch64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ fi
if [[ "$OS" == "Linux" ]]; then
if [[ "$CMAKE_BUILD_TYPE" == "Debug" ]]; then
SKIPPED_TEST_FAILURES="cpu-primitives-deconvolution-cpp"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_lnorm_smoke_cpu"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_brgemm_smoke_cpu"
SKIPPED_TEST_FAILURES+="|cpu-primitives-matmul-cpp"
SKIPPED_TEST_FAILURES+="|test_convolution_backward_weights_f32"
Expand All @@ -71,7 +70,6 @@ if [[ "$OS" == "Linux" ]]; then
SKIPPED_TEST_FAILURES+="|test_graph_unit_dnnl_mqa_decomp_cpu"
elif [[ "$CMAKE_BUILD_TYPE" == "Release" ]]; then
SKIPPED_TEST_FAILURES="cpu-primitives-deconvolution-cpp"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_lnorm_smoke_cpu"
SKIPPED_TEST_FAILURES+="|cpu-graph-gqa-cpp"
SKIPPED_TEST_FAILURES+="|cpu-graph-mqa-cpp"
SKIPPED_TEST_FAILURES+="|cpu-graph-sdpa-cpp"
Expand All @@ -83,15 +81,12 @@ if [[ "$OS" == "Linux" ]]; then
elif [[ "$OS" == "Darwin" ]]; then
if [[ "$CMAKE_BUILD_TYPE" == "Debug" ]]; then
SKIPPED_TEST_FAILURES="cpu-primitives-deconvolution-cpp"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_lnorm_smoke_cpu"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_brgemm_smoke_cpu"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_brgemm_ci_cpu"
SKIPPED_TEST_FAILURES+="|test_graph_unit_dnnl_sdp_decomp_cpu"
SKIPPED_TEST_FAILURES+="|test_graph_unit_dnnl_mqa_decomp_cpu"
elif [[ "$CMAKE_BUILD_TYPE" == "Release" ]]; then
SKIPPED_TEST_FAILURES="cpu-primitives-deconvolution-cpp"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_lnorm_smoke_cpu"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_lnorm_ci_cpu"
SKIPPED_TEST_FAILURES+="|test_graph_unit_dnnl_sdp_decomp_cpu"
SKIPPED_TEST_FAILURES+="|test_graph_unit_dnnl_mqa_decomp_cpu"
fi
Expand Down
9 changes: 5 additions & 4 deletions src/cpu/aarch64/acl_layer_normalization.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2023 Arm Ltd. and affiliates
* Copyright 2023-2024 Arm Ltd. and affiliates
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -76,9 +76,10 @@ struct acl_layer_normalization_fwd_t : public primitive_t {
// dir and flags
ACL_CHECK_SUPPORT(
!is_fwd(), "ACL lnorm supports forward propagation only");
ACL_CHECK_SUPPORT(is_training() && !use_global_stats(),
"ACL only supports forward training with lnorm if stats "
"are provided (use global stats)");
ACL_CHECK_SUPPORT(
is_training(), "ACL supports inference only for lnorm");
ACL_CHECK_SUPPORT(use_global_stats(),
"ACL does not support global stats with lnorm");
ACL_CHECK_SUPPORT(use_scale() || use_shift(),
"ACL does not support lnorm scale and shift");

Expand Down
5 changes: 5 additions & 0 deletions tests/benchdnn/lnorm/lnorm.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*******************************************************************************
* Copyright 2019-2024 Intel Corporation
* Copyright 2024 Arm Ltd. and affiliates
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -635,10 +636,14 @@ int init_ref_memory_args(dnn_mem_map_t &ref_mem_map, dnn_mem_map_t &mem_map,
std::vector<data_kind_t> get_kinds_to_check(const prb_t *prb) {
std::vector<data_kind_t> check_kinds;
if (prb->dir & FLAG_FWD) {
// ACL lnorm does not return mean and variance, so these tests would fail
// even if the normalization layer worked correctly
#if !(DNNL_AARCH64_USE_ACL)
if (!(prb->flags & GLOB_STATS) && !(prb->dir & FLAG_INF)) {
check_kinds.push_back(MEAN);
check_kinds.push_back(VAR);
}
#endif
check_kinds.push_back(DST);
} else {
if (prb->dir & FLAG_WEI) {
Expand Down

0 comments on commit 1cb82ca

Please sign in to comment.