Once a graph can run, profile the run you care about. Use Xcode 27 beta and a real Apple-silicon device, not only a simulator or a Mac trace. The original course's profiling lesson gives the tools. This course changes the question: what did the chip do, and which earlier requirement made that possible?
Keep the big phases apart
Read Specialization, Load, Setup, and Inference as different kinds of evidence. Specialization chooses or prepares a plan for this device. Load brings the model file and the resources it needs into the process. Setup builds the ready-to-call runtime state. Inference is the repeated image-to-logits work you actually want to measure.
Look at GPU and Neural Engine tracks as evidence of scheduling and execution. A GPU track does not mean your SwiftUI code is fast. An empty ANE (Neural Engine) track does not mean the app is broken. Compare the tracks with the phases and with the operations the model can run.
Turn a bad trace into a question about the layer below
If every tap reloads and prepares the model, the trace shows that the runtime ignored the cost of preparation. That is not a Metal speed problem yet. Reuse the prepared function, then measure again. If setup is still large, look at asset loading, specialization choices, and tensor descriptors (the shape and type notes). If inference is slow, look at graph support, shapes, and whether a custom kernel is a good fit.
The runtime is the next layer up. Its job is to turn the portable file into a prepared object you can call, and to feed it valid arrays. Continue to Core AI as the program that runs the model, then check the original course's Xcode and Core AI lesson.
Key concepts
- Profile on a real Apple-silicon device. A trace is evidence from the chip.
- Keep Specialization, Load, Setup, and Inference apart. Preparation is not repeated inference.
- GPU and Neural Engine tracks show scheduling. They are not simple good or bad labels.
- Reload and prepare on every tap shows setup in the trace, not slow Metal.
Takeaways
- Measure one cold launch, one preparation sequence, then several warm inferences.
- Reuse the prepared function before you chase GPU speed.
- A bad trace is a question about which lower layer broke.