Support input_offset in AVGPOOL and PAVGPOOL micro-kernels
PiperOrigin-RevId: 297706715
diff --git a/src/f32-pavgpool/9x-wasm-c1.c b/src/f32-pavgpool/9x-wasm-c1.c
index ae74924..9ee2026 100644
--- a/src/f32-pavgpool/9x-wasm-c1.c
+++ b/src/f32-pavgpool/9x-wasm-c1.c
@@ -14,6 +14,7 @@
size_t kernel_elements,
size_t channels,
const float** input,
+ size_t input_offset,
const float* zero,
const float* multiplier,
float* output,
@@ -31,6 +32,7 @@
do {
const float* i0 = input[0];
+ assert(i0 != NULL);
const float* i1 = input[1];
const float* i2 = input[2];
const float* i3 = input[3];
@@ -43,27 +45,62 @@
if (kernel_elements < 2) {
i1 = zero;
}
+ assert(i1 != NULL);
if (kernel_elements <= 2) {
i2 = zero;
}
+ assert(i2 != NULL);
if (kernel_elements < 4) {
i3 = zero;
}
+ assert(i3 != NULL);
if (kernel_elements <= 4) {
i4 = zero;
}
+ assert(i4 != NULL);
if (kernel_elements < 6) {
i5 = zero;
}
+ assert(i5 != NULL);
if (kernel_elements <= 6) {
i6 = zero;
}
+ assert(i6 != NULL);
if (kernel_elements < 8) {
i7 = zero;
}
+ assert(i7 != NULL);
if (kernel_elements <= 8) {
i8 = zero;
}
+ assert(i8 != NULL);
+ if XNN_UNPREDICTABLE(i0 != zero) {
+ i0 = (const float*) ((uintptr_t) i0 + input_offset);
+ }
+ if XNN_UNPREDICTABLE(i1 != zero) {
+ i1 = (const float*) ((uintptr_t) i1 + input_offset);
+ }
+ if XNN_UNPREDICTABLE(i2 != zero) {
+ i2 = (const float*) ((uintptr_t) i2 + input_offset);
+ }
+ if XNN_UNPREDICTABLE(i3 != zero) {
+ i3 = (const float*) ((uintptr_t) i3 + input_offset);
+ }
+ if XNN_UNPREDICTABLE(i4 != zero) {
+ i4 = (const float*) ((uintptr_t) i4 + input_offset);
+ }
+ if XNN_UNPREDICTABLE(i5 != zero) {
+ i5 = (const float*) ((uintptr_t) i5 + input_offset);
+ }
+ if XNN_UNPREDICTABLE(i6 != zero) {
+ i6 = (const float*) ((uintptr_t) i6 + input_offset);
+ }
+ if XNN_UNPREDICTABLE(i7 != zero) {
+ i7 = (const float*) ((uintptr_t) i7 + input_offset);
+ }
+ if XNN_UNPREDICTABLE(i8 != zero) {
+ i8 = (const float*) ((uintptr_t) i8 + input_offset);
+ }
const float vmultiplier = *multiplier++;