At Gayā
Gayā Sutta  (AN 8:71)

I have heard that on one occasion the Blessed One was staying near Gayā at Gayā Head. There he addressed the monks, “Monks!”

“Yes, lord,” the monks responded to the Blessed One.

The Blessed One said, “Monks, before my self-awakening, when I was still just an unawakened bodhisatta, I perceived light but did not see forms. The thought occurred to me, ‘If I perceived light and saw forms, then this knowledge-&-vision of mine would be purer.’

“So, at a later time—staying heedful, ardent, & resolute—I perceived light and saw forms, but I did not associate with those devas, didn’t converse with them, or engage them in discussion. The thought occurred to me, ‘If I perceived light and saw forms; and associated with those devas, conversed with them, and engaged them in discussion, then this knowledge-&-vision of mine would be purer.

“So, at a later time—staying heedful, ardent, & resolute—I perceived light and saw forms; and I also associated with those devas, conversed with them, and engaged them in discussion; but I did not know of those devas that ‘These devas are from this or that deva host.’ The thought occurred to me, ‘If I perceived light and saw forms; and associated with those devas, conversed with them, and engaged them in discussion; and I also knew of those devas that ‘These devas are from this or that deva host,’ then this knowledge-&-vision of mine would be purer.

“So, at a later time—staying heedful, ardent, & resolute—I perceived light and saw forms; and associated with those devas, conversed with them, and engaged them in discussion; and I also knew of those devas that ‘These devas are from this or that deva host’; but I did not know of those devas that ‘As a result of this kamma, these devas fell away from here and reappeared there.’ The thought occurred to me, ‘If I perceived light and saw forms; and associated with those devas, conversed with them, and engaged them in discussion; and I also knew of those devas that ‘These devas are from this or that deva host’; and I also knew of those devas that ‘As a result of this kamma, these devas fell away from here and reappeared there,’ then this knowledge-&-vision of mine would be purer.’

“… I also knew of those devas that, ‘As a result of this kamma, these devas fell away from here and reappeared there,’ but I did not know of those devas that ‘As a result of this kamma, these devas are nourished on such food and experience such pleasure & pain.’ …

“… I also knew of those devas that, ‘As a result of this kamma, these devas are nourished on such food and experience such pleasure & pain,’ but I did not know of those devas that ‘As a result of this kamma, these devas have such a lifespan and are of such long standing.’ …

“… I also knew of those devas that, ‘As a result of this kamma, these devas have such a lifespan and are of such long standing,’ but I did not know of those devas whether I had lived together with these devas or not. The thought occurred to me, ‘If I perceived light and saw forms; and associated with those devas, conversed with them, and engaged them in discussion; and I also knew of those devas that ‘These devas are from this or that deva host’; and I also knew of those devas that ‘As a result of this kamma, these devas fell away from here and reappeared there’; and I also knew of those devas that ‘As a result of this kamma, these devas are nourished on such food and experience such pleasure & pain’; and I also knew of those devas that ‘As a result of this kamma, these devas have such a lifespan and are of such long standing’; and I also knew of those devas whether I had previously lived together with them or not, then this knowledge-&-vision of mine would be purer.’

“So, at a later time—staying heedful, ardent, & resolute—I perceived light and saw forms; and associated with those devas, conversed with them, and engaged them in discussion; and I also knew of those devas that ‘These devas are from this or that deva host’; and I also knew of those devas that ‘As a result of this kamma, these devas fell away from here and reappeared there’; and I also knew of those devas that ‘As a result of this kamma, these devas are nourished on such food and experience such pleasure & pain’; and I also knew of those devas that ‘As a result of this kamma, these devas have such a lifespan and are of such long standing’; and I also knew of those devas whether I had previously lived together with them or not.

“And, monks, as long as this—my eight-round heightened deva-knowledge-&-vision—was not pure, I did not claim to have directly awakened to the right self-awakening unexcelled in the cosmos with its devas, Māras, & Brahmās, with its people with their contemplatives & brahmans, their royalty & commonfolk. But as soon as this—my eight-round heightened deva-knowledge-&-vision—was truly pure, then I did claim to have directly awakened to the right self-awakening unexcelled in the cosmos with its devas, Māras, & Brahmās, with its people with their contemplatives & brahmans, their royalty & commonfolk. Knowledge & vision arose in me: ‘Unprovoked is my release. This is the last birth. There is now no further becoming.’”