The sentence is grammatical both ways. There is a subject and a verb.
Inversion of subject and auxiliary verb is a common way of forming questions in English. But, verbal inflection is also a manner of forming questions. (Have you ever asked someone the [fragmented] question, "Beer?")
Consider the following:
He did run out the door?
This is still a question, even though the subject is before the verb. If this were spoken, it would likely require the verbal inflection at the end of the word to signify it being a question.
Most often, this would be a question of confirmation. But that doesn't make it less grammatical.
Arguably, it would have been clearer to ask:
Did he run out the door?
The order of the subject and verb is merely a matter of style at this point.