By a classical result of Birkhoff (that is, Theorem 2 in [G. Birkhoff, Subdirect unions in universal algebra, Bull. AMS, 1944]) and the trivial fact that the class of semigroups is closed under the taking of homomorphic images within the category of magmas, every semigroup is (isomorphic to) a subdirect product of subdirectly irreducible semigroups. What about cancellative semigroups? More precisely:
Q. Is every cancellative semigroup a subdirect product of subdirectly irreducible, cancellative semigroups?
If a semigroup $T$ is the homomorphic image of a cancellative semigroup $S$, then $T$ need not be cancellative (otherwise we would be done). However, I am hoping that there is a generalization of Birkhoff's theorem that applies not only to (finitary) algebras in the sense of Birkhoff's paper, but also to algebras (such as cancellative semigroups) that satisfy certain equational implications.
UPDATE 1. Below, Keith Kearnes proves that the answer is yes in the commutative setting.