Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulSundarMCW committed Nov 5, 2024
1 parent ab42c5a commit cbdc5f8
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 69 deletions.
3 changes: 0 additions & 3 deletions scripts/generate-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,6 @@ tools/generate-raddstoreexpminusmax-test.py --spec test/f32-raddstoreexpminusmax
### Tests for VScaleExtExp micro-kernels
tools/generate-vscaleextexp-test.py --spec test/f32-vscaleextexp.yaml --output test/f32-vscaleextexp.cc &

### Tests for VScaleExpMinusMax micro-kernels
tools/generate-vscaleexpminusmax-test.py --tester VScaleExpMinusMaxMicrokernelTester --ukernel f32-vscaleexpminusmax --output test/f32-vscaleexpminusmax.cc &

### Tests for VMulCAddC micro-kernels
tools/generate-vmulcaddc-test.py --spec test/f16-vmulcaddc-minmax.yaml --output test/f16-vmulcaddc-minmax.cc &
tools/generate-vmulcaddc-test.py --spec test/f32-vmulcaddc-minmax.yaml --output test/f32-vmulcaddc-minmax.cc &
Expand Down
48 changes: 24 additions & 24 deletions src/f32-vscaleexpminusmax/f32-vscaleexpminusmax.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,33 @@
#endif

#if XNN_ARCH_X86 || XNN_ARCH_X86_64
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u8, 8, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u16, 16, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u24, 24, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u32, 32, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u40, 40, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u48, 48, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u56, 56, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u64, 64, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u72, 72, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u80, 80, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u88, 88, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u96, 96, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u8, 8, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u16, 16, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u24, 24, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u32, 32, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u40, 40, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u48, 48, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u56, 56, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u64, 64, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u72, 72, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u80, 80, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u88, 88, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx2, xnn_f32_vscaleexpminusmax_ukernel__avx2_p5_u96, 96, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
#endif

#if XNN_ENABLE_AVX512F && (XNN_ARCH_X86 || XNN_ARCH_X86_64)
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u16, 16, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u32, 32, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u48, 48, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u64, 64, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u80, 80, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u96, 96, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u112, 112, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u128, 128, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u144, 144, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u160, 160, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u176, 176, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u192, 192, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn) NULL))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u16, 16, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u32, 32, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u48, 48, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u64, 64, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u80, 80, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u96, 96, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u112, 112, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u128, 128, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u144, 144, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u160, 160, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u176, 176, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
XNN_UKERNEL_WITH_PARAMS(xnn_arch_x86_avx512f, xnn_f32_vscaleexpminusmax_ukernel__avx512f_p5_scalef_u192, 192, float, struct xnn_f32_default_params, ((xnn_f32_vscaleexpminusmax_ukernel_fn)))
#endif

#ifdef XNN_DEFINED_UKERNEL_WITH_PARAMS
Expand Down
48 changes: 43 additions & 5 deletions test/f32-vscaleexpminusmax.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// 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: f32-vscaleexpminusmax
// Generator: tools/generate-vscaleexpminusmax-test.py

Expand All @@ -13,10 +12,49 @@
#include "xnnpack/isa-checks.h"
#include "xnnpack/vscaleexpminusmax.h"
#include "vscaleexpminusmax-microkernel-tester.h"


#define XNN_TEST_VSCALEEXPMINUSMAX_ELEMENT_EQ(ukernel, arch_flags, element_tile, ...) \
TEST(ukernel, element_eq) \
{ \
VScaleExpMinusMaxMicrokernelTester().elements(element_tile).Test(ukernel); \
}
#define XNN_TEST_VSCALEEXPMINUSMAX_ELEMENT_GT(ukernel, arch_flags, element_tile, ...) \
TEST(ukernel, element_gt) \
{ \
for (size_t element_size = element_tile + 1; element_size < ((element_tile == 1) ? 10 : element_tile * 2); \
element_size++) { \
VScaleExpMinusMaxMicrokernelTester().elements(element_size).Test(ukernel); \
} \
}
#define XNN_TEST_VSCALEEXPMINUSMAX_ELEMENT_LT(ukernel, arch_flags, element_tile, ...) \
TEST(ukernel, element_lt) \
{ \
for (size_t element_size = 1; element_size < element_tile; element_size++) { \
VScaleExpMinusMaxMicrokernelTester().elements(element_size).Test(ukernel); \
} \
}
#define XNN_TEST_VSCALEEXPMINUSMAX_ELEMENT_DIV(ukernel, arch_flags, element_tile, ...) \
TEST(ukernel, element_div) \
{ \
for (size_t element_size = 2 * element_tile; element_size < 10 * element_tile; element_size += element_tile) { \
VScaleExpMinusMaxMicrokernelTester().elements(element_size).Test(ukernel); \
} \
}

