Sacrifice can be of two types,
To thank Allah
For the sake of food.
A sacrifice must be done for the sake of Allah(swt). To do it for other than Allah is the essence of shirk. Any type of offering is included in this, such as offering food to an idol, because you are giving it up for other than Allah.
“Say. Surely my prayer and my sacrifice and my life and my death are (all) for Allah, the Lord of the worlds.” (An-An’aam,6:162)
“Therefore pray to your Lord and sacrifice.” (Al-Kawthar, 108:2)
Sacrifice can be to thank Allah, or something general purely for the sake of food. Both types must be done purely with the name of Allah.
“Their flesh and their blood reach not Allah, but the devotion (taqwaa) from you reaches Him.” (Al-Hajj, 22:37)
Ali (ra) narrated that the Prophet (saw) said, “Allah (swt ) has cursed the one who slaughters in the name of other than Allah” (Sahih Muslim).
“A man entered Paradise because of a fly, while another entered the Fire because of a fly.” They asked: “How was that possible, oh, Messenger of Allah (saw)?” He replied: “Two men passed by a people who had an idol, which it was not permissible for anyone to pass without making a sacrifice to it. They (the people) said to the first man: “Sacrifice (something).” He said: “I have nothing with which to do so.” They said: “Sacrifice some-thing, even if it were only a fly,” and so he did so, and they allowed him to continue on his way and so he entered the Hell-fire. Then they said to the second man: “Sacrifice (something).” But he said: “I will not sacrifice anything unless it is to Allah, the Almighty, the All-powerful,” so they struck his neck (and he died) and entered Paradise.” (Ahmad)