This repository has been archived on 2026-11-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
radiance-sycl/core/gen/shape_driver.cpp
T
Deadcode 769b4c64a6 radiance 1.16.0
New models:
- Hunyuan3D-2 (hunyuan3d2): an untextured 3-D mesh from one picture of an object. DINOv2-giant
  over the picture, a FLUX-shaped flow-matching DiT (16 double-stream and 32 single-stream blocks
  of 1024) over 3072 latents with both guidance branches in one step, and the shape VAE's
  geometry decoder. Converted from tencent/Hunyuan3D-2's hunyuan3d-dit-v2-0 folder with
  data/recipes/hunyuan3d-2-bf16.recipe (fp16 cast to bf16, 4.4 GiB, one card). The licence
  (Tencent Hunyuan 3D 2.0 Community License) does not cover the EU, the UK or South Korea
- Served on Hunyuan3D-2's own API server routes, so its Blender add-on and scripts work
  unchanged: POST /generate answers with the mesh, POST /send runs it in the background and
  GET /status/{uid} reports steps_done and then the file. GLB, OBJ, PLY or STL; the field is
  sampled coarse to fine as FlashVDM's hierarchical decoding does, or densely with
  "volume_decoding": "dense"; seed, steps, guidance and octree_resolution as the reference.
  Texturing (Hunyuan3D-Paint) is refused for now (docs/GUIDE.md §5.17)

Merged:
- libr3d rewritten for RDNA3's wave matrix (@RikshaDriver): bf16, f16, int8-activation and vocab
  GEMMs retiled to 16x128 blocks with a double-buffered k-walk; fp8, mxfp4a8, w2a8, w4a16, w5a16
  and w8a8 quantised GEMMs and the gated form; grouped MoE GEMMs (bf16, fp8a8f32, mxfp4a8); the
  norms and quantisers, the QSA state ops and the MoE router, scatter and gather. Brought onto the
  op contract before release (13 schemas, the MoE GEMMs on weight tables with a_order and bf16
  output, moe_gather's gate pitch, moe_scatter above 1024 slots, the mxfp4 m16 dispatch) and its
  gated-delta-net kernels replaced by libhalo's; every op it serves now passes rad-kbench against
  libref on a gfx1151, and r3d_selftest checks its MoE GEMMs by value
- Gemma 4 31B: asymmetric int5 linears (w5a8i8 above 64 rows, w5a16 up to 64, a scale per 128),
  the norm, GELU and two-rank all-reduce junctions at quant_act_i8g's grid (rmsnorm_quant_i8g,
  gelu_mul_quant_i8g, ar_rmsnorm_quant_i8g) so the prefill overlap runs on the i8a8, a4 and w5
  trunks, and compose files for the 31B i8g, heretic-ara-i8g and w5 on two cards (@keptn42)
- The norms' lane sum reads eight at a time: TranslateGemma 27B decode is back from 225 to 239
  tok/s a stream at four streams, bit for bit the same output (@mici81)
- The head-256 prefill softmax rescales each row by its own maximum, not by a vote of the wave, so
  a row's rounding no longer depends on which rows share its launch (@gostar)

Anthropic Messages API:
- /v1/messages takes min_p, presence_penalty, frequency_penalty, repetition_penalty and
  repeat_last_n as top-level fields with the chat path's names, ranges and meaning, so clients that
  speak only the Anthropic format (Claude Code) can set a model card's sampling, such as Qwen's
  presence_penalty 1.5. The penalties count the last repeat_last_n tokens of prompt and reply (64
  by default, --repeat-last-n), as llama.cpp does

Plugin ABI 33:
- Shape generators: rad_declare_shape_generator, RadShapeGenBatch (RadBatch::sgen_b) and
  RadArchProbe::gen_shape, with the SCOND, SSTEP, SLATENT and SQUERY passes. The layout
  fingerprint table is regenerated; out-of-tree plugins rebuild against 33
- New op point_fourier ([x | sin(x 2^j) | cos(x 2^j)], times pi on request) in libref, libavx,
  libr4d and libhalo
- A checkpoint for a model that reads no text gets a one-token vocabulary

More cards from the one image:
- stilldeadcode/radiance now carries libr3d (RDNA3: gfx11-generic, every gfx11 chip) and libhalo
  (Strix Halo: gfx1151, preferred there over libr3d) beside libr4d (gfx1201). docker/build.sh and
  the Dockerfile default to gfx1201;gfx11-generic;gfx1151
