Debian Codegraph @

src/x32-packb/gen/x32-packb-2c2s1r-gemm-scalar-int.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/x32-packb/scalar.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2023 Google LLC
6 //
7 // This source code is licensed under the BSD-style license found in the
8 // LICENSE file in the root directory of this source tree.
9
10 #include <assert.h>
11 #include <stddef.h>
12
13 #include "xnnpack/math.h"
14 #include "xnnpack/packb.h"
15 #include "xnnpack/unaligned.h"
16
17 void xnn_x32_packb_gemm_ukernel_2c2s1r__scalar_int(
18 size_t groups,
19 size_t channels,
20 const uint32_t* bias,
21 uint32_t* packed_weights,
22 size_t channel_tile_stride,
23 size_t channel_subtile_stride,
24 const struct xnn_x32_packb_params params[restrict XNN_MIN_ELEMENTS(1)])
25 {
26 assert(groups != 0);
27 assert(channels != 0);
28 assert(packed_weights != NULL);
29
30 uint32_t* w = (uint32_t*) packed_weights;
31 const uint32_t* b = (const uint32_t*) bias;
32 do {
33 // channel tile loop multiple of 2
34 size_t c = channels;
35 for (; c >= 2; c -= 2) {
36 const uint32_t b0 = b[0];
37 const uint32_t b1 = b[1];
38 unaligned_indexed_store_u32(w, 0, b0);
39 unaligned_indexed_store_u32(w, 1, b1);
40 b += 2;
41
42 w = (uint32_t*) ((uintptr_t) w + channel_tile_stride);
43 }
44
45
46 if XNN_UNLIKELY(c != 0) {
47 const uint32_t b0 = b[0];
48 unaligned_indexed_store_u32(w, 0, b0);
49 b += 1;
50 w = (uint32_t*) ((uintptr_t) w + channel_subtile_stride);
51 }
52 } while (--groups != 0);
53 }