Hi from JustAnswer!
According to Mitchell documentation, the 4 cylinder Mazda 2.0 is not equipped with a knock sensor.
(If the engine is a 2.5L DOHC V6, the knock sensor is threaded into the center of the block on top, between the heads and under the intake manifold assembly. A pigtail connecter is usually visible with a wire leading down the center of the intake valley to the sensor.
To be certain that knock is causing the retard condition, simply unplug the knock sensor. If normal acceleration comes back, and you hear no pinging with regular fuel, the sensor may be oversensitive due to age or water intrusion. )
Note that the distributor CAN be inserted improperly in the engine - be certain that the rotor is pointing DIRECTLY at #1 or #4 cap contact (and not halfway between two contacts) when the timing marks are lined up. Having it any other way introduces a huge gap in the distributor for spark to jump. While watching electronic timing control, timing is ADVANCED by the computer to a setpoint at all speeds above cranking (500+), then more at hot idle and steady cruise to stabilize idle rpm and efficiency, and RETARDED upon acceleration (older distributors have a mechanical advance that reindexes timing proportional to engine speed - to a predetermined rpm and no higher). This is a normal condition. I had to read back on your previous posts to check on what the original condition was. Set "base" (unadvanced) timing with idle speed at specs or else overadvance will happen at cruise speed. For 4-Cylinder engines, more spark lead doesn't necessarily mean more power, in fact it means a choppy idle in gear and no gains in performance or economy.
If all else is fine, a significant stumble can be caused by dirt contamination inside the Mass Airflow sensor. If the sensor on your working vehicle is of the same design and part number, substituting the sensor and road testing might turn up any big differences anywhere in the normal range of driving. Also, a restricted exhaust will cause poor airflow readings as if the engine throttle weren't opening completely on acceleration.