My boyfriend is black and while we do not do a lot of gay specific things when we travel, I have to say we have not noticed any difference when traveling to Western Europe, including Madrid.
Now Mexico City, Athens, and Istanbul, we noticed subtle differences, mostly a lot of kids openly staring, and some things beyond that, but nothing hostile, just sometimes absurd.
I would not even think about race when traveling to Madrid.
BillJ