#define XNN_TEST_VSCALEEXPMINUSMAX_SCALE(ukernel, arch_flags, element_tile, ...) \
TEST(ukernel, scale) \
{ \
for (size_t element_size = 1; element_size <= 5 * element_tile; element_size += max(1, element_tile - 1)) { \
VScaleExpMinusMaxMicrokernelTester().elements(element_size).scale(0.01f).Test(ukernel); \
VScaleExpMinusMaxMicrokernelTester().elements(element_size).scale(100.0f).Test(ukernel); \
} \
}

#define XNN_UKERNEL_WITH_PARAMS(arch_flags, ukernel, element_tile, datatype, params_type, init_params) XNN_TEST_VSCALEEXPMINUSMAX_ELEMENT_EQ(ukernel,arch_flags, element_tile, init_params); \
XNN_TEST_VSCALEEXPMINUSMAX_ELEMENT_DIV(ukernel,arch_flags, element_tile, init_params); \
XNN_TEST_VSCALEEXPMINUSMAX_ELEMENT_LT(ukernel,arch_flags, element_tile, init_params); \
XNN_TEST_VSCALEEXPMINUSMAX_ELEMENT_GT(ukernel,arch_flags, element_tile, init_params); \
XNN_TEST_VSCALEEXPMINUSMAX_SCALE(ukernel,arch_flags, element_tile, init_params);
XNN_TEST_VSCALEEXPMINUSMAX_ELEMENT_DIV(ukernel,arch_flags, element_tile, init_params); \
XNN_TEST_VSCALEEXPMINUSMAX_ELEMENT_LT(ukernel,arch_flags, element_tile, init_params); \
XNN_TEST_VSCALEEXPMINUSMAX_ELEMENT_GT(ukernel,arch_flags, element_tile, init_params); \
XNN_TEST_VSCALEEXPMINUSMAX_SCALE(ukernel,arch_flags, element_tile, init_params);
#include "f32-vscaleexpminusmax/f32-vscaleexpminusmax.h"
#undef XNN_UKERNEL_WITH_PARAMS
37 changes: 0 additions & 37 deletions test/vscaleexpminusmax-microkernel-tester.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,40 +90,3 @@ class VScaleExpMinusMaxMicrokernelTester {
float scale_{1.0f};
size_t iterations_{15};
};

#define XNN_TEST_VSCALEEXPMINUSMAX_ELEMENT_EQ(ukernel, arch_flags, element_tile, ...) \
TEST(ukernel, element_eq) \
{ \
VScaleExpMinusMaxMicrokernelTester().elements(element_tile).Test(ukernel); \
}
#define XNN_TEST_VSCALEEXPMINUSMAX_ELEMENT_GT(ukernel, arch_flags, element_tile, ...) \
TEST(ukernel, element_gt) \
{ \
for (size_t element_size = element_tile + 1; element_size < ((element_tile == 1) ? 10 : element_tile * 2); \
element_size++) { \
VScaleExpMinusMaxMicrokernelTester().elements(element_size).Test(ukernel); \
} \
}
#define XNN_TEST_VSCALEEXPMINUSMAX_ELEMENT_LT(ukernel, arch_flags, element_tile, ...) \
TEST(ukernel, element_lt) \
{ \
for (size_t element_size = 1; element_size < element_tile; element_size++) { \
VScaleExpMinusMaxMicrokernelTester().elements(element_size).Test(ukernel); \
} \
}
#define XNN_TEST_VSCALEEXPMINUSMAX_ELEMENT_DIV(ukernel, arch_flags, element_tile, ...) \
TEST(ukernel, element_div) \
{ \
for (size_t element_size = 2 * element_tile; element_size < 10 * element_tile; element_size += element_tile) { \
VScaleExpMinusMaxMicrokernelTester().elements(element_size).Test(ukernel); \
} \
}

#define XNN_TEST_VSCALEEXPMINUSMAX_SCALE(ukernel, arch_flags, element_tile, ...) \
TEST(ukernel, scale) \
{ \
for (size_t element_size = 1; element_size <= 5 * element_tile; element_size += max(1, element_tile - 1)) { \
VScaleExpMinusMaxMicrokernelTester().elements(element_size).scale(0.01f).Test(ukernel); \
VScaleExpMinusMaxMicrokernelTester().elements(element_size).scale(100.0f).Test(ukernel); \
} \
}

0 comments on commit cbdc5f8

Please sign in to comment.