hdist: make density handling independent of replica_count