1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 * All rights reserved.
4 * This source code is licensed under the BSD-style license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7#include <iostream>
8#include "./GenerateKernel.h"
9
10namespace fbgemm {
11
12namespace x86 = asmjit::x86;
13
14/**
15 * Get or Create the AVX512 instructions for 16-bit Accumulation macro-kernel.
16 *
17 */
18template <>
19template <>
20CodeGenBase<uint8_t, int8_t, int32_t, int16_t>::jit_micro_kernel_fp
21CodeGenBase<uint8_t, int8_t, int32_t, int16_t>::getOrCreate<
22 inst_set_t::avx512_vnni>(bool accum, int32_t mc, int32_t nc, int32_t kc) {
23 assert(0 && "Accumulation to int16_t is not available for VNNI!");
24
25 // For AVX512VNNI, redirect to int32_t accumulation.
26 CodeGenBase<uint8_t, int8_t, int32_t, int32_t> codeObj;
27 return codeObj.getOrCreate<inst_set_t::avx512_vnni>(accum, mc, nc, kc);
28}
29
30/**
31 * Get or Create the AVX512 instructions for 16-bit Accumulation macro-kernel.
32 *
33 */
34template <>
35template <>
36CodeGenBase<uint8_t, int8_t, int32_t, int16_t>::jit_micro_kernel_fp
37CodeGenBase<uint8_t, int8_t, int32_t, int16_t>::getOrCreate<
38 inst_set_t::avx512_vnni_ymm>(
39 bool accum,
40 int32_t mc,
41 int32_t nc,
42 int32_t kc) {
43 assert(0 && "Accumulation to int16_t is not available for VNNI!");
44
45 // For AVX512VNNI, redirect to int32_t accumulation.
46 CodeGenBase<uint8_t, int8_t, int32_t, int32_t> codeObj;
47 return codeObj.getOrCreate<inst_set_t::avx512_vnni_ymm>(accum, mc, nc, kc);
48}
49
50} // namespace fbgemm
51