#ifndef XPU_ZE_STREAM_IMPL_HPP
#define XPU_ZE_STREAM_IMPL_HPP
#include "common/stream_impl.hpp"
#include "common/thread_local_storage.hpp"
#include "xpu/ze/context.hpp"
#include "xpu/ze/utils.hpp"
#include <list>
namespace dnnl {
namespace impl {
namespace xpu {
namespace ze {
class stream_impl_t : public impl::stream_impl_t {
public:
stream_impl_t() = delete;
stream_impl_t(unsigned flags, ze_command_list_handle_t list = nullptr)
: impl::stream_impl_t(flags), list_(list, !list) {}
~stream_impl_t() override = default;
status_t init(ze_context_handle_t context = nullptr,
ze_device_handle_t device = nullptr);
status_t wait();
status_t copy(const impl::memory_storage_t &src,
const impl::memory_storage_t &dst, size_t size,
const xpu::event_t &deps, xpu::event_t &out_dep);
status_t fill(const impl::memory_storage_t &dst, uint8_t pattern,
size_t size, const xpu::event_t &deps, xpu::event_t &out_dep);
status_t barrier();
const xpu::ze::context_t &ze_ctx() const;
xpu::ze::context_t &ze_ctx();
xpu::context_t &ctx();
const xpu::context_t &ctx() const;
ze_event_handle_t get_output_event() const;
ze_event_handle_t create_event();
ze_command_list_handle_t list() const { return list_; }
static status_t init_flags(
unsigned *flags, ze_command_list_handle_t list, bool profiling);
private:
xpu::ze::wrapper_t<ze_command_list_handle_t> list_;
xpu::ze::wrapper_t<ze_event_pool_handle_t> event_pool_;
std::list<xpu::ze::wrapper_t<ze_event_handle_t>> events_;
mutable utils::thread_local_storage_t<context_t> ctx_;
DNNL_DISALLOW_COPY_AND_ASSIGN(stream_impl_t);
};
} } } }
#endif