diff --git a/c10/xpu/test/impl/XPUGuardTest.cpp b/c10/xpu/test/impl/XPUGuardTest.cpp index 163b9a13d0e..fcd306375dc 100644 --- a/c10/xpu/test/impl/XPUGuardTest.cpp +++ b/c10/xpu/test/impl/XPUGuardTest.cpp @@ -54,7 +54,7 @@ TEST(XPUGuardTest, EventBehavior) { c10::impl::VirtualGuardImpl impl(device.type()); c10::Stream stream1 = impl.getStream(device); c10::Stream stream2 = impl.getStream(device); - c10::Event event1(device.type()); + c10::Event event1(device.type(), c10::EventFlag::BACKEND_DEFAULT); // event is lazily created. EXPECT_FALSE(event1.eventId()); @@ -99,7 +99,7 @@ TEST(XPUGuardTest, EventBehavior) { // ensure deviceData1 and deviceData2 are different buffers. int* deviceData2 = sycl::malloc_device(numel, xpu_stream1); sycl::free(deviceData1, c10::xpu::get_device_context()); - c10::Event event2(device.type()); + c10::Event event2(device.type(), c10::EventFlag::BACKEND_DEFAULT); // Copy hostData1 to deviceData2 via stream1, and then copy deviceData2 to // hostData1 via stream1. @@ -113,6 +113,10 @@ TEST(XPUGuardTest, EventBehavior) { event2.synchronize(); EXPECT_TRUE(event2.query()); EXPECT_NE(event1.eventId(), event2.eventId()); +#if SYCL_COMPILER_VERSION < 20250000 ASSERT_THROW(event1.elapsedTime(event2), c10::Error); +#else + event1.elapsedTime(event2); +#endif sycl::free(deviceData2, c10::xpu::get_device_context()); }