[DeviceIndex][7/N] Use DeviceIndex in XPU (#120576)
Co-authored-by: Yu, Guangye <106960996+guangyey@users.noreply.github.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/120576
Approved by: https://github.com/guangyey, https://github.com/Skylion007