blob: 58363d04d483eb0426164349728c0fdcd964a0b0 [file] [log] [blame]
// Auto-generated file. Do not edit!
// Template: src/f32-spmm/scalar-pipelined.c.in
// Generator: tools/xngen
//
// Copyright 2019 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 <assert.h>
#include <xnnpack/math.h>
#include <xnnpack/spmm.h>
void xnn_f32_spmm_minmax_ukernel_1x1__scalar_pipelined(
uint32_t batch_size,
uint32_t output_channels,
const float*restrict input,
const float*restrict weights,
const int32_t*restrict widx_dmap,
const uint32_t*restrict nidx_nnzmap,
float*restrict output,
const union xnn_f32_minmax_params params[restrict XNN_MIN_ELEMENTS(1)])
{
assert(batch_size != 0);
const uintptr_t output_stride = batch_size * sizeof(float);
const float vmin = params->scalar.min;
const float vmax = params->scalar.max;
size_t n = batch_size;
while XNN_LIKELY(n >= 1) {
const float*restrict w = weights;
const int32_t* dmap = widx_dmap;
const uint32_t* nnzmap = nidx_nnzmap;
float vw = *w++;
intptr_t diff = *dmap++;
float vi0 = input[0];
size_t c = output_channels;
do {
uint32_t nnz = *nnzmap++;
float vacc0 = vw;
vw = *w++;
if XNN_LIKELY(nnz != 0) {
do {
vacc0 += vi0 * vw;
input = (const float*restrict) ((uintptr_t) input + (uintptr_t) diff);
diff = *dmap++;
vw = *w++;
vi0 = input[0];
} while (--nnz != 0);
}
float vout0 = math_min_f32(vacc0, vmax);
vout0 = math_max_f32(vout0, vmin);
output[0] = vout0;
output = (float*restrict) ((uintptr_t) output + output_stride);
} while (--c != 0);
output -= batch_size * output_channels;
output += 1;
input += 1;
n -= 1;
}
if XNN_UNLIKELY(n != 0) {
}
}