Keep XPU compatible with toolchain 2025.2 (#154359)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/154359
Approved by: https://github.com/EikanWang, https://github.com/cyyever
This commit is contained in:
Yu, Guangye
2025-05-29 11:17:57 +00:00
committed by PyTorch MergeBot
parent cd9ff41282
commit 3c74a72ea0

View File

@ -133,8 +133,13 @@ inline void initGlobalDevicePoolState() {
#else
// The default context is utilized for each Intel GPU device, allowing the
// retrieval of the context from any GPU device.
const auto& platform = gDevicePool.devices[0]->get_platform();
gDevicePool.context = std::make_unique<sycl::context>(
gDevicePool.devices[0]->get_platform().ext_oneapi_get_default_context());
#if SYCL_COMPILER_VERSION >= 20250200
platform.khr_get_default_context());
#else
platform.ext_oneapi_get_default_context());
#endif
#endif
}