- libr3d loads only where the KFD topology lists a gfx11 card and libhalo only where it lists a
  gfx1151; a process without /dev/kfd sees neither. On an RDNA4 card, or with no card at all,
  the image therefore behaves exactly as before, and rad-convert lays weights out as before
- libhalo and libr3d now declare gemm_nt_q's w_rb, and libhalo gram_accum's upper, as libr4d
  does. Before, any build carrying them refused both at load ("9 parameters vs 8"), so a build
  for Strix Halo or RDNA3 had no device kernel library
- libhalo does not yet have every op libr4d added after it was ported (the IQR rows, Pixtral and
  Ministral rope, the tree-attention and DFlash-tree rows, among others); halo_parity lists them
  and is left out of the image's test stage until they are ported

Fixed -- container and checkpoint parsing:
- A .rad expert-1 entry inside or before expert 0 is refused; a vocab section whose count names
  an array at offset 0 is refused rather than read from the file header; offset checks no longer
  wrap; header tables must sit on their element alignment
- An imatrix array of arrays (unbounded recursion) and a safetensors header naming a tensor twice
  are refused; a failed RadWriter undo says the container is damaged; a tune cache measured on
  another machine is refused, as its format contract says

Fixed -- plugins:
- Two plugins declaring one op with different parameter roles are refused; before, the core
  applied the first one's chunk/capacity roles to the other's rows
- Null tables behind nonzero counts, unknown roles, keyless parameters or constraints and more
  operands than an issue carries are refused by name at load; on the host backend device rows are
  dropped even when no fat binary was registered; rad-schemas checks the ABI layout fingerprint as
  the engine does

Fixed -- device:
- Stream slots are recycled under a new generation: before, 1024 stream create/destroy cycles
  (LoRA loads, lanes, uplinks) made every later rad_stream_create fail
- A stream whose drain fails keeps its queue and kernarg ring instead of freeing them under the
  card; the kernarg ring no longer leaks when its access grant fails; a block over 1024 work-items
  is refused
- rad_dev_free takes the allocation off the ledger the pin-cap check reads; the host backend
  charges pages to the card the range was reserved for

Fixed -- engine and server:
- Two NDEBUG-only asserts (runtime-window totals, ring blocks per group) are refusals; a
  plugin-declared lcm past int64 saturates so the quantum check refuses it; every share view rect
  and part span is bounded by its entry
- Video: the timestep regions hold the refine rungs a schedule appends, a zero-frame encode is
  refused, /v1/videos bounds each side before the area product, and a realtime session needs a
  clip length to cut a turn at

Fixed -- kernels and quantisation:
- A trellis run shorter than a state's codes (tcq_rows=1, or N % tcq_rows == 1) read its seam
  out of bounds; the encoder now refuses it as the decoder does, and tcq_rows below one state is
  refused at parse
- qsa_tail_store bounds its slot index by the state plane (libr4d and libhalo); paged attention
  refuses kv_heads <= 0; libavx row_amax skips a NaN as libref does

Fixed -- tools:
- pad_tp.py no longer runs cp through a shell with shard names from the checkpoint's index
  (quote injection, path traversal): names must be bare file names
