Mpi Compare
The little logic node that makes workflows branch
- a
- b
- result
Every time someone shows you a workflow that "just knows" whether to take the fast path or the slow one, there's a comparison node hiding in there somewhere. MpiCompare is that node. Feed it a value and an operator, it hands you a boolean, and that boolean drives an if/else or a switch that changes what actually runs. It sounds trivial until you've hand-wired a == b five different ways and wished one node did it.
How it works
You give it a (any type), pick an operator from ==, !=, >, <, >=, <=, and it compares against a second value. That second value can arrive two ways:
b- an actual wire of any type. This is the path you use for text, booleans, or anything that isn't a plain number.b_value- a FLOAT widget that's used only whenbis left unconnected. It's converted to the type ofafirst, so against a boolean input0means false and anything else means true, and against an int it gets truncated. Against text you're out of luck - wirebfor that.
The output is a single result BOOLEAN. That's the whole node, which is the point: one clean true/false you can route into an MpiIfElse, a blocker, or a switch without any intermediate juggling.
The inputs that matter
Honestly only two:
a- whatever you're checking. Wire it from a prompt list count, a sampler step, an image batch size.operator- the dropdown.==and!=are the workhorses;>/<are there for when you're comparing numbers like "did this tile exceed the limit."
b_value defaults to 0, so a > 0 with no b connected is a perfectly good "is there anything here" check.
Where people get burned
The classic stumble is comparing text. Leave b unconnected and type a word into b_value? It's a float widget - the node will try to coerce your text to the type of a, and if a isn't a number it raises. Text comparisons always go through the wired b input, never the widget.
Also worth knowing: this node is fine with booleans and numbers, but it's not tensor-safe. If you throw images or tensors at it you'll get an error or nonsense - for that job the pack has MpiComparePacks, which compares pack contents by value. Different tool for a different wire.
Install
From the MadPonyInteractive/ComfyUi-MpiNodes pack. ComfyUI Manager → search ComfyUi-MpiNodes (publisher mad-pony-interactive), install, restart. Or the manual way:
cd ComfyUI/custom_nodes
git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes
then restart. No extra Python packages and no model downloads - it's a pure logic node. The pack is under AGPL-3.0 (versions ≤ 1.2.6 were MIT), and it's the same node collection that powers the author's Cubric Vision desktop app, which is where most of these "smart" workflows actually come from.
The pattern worth stealing
The combo you'll see everywhere in Cubric-sourced workflows is MpiCompare → MpiIfElse (or MpiIfElseInverted): compare, get a boolean, pick between two branches. Because MpiIfElse's inputs are lazy, the branch you don't take never even computes. That's the real payoff of having a dedicated compare node - your "if the batch is tiny, skip the upscale" logic costs nothing when it doesn't fire.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| a | * | — | |
| operator | COMBO | == | Choose the comparison operator |
| bopt | * | — | |
| b_valueopt | FLOAT | 0.00-1000000000–1000000000 | Compared against when b is not connected. Converted to the type of a: for a boolean 0 is false and anything else true, for an int it is truncated. To compare against text, connect the b input instead. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | BOOLEAN | — |