Archived
ops: the tiled encode ops take their row count from the operands, not from M
The engine never hands a kernel the issued value of a ranged parameter: the oracle binds it to the matched band's bound, and ref_common.h's band_rows spells the rule out -- the parameter stays a ceiling where one is stated -- which is why every existing kernel derives its counts from its operands. vtile_plan/crop/join were the first to read M as the row count of the call, so the first real tiled encode refused on device: a 512 keyframe's 3 x 3 plan, issued under the band bound 33, tripped the wrapper's rows-of-y < M clause, which answered RAD_E_STRIDE -- and the strerror insisted, wrongly, that a non-contiguous operand was the problem. Crop and join carried the same latent bug: crop would have launched 33 blocks over a ~590k-row cut, and both would have refused every canvas under their bands' real bounds. All three tiers now count from the operands and treat the passed M as the ceiling it is -- y longer than the ceiling is refused, equality never demanded. The reference and host tiers take the count from geom through band_rows; the device wrappers take it from y's rows and pass that count in the kernel's M slot, which the kernels' own operand-row guards make safe. OPS.md says the rule once at the head of the tiled encoder section: an M written in a shape is an operand's row count, the ranged M argument a ceiling only. The host gates missed the bug precisely because they drove an exact M. ref_test's three vtile cases now pass the band's bound -- 33, 33 * 256 * 256, 320 * 320 -- and demand the same exact output, plus short-operand cases that must refuse E_SHAPE under the over-declared ceiling; r4d_selftest drives the same bounds on device. Verified: ref_test 264 cases, device vtile plan 4 / crop 8 / join 5 / gather 2 / stitch 8 all exact, full ctest 123/123; and the FL2VA render that used to die in tiled encode now runs its 25 steps with both keyframes visible in the decoded clip. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
fe311c5c80
commit
c463a0ab1b
6 files changed
+98
-40
No files matched your search
@@ -7537,9 +7537,11 @@ void vtile_plan_cases(const Plugin& pl) {
|
||||
void* dy = dalloc((size_t)(M * 22) * 4);
|
||||
const std::string nm = fmt("vtile_plan %lld x %lld in %lld x %lld tiles", (long long)H,
|
||||
(long long)W, (long long)nh, (long long)nw);
|
||||
/* M rides the band's bound (m.tiles), as the engine binds it -- never this call's tile
|
||||
* count; the tile count comes from geom and y's rows. */
|
||||
const int rc = launch(r, { TI32({ 3 }, { 1, (int32_t)H, (int32_t)W }),
|
||||
T(dy, RAD_I32, { M, 22 }) },
|
||||
{ PI("M", M), PI("tile", 16), PI("overlap", 4), PI("ratio", 16) });
|
||||
{ PI("M", 33), PI("tile", 16), PI("overlap", 4), PI("ratio", 16) });
|
||||
if (rc != RAD_OK) { ok(nm.c_str(), false, "rc " + std::to_string(rc)); continue; }
|
||||
std::vector<int32_t> want((size_t)(M * 22));
|
||||
for (int64_t i = 0; i < nh; ++i)
|
||||
@@ -7594,9 +7596,10 @@ void vtile_crop_cases(const Plugin& pl) {
|
||||
void* dy = dalloc((size_t)(M * 3) * (bf ? 2 : 4));
|
||||
const std::string nm = fmt("vtile_crop %lld x %lld %s tile %lld", (long long)H,
|
||||
(long long)W, bf ? "bf16" : "f32", (long long)tile);
|
||||
/* M rides the band's bound, as the engine binds it; the cut's rows come from y. */
|
||||
const int rc = launch(r, { T(dx, dt, { H * W, 3 }), TI32({ 3 }, { 1, (int32_t)H, (int32_t)W }),
|
||||
T(dy, dt, { M, 3 }) },
|
||||
{ PI("M", M), PI("tile", tile), PI("overlap", ov),
|
||||
{ PI("M", 33 * 256 * 256), PI("tile", tile), PI("overlap", ov),
|
||||
PI("ratio", ratio), PS("dtype", bf ? "bf16" : "f32") });
|
||||
if (rc != RAD_OK) { ok(nm.c_str(), false, "rc " + std::to_string(rc)); continue; }
|
||||
std::vector<float> want((size_t)(M * 3));
|
||||
@@ -7638,9 +7641,10 @@ void vtile_join_cases(const Plugin& pl) {
|
||||
void* dy = dalloc((size_t)(M * n) * 2);
|
||||
const std::string nm = fmt("vtile_join %lld x %lld bf16 tile %lld", (long long)H,
|
||||
(long long)W, (long long)tile);
|
||||
/* M rides the band's bound, as the engine binds it; the canvas rows come from y. */
|
||||
const int rc = launch(r, { T(dx, RAD_BF16, { Sm, n }), TI32({ 3 }, { 1, (int32_t)H, (int32_t)W }),
|
||||
T(dy, RAD_BF16, { M, n }) },
|
||||
{ PI("M", M), PI("tile", tile), PI("overlap", ov), PI("n", n),
|
||||
{ PI("M", 320 * 320), PI("tile", tile), PI("overlap", ov), PI("n", n),
|
||||
PS("dtype", "bf16") });
|
||||
if (rc != RAD_OK) { ok(nm.c_str(), false, "rc " + std::to_string(rc)); continue; }
|
||||
/* The blends round to bf16 at every step, as the kernel's rdv does. */
|
||||
@@ -7686,7 +7690,7 @@ void vtile_join_cases(const Plugin& pl) {
|
||||
const int rc = launch(r, { T(dx, RAD_F32, { 9 * tile * tile, n }),
|
||||
TI32({ 3 }, { 1, (int32_t)H, (int32_t)W }),
|
||||
T(dy, RAD_F32, { H * W, n }) },
|
||||
{ PI("M", H * W), PI("tile", tile), PI("overlap", ov), PI("n", n),
|
||||
{ PI("M", 320 * 320), PI("tile", tile), PI("overlap", ov), PI("n", n),
|
||||
PS("dtype", "f32") });
|
||||
if (rc != RAD_OK) { ok("vtile_join 32 x 32 exact f32", false, "rc " + std::to_string(rc)); }
|
||||
else {
|
||||
|
||||
Reference in new issue
Block a user