Short answer it will work.
Long answer.
Cuda Events are something which will be marked when cuda starts running some code.
The cpu will just dispatch it async to the GPU.
So when cpu hits start.record() it send it to the GPU and GPU records the time when it starts executing.
Now whatever the code be after this, if CPU bound CPU will execute it or if GPU bound CPU will queue it in the cuda stream and keep moving. Now when CPU hits end.record() it again queues it in stream and when GPU executes it will record the time.
The magic comes from torch.cuda.synchronize() which is a synchronous call, and makes sure that all cuda commands dispatched before are done. In case of CPU bound code there are only two calls start.record() and end.record() so they will be done.