- ops_doc_check.sh runs under mawk (Ubuntu's awk); rad-kbench --max-cases/--max-bytes are checked
  integers; oot_plugins fails unless the installed replay passed a case and failed none

Thanks to @RikshaDriver, @keptn42, @mici81 and @gostar.
2026-11-02 18:35:02 +01:00

437 lines
16 KiB
C++

/* shape_driver.cpp -- the shape generator's pass driver (shape_driver.h). */
#include "shape_driver.h"
#include "rad_internal.h"
#include <algorithm>
#include <cmath>
#include <cstring>
namespace rad {
namespace gen {
namespace {
constexpr int64_t kAlign = 256;
/* Region offsets and sizes, in the enum's order (shape_driver.h), and the total; shared by the
* allocation and the VRAM budget. */
int64_t carve(const RadShapeGenDecl& d, int64_t (*bytes)[2], int n) {
const int64_t side = d.enc_size / d.enc_patch;
const int64_t want[] = {
side * side * 3 * d.enc_patch * d.enc_patch * 4, /* R_PATCH: f32 */
2 * 4, /* R_SIGMA */
2 * 4, /* R_SNEXT */
2 * 4, /* R_CFG */
2 * 4, /* R_PAIR */
2 * 4, /* R_LANES */
2 * 4, /* R_FLAGS */
2 * 2 * 4, /* R_SEED */
3 * 4, /* R_LATCU */
d.max_query * 3 * 4, /* R_QUERY: f32 */
2 * 4, /* R_QCU */
};
int64_t off = 0;
for (int r = 0; r < n; ++r) {
bytes[r][0] = off;
bytes[r][1] = want[r];
off = align_up(off + want[r], kAlign);
}
return off;
}
} /* namespace */
int64_t ShapeDriver::device_bytes(const Program& prog) {
if (!prog.is_shape_generator()) return 0;
int64_t b[R_N][2];
return carve(prog.shape_gen, b, R_N);
}
int ShapeDriver::init(const Program& prog, const std::vector<RankIO>& ranks) {
fini();
if (!prog.is_shape_generator()) return RAD_E_STATE;
decl_ = prog.shape_gen;
info_ = shape_info(decl_, prog.sgen_name);
ranks_ = ranks;
n_patch_ = (decl_.enc_size / decl_.enc_patch) * (decl_.enc_size / decl_.enc_patch);
patch_dim_ = 3 * decl_.enc_patch * decl_.enc_patch;
int64_t b[R_N][2];
bytes_ = carve(decl_, b, R_N);
for (int r = 0; r < R_N; ++r) {
reg_[r].off = b[r][0];
reg_[r].bytes = b[r][1];
reg_[r].used = 0;
}
host_ = static_cast<char*>(rad_dev_alloc(bytes_, RAD_MEM_HOST_PINNED));
field_host_ = static_cast<float*>(rad_dev_alloc(decl_.max_query * 4, RAD_MEM_HOST_PINNED));
if (!host_ || !field_host_) {
RAD_ERR("shape generator: no pinned host memory for the pass staging and the field "
"(%lld + %lld bytes)", (long long)bytes_, (long long)(decl_.max_query * 4));
return RAD_E_NOMEM;
}
std::memset(host_, 0, (size_t)bytes_);
dev_.assign(ranks_.size(), nullptr);
for (size_t r = 0; r < ranks_.size(); ++r) {
RAD_TRY(rad_dev_set(ranks_[r].device));
dev_[r] = rad_dev_alloc(bytes_, RAD_MEM_DEVICE);
if (!dev_[r]) {
RAD_ERR("shape generator: rank %zu has no room for the pass staging (%lld bytes)", r,
(long long)bytes_);
return RAD_E_NOMEM;
}
}
if (!ranks_.empty()) RAD_TRY(rad_dev_set(ranks_[0].device));
out_.assign(ranks_.size(), RadBatch{});
sout_.assign(ranks_.size(), RadShapeGenBatch{});
free_lanes_.clear();
for (int64_t i = decl_.max_lanes - 1; i >= 0; --i) free_lanes_.push_back((int32_t)i);
return RAD_OK;
}
void ShapeDriver::fini() {
for (size_t r = 0; r < dev_.size(); ++r)
if (dev_[r]) {
if (r < ranks_.size()) rad_dev_set(ranks_[r].device);
rad_dev_free(dev_[r], RAD_MEM_DEVICE);
}
dev_.clear();
if (!ranks_.empty()) rad_dev_set(ranks_[0].device);
if (host_) rad_dev_free(host_, RAD_MEM_HOST_PINNED);
if (field_host_) rad_dev_free(field_host_, RAD_MEM_HOST_PINNED);
host_ = nullptr;
field_host_ = nullptr;
}
/* ================================================================== requests */
int ShapeDriver::submit(std::unique_ptr<ShapeRequest> r, std::string* why) {
if (!r || !r->ticket) return RAD_E_INVAL;
const RadShapeGenDecl& d = decl_;
auto no = [&](const std::string& w) {
if (why) *why = w;
return RAD_E_INVAL;
};
if ((int64_t)r->patches.size() != n_patch_ * patch_dim_)
return no("the picture is not prepared for this model's image encoder");
const int32_t steps = r->steps > 0 ? r->steps : (int32_t)d.default_steps;
if (steps < 2 || steps > d.max_steps)
return no("num_inference_steps must be 2.." + std::to_string(d.max_steps) +
" (sigma grid points, the last one the clean shape)");
const double cfg = std::isnan(r->guidance) ? d.default_guidance : r->guidance;
if (!(cfg >= 0.0) || !std::isfinite(cfg))
return no("guidance_scale must be finite and not negative");
const int32_t res = r->resolution > 0 ? r->resolution : (int32_t)d.default_resolution;
if (res < d.min_resolution || res > d.max_resolution)
return no("octree_resolution must be " + std::to_string(d.min_resolution) + ".." +
std::to_string(d.max_resolution));
auto j = std::make_unique<Job>();
j->sigmas = shape_sigmas(steps);
j->evals = steps - 1;
j->cfg = (float)cfg;
j->levels = r->dense ? std::vector<int32_t>{ res } : shape_levels(res);
ShapeTicket& t = *r->ticket;
t.steps = j->evals;
t.resolution = res;
t.guidance = cfg;
t.t_submit_ns = (int64_t)rad_mono_ns();
std::lock_guard<std::mutex> lk(mu_);
if (closed_) {
if (why) *why = closed_why_;
return closed_status_;
}
j->id = next_id_++;
j->req = std::move(r);
jobs_.push_back(std::move(j));
return RAD_OK;
}
void ShapeDriver::shutdown(const char* why, int status) {
std::lock_guard<std::mutex> lk(mu_);
closed_ = true;
closed_why_ = why ? why : "the engine stopped";
closed_status_ = status;
for (auto& j : jobs_) j->req->ticket->finish(status, closed_why_);
}
int64_t ShapeDriver::queued() const {
std::lock_guard<std::mutex> lk(mu_);
int64_t n = 0;
for (const auto& j : jobs_) if (!j->admitted) ++n;
return n;
}
int64_t ShapeDriver::running() const {
std::lock_guard<std::mutex> lk(mu_);
int64_t n = 0;
for (const auto& j : jobs_) if (j->admitted) ++n;
return n;
}
ShapeDriver::Job* ShapeDriver::job_locked(uint64_t id) {
for (auto& j : jobs_) if (j->id == id) return j.get();
return nullptr;
}
void ShapeDriver::release_locked(Job& j) {
if (j.lane >= 0) {
free_lanes_.push_back(j.lane);
j.lane = -1;
}
}
void ShapeDriver::fail_locked(Job& j, int status, const std::string& why) {
j.failed = true;
j.req->ticket->finish(status, why);
}
/* In arrival order: a request needs only a lane. */
void ShapeDriver::admit_locked() {
for (auto& jp : jobs_) {
Job& j = *jp;
if (j.admitted || j.failed) continue;
if (free_lanes_.empty()) break;
j.lane = free_lanes_.back();
free_lanes_.pop_back();
j.admitted = true;
}
}
/* A level of the grid begins: its field unsampled, its points `pts` (every point when `all`). */
void ShapeDriver::start_level(Job& j, size_t level, std::vector<uint32_t>&& pts, bool all) {
const int32_t r = j.levels[level];
const int64_t n = (int64_t)r + 1;
j.level = level;
j.field.assign((size_t)(n * n * n), NAN);
j.axis = shape_axis(decl_.bounds, r);
j.all = all;
j.pts = std::move(pts);
j.n_pts = all ? n * n * n : (int64_t)j.pts.size();
j.next = 0;
}
/* ================================================================== staging */
int ShapeDriver::upload() {
for (size_t r = 0; r < ranks_.size(); ++r)
for (int g = 0; g < R_N; ++g) {
if (reg_[g].used <= 0) continue;
RAD_TRY(rad_memcpy_async((char*)dev_[r] + reg_[g].off, host_ + reg_[g].off,
reg_[g].used, ranks_[r].stream));
}
return RAD_OK;
}
void ShapeDriver::stage_common(const Job& j) {
const int32_t lanes[2] = { j.lane, j.lane };
const int32_t cu[3] = { 0, (int32_t)decl_.latent_rows, (int32_t)(2 * decl_.latent_rows) };
std::memcpy(hptr<int32_t>(R_LANES), lanes, sizeof lanes);
std::memcpy(hptr<int32_t>(R_LATCU), cu, sizeof cu);
reg_[R_LANES].used = sizeof lanes;
reg_[R_LATCU].used = sizeof cu;
}
void ShapeDriver::base_batches(const Job& j, int64_t n_tok, int kind, int step) {
for (size_t r = 0; r < ranks_.size(); ++r) {
RadBatch& B = out_[r];
RadShapeGenBatch& S = sout_[r];
const int ri = (int)r;
B = RadBatch{};
B.step = step;
B.phase = RAD_PHASE_PREFILL;
B.n_tok = n_tok;
B.n_seq = 1;
B.max_q_len = (int32_t)n_tok;
B.max_q_len_prefill = (int32_t)n_tok;
B.gen = kind;
S = RadShapeGenBatch{};
S.lane = j.lane;
S.patches = dptr<float>(ri, R_PATCH);
S.step = j.step;
S.n_steps = j.evals;
S.sigma = dptr<float>(ri, R_SIGMA);
S.sigma_next = dptr<float>(ri, R_SNEXT);
S.cfg = dptr<float>(ri, R_CFG);
S.pair = dptr<int32_t>(ri, R_PAIR);
S.lanes = dptr<int32_t>(ri, R_LANES);
S.flags = dptr<int32_t>(ri, R_FLAGS);
S.seed = dptr<uint32_t>(ri, R_SEED);
S.lat_cu = dptr<int32_t>(ri, R_LATCU);
S.query = dptr<float>(ri, R_QUERY);
S.query_cu = dptr<int32_t>(ri, R_QCU);
B.sgen_b = &S;
}
pass_.kind = kind;
pass_.job = j.id;
}
/* ================================================================== the passes */
const RadBatch* ShapeDriver::next(int step) {
std::lock_guard<std::mutex> lk(mu_);
pass_ = Pass{};
rb_.clear();
if (closed_) return nullptr;
/* Retire finished, failed and cancelled jobs, returning their lanes before admitting. Safe
* because next() runs between passes, with nothing in flight. */
for (auto it = jobs_.begin(); it != jobs_.end();) {
Job& j = **it;
const bool cancelled = j.req->ticket->cancel.load(std::memory_order_acquire);
if (!(j.failed || cancelled || j.finished)) { ++it; continue; }
if (cancelled && !j.failed && !j.finished)
j.req->ticket->finish(RAD_E_CANCELLED, "the request was cancelled");
release_locked(j);
it = jobs_.erase(it);
}
admit_locked();
/* 1. The decoding of a denoised lane: its latent, then its grid. */
for (auto& jp : jobs_) {
Job& j = *jp;
if (!j.admitted || j.failed || !j.cond_done || j.step < j.evals) continue;
return j.latent_done ? build_query(j, step) : build_latent(j, step);
}
/* 2. A picture. */
for (auto& jp : jobs_) {
Job& j = *jp;
if (j.admitted && !j.failed && !j.cond_done) return build_cond(j, step);
}
/* 3. The oldest lane's next step. */
for (auto& jp : jobs_) {
Job& j = *jp;
if (j.admitted && !j.failed && j.cond_done && j.step < j.evals) return build_step(j, step);
}
return nullptr;
}
const RadBatch* ShapeDriver::batch_for(int rank) const {
if (rank < 0 || (size_t)rank >= out_.size() || pass_.kind == 0) return nullptr;
return &out_[(size_t)rank];
}
const RadBatch* ShapeDriver::build_cond(Job& j, int step) {
for (int g = 0; g < R_N; ++g) reg_[g].used = 0;
std::memcpy(hptr<float>(R_PATCH), j.req->patches.data(), j.req->patches.size() * 4);
reg_[R_PATCH].used = (int64_t)j.req->patches.size() * 4;
stage_common(j);
if (upload() < 0) return nullptr;
base_batches(j, n_patch_, RAD_GEN_PASS_SCOND, step);
return &out_[0];
}
/* The two entries of the step: the picture's latent guided against the unconditioned one, which
* reads the same lane and moves nothing. */
const RadBatch* ShapeDriver::build_step(Job& j, int step) {
for (int g = 0; g < R_N; ++g) reg_[g].used = 0;
const float s = j.sigmas[(size_t)j.step], sn = j.sigmas[(size_t)j.step + 1];
const float sig[2] = { s, s }, nxt[2] = { sn, sn }, cfg[2] = { j.cfg, 1.0f };
const int32_t pair[2] = { 1, -2 };
const int32_t flags[2] = { j.step == 0 ? (int32_t)RAD_GEN_F_FIRST : 0, 0 };
const uint32_t lo = (uint32_t)j.req->seed, hi = (uint32_t)(j.req->seed >> 32);
const uint32_t seed[4] = { lo, hi, lo, hi };
auto stage = [&](int r, const void* p, int64_t n) {
std::memcpy(host_ + reg_[r].off, p, (size_t)n);
reg_[r].used = n;
};
stage(R_SIGMA, sig, sizeof sig);
stage(R_SNEXT, nxt, sizeof nxt);
stage(R_CFG, cfg, sizeof cfg);
stage(R_PAIR, pair, sizeof pair);
stage(R_FLAGS, flags, sizeof flags);
stage(R_SEED, seed, sizeof seed);
stage_common(j);
if (upload() < 0) return nullptr;
base_batches(j, decl_.step_rows, RAD_GEN_PASS_SSTEP, step);
return &out_[0];
}
const RadBatch* ShapeDriver::build_latent(Job& j, int step) {
for (int g = 0; g < R_N; ++g) reg_[g].used = 0;
stage_common(j);
if (upload() < 0) return nullptr;
base_batches(j, decl_.latent_rows, RAD_GEN_PASS_SLATENT, step);
return &out_[0];
}
/* The level's next run of points, at most max_query, as x, y, z. */
const RadBatch* ShapeDriver::build_query(Job& j, int step) {
for (int g = 0; g < R_N; ++g) reg_[g].used = 0;
const int64_t n = std::min<int64_t>(decl_.max_query, j.n_pts - j.next);
const int64_t side = (int64_t)j.levels[j.level] + 1;
float* q = hptr<float>(R_QUERY);
for (int64_t i = 0; i < n; ++i) {
const int64_t p = j.all ? j.next + i : (int64_t)j.pts[(size_t)(j.next + i)];
q[3 * i] = j.axis[(size_t)(p / (side * side))];
q[3 * i + 1] = j.axis[(size_t)(p / side % side)];
q[3 * i + 2] = j.axis[(size_t)(p % side)];
}
reg_[R_QUERY].used = n * 3 * 4;
const int32_t qcu[2] = { 0, (int32_t)n };
std::memcpy(hptr<int32_t>(R_QCU), qcu, sizeof qcu);
reg_[R_QCU].used = sizeof qcu;
stage_common(j);
if (upload() < 0) return nullptr;
base_batches(j, n, RAD_GEN_PASS_SQUERY, step);
for (auto& S : sout_) S.n_query = n;
pass_.n_query = n;
rb_.assign(1, Readback{ decl_.field_out, n * 4, field_host_ });
return &out_[0];
}
int ShapeDriver::done() {
std::lock_guard<std::mutex> lk(mu_);
const int64_t now = (int64_t)rad_mono_ns();
Job* j = job_locked(pass_.job);
switch (j ? pass_.kind : 0) {
case RAD_GEN_PASS_SCOND:
j->cond_done = true;
j->req->ticket->t_cond_ns = now;
/* The patches are on the card for good; the request keeps no copy. */
std::vector<float>().swap(j->req->patches);
break;
case RAD_GEN_PASS_SSTEP:
++j->step;
j->req->ticket->progress(j->step, 0);
if (j->step >= j->evals) j->req->ticket->t_denoised_ns = now;
break;
case RAD_GEN_PASS_SLATENT:
j->latent_done = true;
start_level(*j, 0, {}, true);
break;
case RAD_GEN_PASS_SQUERY: {
const int64_t n = pass_.n_query;
for (int64_t i = 0; i < n; ++i) {
const int64_t p = j->all ? j->next + i : (int64_t)j->pts[(size_t)(j->next + i)];
j->field[(size_t)p] = field_host_[i];
}
j->next += n;
j->points += n;
j->req->ticket->progress(j->step, (int32_t)std::min<int64_t>(j->points, INT32_MAX));
if (j->next < j->n_pts) break;
/* The level is complete: the next one's points, or the end (also when no point of this
* level is near the surface, which leaves the finer levels nothing to sample). */
if (j->level + 1 < j->levels.size()) {
const int32_t rp = j->levels[j->level], r = j->levels[j->level + 1];
const bool last = j->level + 2 == j->levels.size();
std::vector<uint32_t> pts = shape_refine(j->field, rp, r, decl_.level, last);
if (!pts.empty()) {
start_level(*j, j->level + 1, std::move(pts), false);
break;
}
}
ShapeTicket& t = *j->req->ticket;
t.points = j->points;
t.t_done_ns = now;
t.set_field(std::move(j->field), j->levels[j->level]);
j->finished = true;
t.finish(RAD_OK);
break;
}
default:
break;
}
pass_ = Pass{};
rb_.clear();
return RAD_OK;
}
} /* namespace gen */
} /* namespace rad */