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
@@ -6949,6 +6949,16 @@ TEST(vtile_plan_plans_one_frame_the_way_vae_py_splits_it) {
|
||||
T g2(RAD_I32, {3}); g2.n({1, 100, 96});
|
||||
A d; d.t(g2).t(y1).i("M", 1).i("tile", 16).i("overlap", 4).i("ratio", 16);
|
||||
CHECK_EQ(run("vtile_plan", d), RAD_E_SHAPE);
|
||||
|
||||
/* The engine binds M to the band's bound (m.tiles), never to this call: a ceiling above the
|
||||
* tiles plans the same rows, and a y that cannot hold them is still refused. */
|
||||
T yb(RAD_I32, {6, 22});
|
||||
A f; f.t(geom).t(yb).i("M", 33).i("tile", 16).i("overlap", 4).i("ratio", 16);
|
||||
CHECK_OK(run("vtile_plan", f));
|
||||
for (int64_t t = 0; t < 6; ++t) CHECK_EQ(yb.iat(t * 22 + 0), y0[t]);
|
||||
T ys(RAD_I32, {5, 22});
|
||||
A g; g.t(geom).t(ys).i("M", 33).i("tile", 16).i("overlap", 4).i("ratio", 16);
|
||||
CHECK_EQ(run("vtile_plan", g), RAD_E_SHAPE);
|
||||
}
|
||||
|
||||
/* A 20 x 20 px plane in ratio 4, tiles of 3 latents (12 px) with overlap 1: each axis splits at
|
||||
@@ -7016,6 +7026,16 @@ TEST(vtile_crop_cuts_the_plane_tile_major) {
|
||||
T x2(RAD_F32, {399, 3});
|
||||
A d; d.t(x2).t(geom).t(y).i("M", 576).i("tile", 3).i("overlap", 1).i("ratio", 4);
|
||||
CHECK_EQ(run("vtile_crop", d), RAD_E_SHAPE);
|
||||
|
||||
/* The engine binds M to the band's bound, never to this call: a ceiling above the cut copies
|
||||
* the same rows, and a y that cannot hold the tiles is still refused. */
|
||||
T yb(RAD_F32, {576, 3});
|
||||
A f; f.t(x).t(geom).t(yb).i("M", 33 * 256 * 256).i("tile", 3).i("overlap", 1).i("ratio", 4);
|
||||
CHECK_OK(run("vtile_crop", f));
|
||||
CHECK_EQ(yb.at(575 * 3 + 2), (float)399);
|
||||
T ys(RAD_F32, {575, 3});
|
||||
A g; g.t(x).t(geom).t(ys).i("M", 33 * 256 * 256).i("tile", 3).i("overlap", 1).i("ratio", 4);
|
||||
CHECK_EQ(run("vtile_crop", g), RAD_E_SHAPE);
|
||||
}
|
||||
|
||||
/* A 6 x 6 latent canvas, tiles of 4 with overlap 2: each axis splits at 0 and 2, the kept ranges
|
||||
@@ -7089,6 +7109,18 @@ TEST(vtile_join_blends_raw_neighbours_down_then_across) {
|
||||
T x2(RAD_BF16, {63, 1});
|
||||
A d; d.t(x2).t(geom).t(y).i("M", 36).i("tile", 4).i("overlap", 2).i("n", 1).s("dtype", "bf16");
|
||||
CHECK_EQ(run("vtile_join", d), RAD_E_SHAPE);
|
||||
|
||||
/* The engine binds M to the band's bound, never to this call: a ceiling above the canvas
|
||||
* blends the same rows, and a y short of the canvas is still refused. */
|
||||
T yb(RAD_BF16, {36, 1});
|
||||
A f; f.t(x).t(geom).t(yb).i("M", 320 * 320).i("tile", 4).i("overlap", 2).i("n", 1)
|
||||
.s("dtype", "bf16");
|
||||
CHECK_OK(run("vtile_join", f));
|
||||
CHECK_EQ(yb.at(5 * 6 + 5), 32.0f);
|
||||
T ys(RAD_BF16, {35, 1});
|
||||
A g; g.t(x).t(geom).t(ys).i("M", 320 * 320).i("tile", 4).i("overlap", 2).i("n", 1)
|
||||
.s("dtype", "bf16");
|
||||
CHECK_EQ(run("vtile_join", g), RAD_E_SHAPE);
|
||||
}
|
||||
|
||||
/* ================================================================== the latent upscaler
|
||||
|
||||
Reference in new issue
Block a user