Skip to content

Commit 8909523

Browse files
authored
refactor: move tiling cacl and debug print into the tiling code branch (#833)
1 parent 8376dfb commit 8909523

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

stable-diffusion.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,15 +1362,15 @@ class StableDiffusionGGML {
13621362
}
13631363

13641364
if (!use_tiny_autoencoder) {
1365-
float tile_overlap;
1366-
int tile_size_x, tile_size_y;
1367-
// multiply tile size for encode to keep the compute buffer size consistent
1368-
get_tile_sizes(tile_size_x, tile_size_y, tile_overlap, vae_tiling_params, W, H, 1.30539f);
1369-
1370-
LOG_DEBUG("VAE Tile size: %dx%d", tile_size_x, tile_size_y);
1371-
13721365
process_vae_input_tensor(x);
13731366
if (vae_tiling_params.enabled && !encode_video) {
1367+
float tile_overlap;
1368+
int tile_size_x, tile_size_y;
1369+
// multiply tile size for encode to keep the compute buffer size consistent
1370+
get_tile_sizes(tile_size_x, tile_size_y, tile_overlap, vae_tiling_params, W, H, 1.30539f);
1371+
1372+
LOG_DEBUG("VAE Tile size: %dx%d", tile_size_x, tile_size_y);
1373+
13741374
auto on_tiling = [&](ggml_tensor* in, ggml_tensor* out, bool init) {
13751375
first_stage_model->compute(n_threads, in, false, &out, work_ctx);
13761376
};
@@ -1507,15 +1507,15 @@ class StableDiffusionGGML {
15071507
}
15081508
int64_t t0 = ggml_time_ms();
15091509
if (!use_tiny_autoencoder) {
1510-
float tile_overlap;
1511-
int tile_size_x, tile_size_y;
1512-
get_tile_sizes(tile_size_x, tile_size_y, tile_overlap, vae_tiling_params, x->ne[0], x->ne[1]);
1513-
1514-
LOG_DEBUG("VAE Tile size: %dx%d", tile_size_x, tile_size_y);
1515-
15161510
process_latent_out(x);
15171511
// x = load_tensor_from_file(work_ctx, "wan_vae_z.bin");
15181512
if (vae_tiling_params.enabled && !decode_video) {
1513+
float tile_overlap;
1514+
int tile_size_x, tile_size_y;
1515+
get_tile_sizes(tile_size_x, tile_size_y, tile_overlap, vae_tiling_params, x->ne[0], x->ne[1]);
1516+
1517+
LOG_DEBUG("VAE Tile size: %dx%d", tile_size_x, tile_size_y);
1518+
15191519
// split latent in 32x32 tiles and compute in several steps
15201520
auto on_tiling = [&](ggml_tensor* in, ggml_tensor* out, bool init) {
15211521
first_stage_model->compute(n_threads, in, true, &out, NULL);

0 commit comments

Comments
 (0)