My teacher has a heart of stone giving us all this homework is:

personification
alliteration
metaphor
hyperbole

Metaphor.

The example you provided, "My teacher has a heart of stone giving us all this homework," contains the literary device of personification.

Personification is the attribution of human qualities or characteristics to non-human objects or ideas. In this case, the teacher's heart is given the human quality of being stone-like, which implies a lack of compassion or understanding.

To summarize, the correct literary device in the sentence is personification.