For commentary on the movie itself, especially the story/ending, have a look at what Film Crit Hulk did. Spoilers run rampant over there. Here will be some, too. The focus will be another.
First of all: putting a newly emergent/created AI into a body, especially a bipedal body. Unneccessary and – assuming a malicious entity – stupid. Ex Machina did it for story reason (as did Chappie and many other works of fiction). A more realistic scenario would be an AI emerging from the internet (which would lead to another dimension of questions) or being created in a controlled environment. My following thoughts assume the latter.
Also, I personally don’t think that a sentient AI would actually wipe out humanity. Wiping out fully-conditionable, self-replicating, self-sufficient maintenance units would be a very special kind of stupid.