PERF-2 P3 bench: the coarsest level uses the CPU's red-black symmetric ordering (a nearly singular coarsest system settles on a smoother-dependent constant, which the prolongation doubled up every level: the 19 % disagreement)
CI / CI Success (push) Blocked by required conditions
CI / Build (macos-latest) (push) Waiting to run
CI / Test (macos-latest) (push) Blocked by required conditions
CI / Test (ubuntu-latest) (push) Blocked by required conditions
CI / Python Bindings (maturin) (macos-latest) (push) Blocked by required conditions
CI / Python Bindings (maturin) (ubuntu-latest) (push) Blocked by required conditions
CI / WASM Build + Size Check (push) Blocked by required conditions
CI / Distributed Training Tests (push) Blocked by required conditions
CI / Format Check (push) Failing after 5s
CI / Build (ubuntu-latest) (push) Failing after 6s
CI / Clippy Check (push) Failing after 7s
Documentation / Build User Guide (push) Successful in 6s
Performance Benchmarks / Run Benchmarks (push) Failing after 14s
Documentation / Build API Documentation (push) Failing after 30s
CI / Build CPU-Only (Explicit) (push) Failing after 1m31s

This commit is contained in:
Omar Sobh
2026-09-16 01:10:12 -05:00
parent 06a60b5fed
commit 3b7f8fb362
2 changed files with 16 additions and 6 deletions
@@ -78,9 +78,13 @@ extern "C" __global__ void mg_zero(int n_cells, const unsigned int* __restrict__
x[(size_t)blockIdx.y * n + cells[t]] = 0.0f; x[(size_t)blockIdx.y * n + cells[t]] = 0.0f;
} }
/* The coarsest level: one thread per march, `sweeps` symmetric lexicographic sweeps over <= a few dozen cells. */ /* The coarsest level: one thread per march, `sweeps` symmetric RED-BLACK
* sweeps (red, black, black, red — the CPU's ordering, so a nearly singular
* coarsest system settles on the same constant) from zero. */
extern "C" __global__ void mg_coarsest( extern "C" __global__ void mg_coarsest(
int K, int n_cells, const unsigned int* __restrict__ cells, int n, int K, int n_cells, const unsigned int* __restrict__ cells,
int n_red, const unsigned int* __restrict__ red,
int n_black, const unsigned int* __restrict__ black, int n,
const float* __restrict__ ae, const float* __restrict__ aw, const float* __restrict__ ae, const float* __restrict__ aw,
const float* __restrict__ an, const float* __restrict__ as_, const float* __restrict__ an, const float* __restrict__ as_,
const float* __restrict__ ap, const float* __restrict__ b, const float* __restrict__ ap, const float* __restrict__ b,
@@ -91,10 +95,11 @@ extern "C" __global__ void mg_coarsest(
int base = k * n; int base = k * n;
for (int t = 0; t < n_cells; ++t) x[base + cells[t]] = 0.0f; for (int t = 0; t < n_cells; ++t) x[base + cells[t]] = 0.0f;
for (int sw = 0; sw < sweeps; ++sw) { for (int sw = 0; sw < sweeps; ++sw) {
for (int pass = 0; pass < 2; ++pass) { for (int half = 0; half < 4; ++half) {
for (int q = 0; q < n_cells; ++q) { const unsigned int* list = (half == 0 || half == 3) ? red : black;
int t = pass == 0 ? q : n_cells - 1 - q; int n_list = (half == 0 || half == 3) ? n_red : n_black;
int g = base + cells[t]; for (int t = 0; t < n_list; ++t) {
int g = base + list[t];
float s = 0.0f; float s = 0.0f;
float e = ae[g]; if (e != 0.0f) s += e * x[g + 1]; float e = ae[g]; if (e != 0.0f) s += e * x[g + 1];
float w = aw[g]; if (w != 0.0f) s += w * x[g - 1]; float w = aw[g]; if (w != 0.0f) s += w * x[g - 1];
@@ -292,12 +292,17 @@ fn batched_device_vcycle_go_no_go() {
{ {
let lv = &mut dev[depth - 1]; let lv = &mut dev[depth - 1];
let (k_i, n_cells_i, n_i, sw_i) = (k as i32, lv.n_cells as i32, lv.n as i32, 50i32); let (k_i, n_cells_i, n_i, sw_i) = (k as i32, lv.n_cells as i32, lv.n as i32, 50i32);
let (n_red_i, n_black_i) = (lv.n_red as i32, lv.n_black as i32);
unsafe { unsafe {
stream stream
.launch_builder(&f_coarsest) .launch_builder(&f_coarsest)
.arg(&k_i) .arg(&k_i)
.arg(&n_cells_i) .arg(&n_cells_i)
.arg(&lv.cells) .arg(&lv.cells)
.arg(&n_red_i)
.arg(&lv.red)
.arg(&n_black_i)
.arg(&lv.black)
.arg(&n_i) .arg(&n_i)
.arg(&lv.ae) .arg(&lv.ae)
.arg(&lv.aw) .arg(&lv.aw)