summaryrefslogtreecommitdiff
path: root/parallel-libs/streamexecutor/lib/Device.cpp
blob: 260c1ba17cd863c2243855479615c89dcb422354 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//===-- Device.cpp - Device implementation --------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// Implementation of Device class internals.
///
//===----------------------------------------------------------------------===//

#include "streamexecutor/Device.h"

#include <cassert>

#include "streamexecutor/PlatformDevice.h"
#include "streamexecutor/Stream.h"

#include "llvm/ADT/STLExtras.h"

namespace streamexecutor {

Device::Device(PlatformDevice *PDevice) : PDevice(PDevice) {}

Device::~Device() = default;

Expected<Stream> Device::createStream() {
  Expected<const void *> MaybePlatformStream = PDevice->createStream();
  if (!MaybePlatformStream) {
    return MaybePlatformStream.takeError();
  }
  return Stream(PDevice, *MaybePlatformStream);
}

} // namespace streamexecutor