Archived
PIN ref2va: verified device differential + ref-count gate (revert anchor)
Ref2VA ref-image conditioning verified on-device: ref step runs all steps no fault; output differs ref-present vs ref-absent (by log). 6-9 images rejected cleanly at submit (no engine crash). Merged-cell modulation (<=9) tracked next. NOTE: placeholder author -- re-author before any push. Do NOT push this branch. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
816e24bd46
commit
490d4c604a
73 files changed
+16484
-432
No files matched your search
@@ -555,6 +555,37 @@ AVX_KERNEL(pool_rows) {
|
||||
return RAD_OK;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ pool_cols */
|
||||
/* As libref: the mean of every k consecutive columns of each row, summed in f32 and rounded to
|
||||
* y's dtype, then the multiplier and a second rounding (the unfused pair). pool_rows' dual.
|
||||
* Parallel over rows. */
|
||||
AVX_KERNEL(pool_cols) {
|
||||
if (!rad_args_have(a, 2)) return RAD_E_INVAL;
|
||||
const RadTensor *X = &a->t[0], *Y = &a->t[1];
|
||||
const int64_t n = p_int(a, "n", 0), k = p_int(a, "k", 0);
|
||||
const float mult = p_f32(a, "mult", 1.0f);
|
||||
if (n <= 0 || k <= 0 || n % k) return RAD_E_SHAPE;
|
||||
const int64_t M = rows_of(X, n), nw = n / k;
|
||||
if (M <= 0 || numel(Y) < M * nw) return RAD_E_SHAPE;
|
||||
const float inv = 1.0f / (float)k;
|
||||
|
||||
AVX_PARALLEL_FOR_IF(M * nw * k >= AVX_PAR_MIN)
|
||||
for (int64_t r = 0; r < M; ++r) {
|
||||
float* acc = scratch_f32((size_t)nw);
|
||||
float* sx = scratch_f32_b((size_t)n);
|
||||
const float* v = in_row(X, rowoff(X, r, n), n, sx);
|
||||
for (int64_t c = 0; c < nw; ++c) {
|
||||
float s = 0.0f;
|
||||
for (int64_t j = 0; j < k; ++j) s += v[c * k + j];
|
||||
acc[c] = s * inv;
|
||||
}
|
||||
roundtrip(Y->dtype, acc, nw, sx);
|
||||
for (int64_t c = 0; c < nw; ++c) acc[c] *= mult;
|
||||
out_row(Y, rowoff(Y, r, nw), nw, acc);
|
||||
}
|
||||
return RAD_OK;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ scale_rows */
|
||||
/* y[m, i] = x[m, i] * act(s[m]), plus add[m, i] when the optional residual is passed.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user