compiledUnion = Compile[{{v, _Real, 2}},
Block[{
dim1 = Length[v], dim2 = Length@First[v],
sorted = Sort[v], output = Internal`Bag@Most[{0.}],
seen, current
},
Internal`StuffBag[output, seen = First[sorted], 1];
Do[
If[(current = Compile`GetElement[sorted, i]) != seen,
Internal`StuffBag[output, seen = current, 2]
],
{i, 2, dim1}
];
Partition[Internal`BagPart[output, All], dim2]
],
RuntimeOptions -> {"Speed", "CompareWithTolerance" -> True},