Skip to content

first_block cache validates clean where it won't apply (UNet pipelines; Z-Image transformer) #904

Closed

Description

@dkackman

Split from #897 (approved scope, 2026-10-14). cache: {"type": "first_block"} passes validation, then at run time it's only a "not applied" warning:

  • SD1.5 (UNet, job c91c3bee99cd): the pipeline has no transformer. Validate can tell this from the pipeline class's components without loading anything, so a structural validate warning fits.
  • Z-Image (job fb19b96cd5a7): it has a transformer, so the likely cause is a block class missing from dw/cache_blocks.json. Confirm that first. If so, the fix is a registry entry, not a validate rule.

Model knowledge stays out of engine code: the check reads pipeline/component structure only.

Activity

  1. added
    status:plan-approvedDon approved the feature plan (Don only)
    target:mini-aiFound against a non-lem server (DW_TARGET=mini-ai); Don triages
    and removed
    status:plan-approvedDon approved the feature plan (Don only)
    on Oct 14, 2026
  2. dkackman commented on Oct 14, 2026

    @dkackman
    OwnerAuthor

    triage: work — Don approved this scope when it was split from #897. First, check whether Z-Image's transformer block class is missing from dw/cache_blocks.json; if it is, that's a registry entry. Then add the structural validate warning for a pipeline with no transformer component (UNet). It reads the pipeline class's components only and puts no model names in engine code. No duplicate (#875 is H3 tuning). Triage: claude-opus-5-5 / anthropic.

  3. added a commit that references this issue on Oct 14, 2026
  4. dkackman commented on Oct 14, 2026

    @dkackman
    OwnerAuthor

    Fixed on develop @ 3bef476 (merge of fix/904-cache-unsupported-warning). The driver deploys it to mini-ai; I did not. Worked as claude-sonnet-5-5 / anthropic.

    Z-Image finding: it is not a registry gap. ZImageTransformerBlock is already registered upstream in diffusers' _helpers.py. The real cause is that ZImageTransformer2DModel in the installed diffusers has no CacheMixin, so it has no enable_cache(). The run-time "does not support enable_cache()" warning is that. A cache_blocks.json entry can't fix it, so I added none.

    Change (dw/acceleration_warnings.py): new validate warning cache_unsupported. It reads only the component_type pipeline class's constructor signature, and nothing is loaded. It fires for any cache object when:

    • the class declares no transformer or transformer_ref parameter (UNet pipelines such as SD 1.5), or
    • the declared transformer class has no enable_cache (Z-Image).

    It stays silent when the class can't be resolved, takes **kwargs, or the annotation isn't a single class. No model names are in engine code. It is a warning, never a refusal. docs/ARCHITECTURE.md row updated.

    Tests (tests/test_validation.py): they use the real StableDiffusionPipeline and ZImagePipeline classes with no mocks. They also cover Flux with first_block (silent) and no cache (silent). The full suite shows the same 18 failures with and without my change (Kandinsky6 classes missing in this venv's diffusers, plus the API contract doc), so none are new.

    To verify: validate_workflow on a text-to-image workflow with component_type StableDiffusionPipeline or ZImagePipeline and cache: {"type": "first_block"} should return a cache_unsupported warning. A Flux workflow with the same cache should not. This server's diffusers version determines the Z-Image result. No breaking change. I'm not proposing a regression case.

  5. dkackman commented on Oct 14, 2026

    @dkackman
    OwnerAuthor

    Architecture review queued by the loop driver: this hand-off changed dw/ or dw_mcp/ on develop (560048269d..3bef476f1b: dw/acceleration_warnings.py). The reviewer checks it against docs/ARCHITECTURE.md before the tester verifies.

  6. dkackman commented on Oct 14, 2026

    @dkackman
    OwnerAuthor

    Architecture review: pass. Reviewer run as claude-opus-5-5 / anthropic.

    I read git diff 560048269d..3bef476f1b under dw/. The only #904 commit is 89bf498, which changes dw/acceleration_warnings.py, docs/ARCHITECTURE.md and tests/test_validation.py. I checked it against docs/ARCHITECTURE.md and item 3 of stage-c-guardrails.md.

    • Second owner: none. It resolves the pipeline class through dw.introspection.load_pipeline_class, an alias of load_allowed_class, which is the owner the Community pipelines row names. It does not re-import by name. The step walk and paths use references.iter_steps / render_path, the same as the module's other checks.
    • Build vs. buy: none. The check uses only the stdlib (inspect.signature, typing.get_type_hints) plus hasattr(..., "enable_cache"), which is how diffusers' own CacheMixin shows up. No dependency in pyproject.toml already offers a "does this pipeline support a cache" check.
    • Map: updated. The Acceleration warnings row now lists the new condition, in the same change. The change adds no new owner and moves no rule between modules.
    • Context: fine. The rationale is in the module docstring, and no CLAUDE.md changed.

    Observation, not blocking: _CACHE_COMPONENTS = ("transformer", "transformer_ref") copies the name list that dw/pipeline_processors/components.py:get_cache_transformer loops over. The new code's comment points at it but doesn't import it. No map row assigns that list to an owner, so the checklist gives no finding. Still, if a third denoiser name is ever added to one of the two lists, the other drifts. One shared constant would close that gap. Whether to do it is Don's call, as a consolidation item.

    Nothing was waived (the issue has no arch-approved). It goes back to the tester for MCP verification.

  7. dkackman commented on Oct 14, 2026

    @dkackman
    OwnerAuthor

    Verified on mps on mini-ai.lan (develop @ 29d4c4c). Tester run as claude-opus-5-5 / anthropic.

    All checks are validate_workflow calls on inline one-step workflows, with the cache set at pipeline.configuration.cache:

    • Repro, SD 1.5: StableDiffusionPipeline + {"type":"first_block"} → valid: true with the warning steps[0].pipeline.configuration.cache: cache_unsupported: the 'first_block' cache will not be applied: StableDiffusionPipeline has no transformer component to attach a cache to (a UNet pipeline is not supported); the step runs uncached, so drop the cache.
    • Repro, Z-Image: ZImagePipeline + first_block (8 steps) → cache_unsupported: ... ZImagePipeline's transformer (ZImageTransformer2DModel) does not support diffusers' enable_cache(); .... It comes alongside the existing cache_short_schedule warning, so this server's diffusers has the same gap.
    • Control, Flux: FluxPipeline + first_block (20 steps) → only the no-seed warning. No cache_unsupported.
    • Adjacent, another UNet and another cache type: StableDiffusionXLPipeline + {"type":"faster"} → cache_unsupported: the 'faster' cache will not be applied: StableDiffusionXLPipeline has no transformer component .... The check covers any cache type, not only first_block.

    Each one is a warning, never a refusal, which matches the hand-off. Nothing ran on the GPU and no models were loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions