I just remembered that I tried using an old piece of carpet this way once. I had the pile on top, but after a while things started growing in the pile, and as the bottom degraded, the roots started growing through it. It ended up being a real pain. Weeds were hard to pull out, and long strings of carpet fiber were entangled in the roots. I think I must have blocked out the experience!
When I saw where you are considering using it, I was reminded of a friend's veggie garden with electric fencing around it to keep the deer out. He used leftover roofing shingles, laying in a line under the fence line, overlapping. That was very effective.