mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
# Motivation This PR intends to make device-specific Event inherit from the generic torch.Event. The benefit is providing a generic abstract class `torch.Event` for different devices, like `torch.Stream`. This make it easier for Dynamo to capture the Event of different devices, like torch.cuda.Event and torch.xpu.Event. And the next PR would like to remove previous useless base class `_StreamBase` and `_EventBase` to avoid multiple Inheritance. Pull Request resolved: https://github.com/pytorch/pytorch/pull/134845 Approved by: https://github.com/albanD, https://github.com/EikanWang
17 lines
369 B
C
17 lines
369 B
C
#pragma once
|
|
|
|
#include <ATen/xpu/XPUEvent.h>
|
|
#include <torch/csrc/Event.h>
|
|
#include <torch/csrc/python_headers.h>
|
|
|
|
struct THXPEvent : THPEvent {
|
|
at::xpu::XPUEvent xpu_event;
|
|
};
|
|
extern PyObject* THXPEventClass;
|
|
|
|
void THXPEvent_init(PyObject* module);
|
|
|
|
inline bool THXPEvent_Check(PyObject* obj) {
|
|
return THXPEventClass && PyObject_IsInstance(obj, THXPEventClass);
|
|
}
|