Nodes/ComfyUi-MpiNodes/Mpi Compare Packs
ComfyUI Node

Mpi Compare Packs

Check that a whole bundle of values didn't change

By MadPonyInteractive·Created 11 months ago·Updated 5 days ago· 3
Mpi Compare Packs
  • a
  • b
  • equal
  • first_diff

MpiCompare handles a single value, but what do you do when you want to confirm an entire bundle of settings - strength, seed, a mask, a prompt - came out of two different paths identical? MpiComparePacks is the pack-aware answer. It takes two MPI_PACK wires, compares them slot by slot, and tells you whether they match and where the first difference lives.

What a "pack" even is

This pack has its own wire type, MPI_PACK, built by MpiPacker (and the 10-slot MpiPacker10). A pack is just a list under the hood - up to five (or ten) values of any type bundled onto one wire, and packs can nest, so five packers into a packer carries 25 values on a single connection. MpiComparePacks is what you use when "are these two bundles identical?" is the question you actually want to ask.

How it works

Both inputs, a and b, are MPI_PACK. The node walks them slot by slot and returns:

  • equal - BOOLEAN. True only if every slot matches, including length: if one pack has more slots than the other, the extra slots count as a difference.
  • first_diff - INT. The 1-based slot of the first mismatch, or 0 when the packs are equal.

The useful part is how it compares. Unlike MpiCompare - which raises on tensors - this one compares images and other tensors by content, not by object identity. And because packs can nest, it recurses: a pack inside a pack inside a pack compares all the way down. Two workflows that build the same pack through different routes will read as equal, which is exactly what you want from a sanity check.

Where you'd use it

The pattern that justifies it: you have a branch - say a manual settings path and an automated one - that should produce the same values, and you want to assert that before spending a generation on them. Wire both into MpiComparePacks, feed equal into an MpiIfElse that picks the trustworthy branch, and you've got a self-checking workflow. The first_diff output doubles as a debugging aid: when a reworked workflow starts producing subtly different results, it tells you which slot drifted instead of making you diff six values by hand.

Where people get burned

Watch the slot-count rule. A pack with an empty slot (nothing packed into it) is still a slot, so a 5-slot pack with slot 3 empty vs a 4-slot pack that never had slot 3 will compare as different. That's usually what you want - empty ≠ absent - but it catches people who expect "the values that exist" to be compared. And don't expect ordering tolerance: slot 1 vs slot 2 swapped is a mismatch, by design.

Install

From the MadPonyInteractive/ComfyUi-MpiNodes pack. ComfyUI Manager → search ComfyUi-MpiNodes (publisher mad-pony-interactive), install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes

then restart. No dependencies, no models to grab - it's a pure logic node. The pack is AGPL-3.0 (≤ 1.2.6 MIT) and is the node engine behind the author's Cubric Vision app.

The verdict

If you never pack values onto one wire, this node has nothing to compare and you can skip it. But the moment you adopt MpiPacker - and packed wires are genuinely handy for keeping graphs readable - this is the natural companion. It's the pack-safe MpiCompare, and it's the only way to ask "did anything change?" about a whole bundle at once.

CategoryMpiNodes/Logic

Inputs (2)

NameTypeDefaultDescription
aMPI_PACK
bMPI_PACK

Outputs (2)

NameTypeDescription
equalBOOLEAN
first_diffINT