Skip to content

Commit bcc77b6

Browse files
committedAug 24, 2016
[StreamExecutor] Rename Executor to Device
Summary: This more clearly describes what the class is. Reviewers: jlebar Subscribers: jprice, parallel_libs-commits Differential Revision: https://reviews.llvm.org/D23851 llvm-svn: 279669
1 parent 571a647 commit bcc77b6

14 files changed

+575
-580
lines changed
 

‎parallel-libs/streamexecutor/include/streamexecutor/Executor.h ‎parallel-libs/streamexecutor/include/streamexecutor/Device.h

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- Executor.h - The Executor class -------------------------*- C++ -*-===//
1+
//===-- Device.h - The Device class -----------------------------*- C++ -*-===//
22
//
33
// The LLVM Compiler Infrastructure
44
//
@@ -8,12 +8,12 @@
88
//===----------------------------------------------------------------------===//
99
///
1010
/// \file
11-
/// The Executor class which represents a single device of a specific platform.
11+
/// The Device class which represents a single device of a specific platform.
1212
///
1313
//===----------------------------------------------------------------------===//
1414

15-
#ifndef STREAMEXECUTOR_EXECUTOR_H
16-
#define STREAMEXECUTOR_EXECUTOR_H
15+
#ifndef STREAMEXECUTOR_DEVICE_H
16+
#define STREAMEXECUTOR_DEVICE_H
1717

1818
#include "streamexecutor/KernelSpec.h"
1919
#include "streamexecutor/PlatformInterfaces.h"
@@ -24,10 +24,10 @@ namespace streamexecutor {
2424
class KernelInterface;
2525
class Stream;
2626

27-
class Executor {
27+
class Device {
2828
public:
29-
explicit Executor(PlatformExecutor *PExecutor);
30-
virtual ~Executor();
29+
explicit Device(PlatformDevice *PDevice);
30+
virtual ~Device();
3131

3232
/// Gets the kernel implementation for the underlying platform.
3333
virtual Expected<std::unique_ptr<KernelInterface>>
@@ -42,15 +42,15 @@ class Executor {
4242
template <typename T>
4343
Expected<GlobalDeviceMemory<T>> allocateDeviceMemory(size_t ElementCount) {
4444
Expected<GlobalDeviceMemoryBase> MaybeBase =
45-
PExecutor->allocateDeviceMemory(ElementCount * sizeof(T));
45+
PDevice->allocateDeviceMemory(ElementCount * sizeof(T));
4646
if (!MaybeBase)
4747
return MaybeBase.takeError();
4848
return GlobalDeviceMemory<T>(*MaybeBase);
4949
}
5050

5151
/// Frees memory previously allocated with allocateDeviceMemory.
5252
template <typename T> Error freeDeviceMemory(GlobalDeviceMemory<T> Memory) {
53-
return PExecutor->freeDeviceMemory(Memory);
53+
return PDevice->freeDeviceMemory(Memory);
5454
}
5555

5656
/// Allocates an array of ElementCount entries of type T in host memory.
@@ -59,15 +59,15 @@ class Executor {
5959
/// copies on streams. See Stream::thenCopyD2H and Stream::thenCopyH2D.
6060
template <typename T> Expected<T *> allocateHostMemory(size_t ElementCount) {
6161
Expected<void *> MaybeMemory =
62-
PExecutor->allocateHostMemory(ElementCount * sizeof(T));
62+
PDevice->allocateHostMemory(ElementCount * sizeof(T));
6363
if (!MaybeMemory)
6464
return MaybeMemory.takeError();
6565
return static_cast<T *>(*MaybeMemory);
6666
}
6767

6868
/// Frees memory previously allocated with allocateHostMemory.
6969
template <typename T> Error freeHostMemory(T *Memory) {
70-
return PExecutor->freeHostMemory(Memory);
70+
return PDevice->freeHostMemory(Memory);
7171
}
7272

7373
/// Registers a previously allocated host array of type T for asynchronous
@@ -77,15 +77,15 @@ class Executor {
7777
/// memory copies on streams. See Stream::thenCopyD2H and Stream::thenCopyH2D.
7878
template <typename T>
7979
Error registerHostMemory(T *Memory, size_t ElementCount) {
80-
return PExecutor->registerHostMemory(Memory, ElementCount * sizeof(T));
80+
return PDevice->registerHostMemory(Memory, ElementCount * sizeof(T));
8181
}
8282

8383
/// Unregisters host memory previously registered by registerHostMemory.
8484
template <typename T> Error unregisterHostMemory(T *Memory) {
85-
return PExecutor->unregisterHostMemory(Memory);
85+
return PDevice->unregisterHostMemory(Memory);
8686
}
8787

88-
/// \anchor ExecutorHostSyncCopyGroup
88+
/// \anchor DeviceHostSyncCopyGroup
8989
/// \name Host-synchronous device memory copying functions
9090
///
9191
/// These methods block the calling host thread while copying data to or from
@@ -125,9 +125,9 @@ class Executor {
125125
return make_error(
126126
"copying too many elements, " + llvm::Twine(ElementCount) +
127127
", to a host array of element count " + llvm::Twine(Dst.size()));
128-
return PExecutor->synchronousCopyD2H(
129-
Src.getBaseMemory(), Src.getElementOffset() * sizeof(T), Dst.data(), 0,
130-
ElementCount * sizeof(T));
128+
return PDevice->synchronousCopyD2H(Src.getBaseMemory(),
129+
Src.getElementOffset() * sizeof(T),
130+
Dst.data(), 0, ElementCount * sizeof(T));
131131
}
132132

133133
template <typename T>
@@ -179,9 +179,9 @@ class Executor {
179179
llvm::Twine(ElementCount) +
180180
", to a device array of element count " +
181181
llvm::Twine(Dst.getElementCount()));
182-
return PExecutor->synchronousCopyH2D(Src.data(), 0, Dst.getBaseMemory(),
183-
Dst.getElementOffset() * sizeof(T),
184-
ElementCount * sizeof(T));
182+
return PDevice->synchronousCopyH2D(Src.data(), 0, Dst.getBaseMemory(),
183+
Dst.getElementOffset() * sizeof(T),
184+
ElementCount * sizeof(T));
185185
}
186186

187187
template <typename T>
@@ -234,7 +234,7 @@ class Executor {
234234
llvm::Twine(ElementCount) +
235235
", to a device array of element count " +
236236
llvm::Twine(Dst.getElementCount()));
237-
return PExecutor->synchronousCopyD2D(
237+
return PDevice->synchronousCopyD2D(
238238
Src.getBaseMemory(), Src.getElementOffset() * sizeof(T),
239239
Dst.getBaseMemory(), Dst.getElementOffset() * sizeof(T),
240240
ElementCount * sizeof(T));
@@ -292,9 +292,9 @@ class Executor {
292292
///@} End host-synchronous device memory copying functions
293293

294294
private:
295-
PlatformExecutor *PExecutor;
295+
PlatformDevice *PDevice;
296296
};
297297

298298
} // namespace streamexecutor
299299

300-
#endif // STREAMEXECUTOR_EXECUTOR_H
300+
#endif // STREAMEXECUTOR_DEVICE_H

‎parallel-libs/streamexecutor/include/streamexecutor/Kernel.h

+11-11
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@
5454
/// function as follows:
5555
/// \code
5656
/// namespace ccn = compiler_cuda_namespace;
57-
/// // Assumes Executor is a pointer to the StreamExecutor on which to
58-
/// // launch the kernel.
57+
/// // Assumes Device is a pointer to the Device on which to launch the
58+
/// // kernel.
5959
/// //
6060
/// // See KernelSpec.h for details on how the compiler can create a
6161
/// // MultiKernelLoaderSpec instance like SaxpyKernelLoaderSpec below.
6262
/// Expected<ccn::SaxpyKernel> MaybeKernel =
63-
/// ccn::SaxpyKernel::create(Executor, ccn::SaxpyKernelLoaderSpec);
63+
/// ccn::SaxpyKernel::create(Device, ccn::SaxpyKernelLoaderSpec);
6464
/// if (!MaybeKernel) { /* Handle error */ }
6565
/// ccn::SaxpyKernel SaxpyKernel = *MaybeKernel;
6666
/// Launch(SaxpyKernel, A, X, Y);
@@ -84,7 +84,7 @@
8484

8585
namespace streamexecutor {
8686

87-
class Executor;
87+
class Device;
8888
class KernelInterface;
8989

9090
/// The base class for device kernel functions.
@@ -100,13 +100,13 @@ class KernelBase {
100100
KernelBase &operator=(KernelBase &&) = default;
101101
~KernelBase();
102102

103-
/// Creates a kernel object from an Executor and a MultiKernelLoaderSpec.
103+
/// Creates a kernel object from a Device and a MultiKernelLoaderSpec.
104104
///
105-
/// The Executor knows which platform it belongs to and the
105+
/// The Device knows which platform it belongs to and the
106106
/// MultiKernelLoaderSpec knows how to find the kernel code for different
107107
/// platforms, so the combined information is enough to get the kernel code
108108
/// for the appropriate platform.
109-
static Expected<KernelBase> create(Executor *ParentExecutor,
109+
static Expected<KernelBase> create(Device *Dev,
110110
const MultiKernelLoaderSpec &Spec);
111111

112112
const std::string &getName() const { return Name; }
@@ -116,11 +116,11 @@ class KernelBase {
116116
KernelInterface *getImplementation() { return Implementation.get(); }
117117

118118
private:
119-
KernelBase(Executor *ParentExecutor, const std::string &Name,
119+
KernelBase(Device *Dev, const std::string &Name,
120120
const std::string &DemangledName,
121121
std::unique_ptr<KernelInterface> Implementation);
122122

123-
Executor *ParentExecutor;
123+
Device *TheDevice;
124124
std::string Name;
125125
std::string DemangledName;
126126
std::unique_ptr<KernelInterface> Implementation;
@@ -136,9 +136,9 @@ template <typename... ParameterTs> class TypedKernel : public KernelBase {
136136
TypedKernel &operator=(TypedKernel &&) = default;
137137

138138
/// Parameters here have the same meaning as in KernelBase::create.
139-
static Expected<TypedKernel> create(Executor *ParentExecutor,
139+
static Expected<TypedKernel> create(Device *Dev,
140140
const MultiKernelLoaderSpec &Spec) {
141-
auto MaybeBase = KernelBase::create(ParentExecutor, Spec);
141+
auto MaybeBase = KernelBase::create(Dev, Spec);
142142
if (!MaybeBase) {
143143
return MaybeBase.takeError();
144144
}

‎parallel-libs/streamexecutor/include/streamexecutor/PlatformInterfaces.h

+7-8
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
namespace streamexecutor {
3333

34-
class PlatformExecutor;
34+
class PlatformDevice;
3535

3636
/// Methods supported by device kernel function objects on all platforms.
3737
class KernelInterface {
@@ -41,27 +41,26 @@ class KernelInterface {
4141
/// Platform-specific stream handle.
4242
class PlatformStreamHandle {
4343
public:
44-
explicit PlatformStreamHandle(PlatformExecutor *PExecutor)
45-
: PExecutor(PExecutor) {}
44+
explicit PlatformStreamHandle(PlatformDevice *PDevice) : PDevice(PDevice) {}
4645

4746
virtual ~PlatformStreamHandle();
4847

49-
PlatformExecutor *getExecutor() { return PExecutor; }
48+
PlatformDevice *getDevice() { return PDevice; }
5049

5150
private:
52-
PlatformExecutor *PExecutor;
51+
PlatformDevice *PDevice;
5352
};
5453

5554
/// Raw executor methods that must be implemented by each platform.
5655
///
5756
/// This class defines the platform interface that supports executing work on a
5857
/// device.
5958
///
60-
/// The public Executor and Stream classes have the type-safe versions of the
59+
/// The public Device and Stream classes have the type-safe versions of the
6160
/// functions in this interface.
62-
class PlatformExecutor {
61+
class PlatformDevice {
6362
public:
64-
virtual ~PlatformExecutor();
63+
virtual ~PlatformDevice();
6564

6665
virtual std::string getName() const = 0;
6766

‎parallel-libs/streamexecutor/include/streamexecutor/Stream.h

+20-21
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,18 @@
1212
/// A Stream instance represents a queue of sequential, host-asynchronous work
1313
/// to be performed on a device.
1414
///
15-
/// To enqueue work on a device, first create a Executor instance for a
16-
/// given device and then use that Executor to create a Stream instance.
17-
/// The Stream instance will perform its work on the device managed by the
18-
/// Executor that created it.
15+
/// To enqueue work on a device, first create a Device instance then use that
16+
/// Device to create a Stream instance. The Stream instance will perform its
17+
/// work on the device managed by the Device object that created it.
1918
///
2019
/// The various "then" methods of the Stream object, such as thenCopyH2D and
2120
/// thenLaunch, may be used to enqueue work on the Stream, and the
2221
/// blockHostUntilDone() method may be used to block the host code until the
2322
/// Stream has completed all its work.
2423
///
25-
/// Multiple Stream instances can be created for the same Executor. This
26-
/// allows several independent streams of computation to be performed
27-
/// simultaneously on a single device.
24+
/// Multiple Stream instances can be created for the same Device. This allows
25+
/// several independent streams of computation to be performed simultaneously on
26+
/// a single device.
2827
///
2928
//===----------------------------------------------------------------------===//
3029

@@ -94,8 +93,8 @@ class Stream {
9493
const ParameterTs &... Arguments) {
9594
auto ArgumentArray =
9695
make_kernel_argument_pack<ParameterTs...>(Arguments...);
97-
setError(PExecutor->launch(ThePlatformStream.get(), BlockSize, GridSize,
98-
Kernel, ArgumentArray));
96+
setError(PDevice->launch(ThePlatformStream.get(), BlockSize, GridSize,
97+
Kernel, ArgumentArray));
9998
return *this;
10099
}
101100

@@ -105,13 +104,13 @@ class Stream {
105104
/// return without waiting for the operation to complete.
106105
///
107106
/// Any host memory used as a source or destination for one of these
108-
/// operations must be allocated with Executor::allocateHostMemory or
109-
/// registered with Executor::registerHostMemory. Otherwise, the enqueuing
110-
/// operation may block until the copy operation is fully complete.
107+
/// operations must be allocated with Device::allocateHostMemory or registered
108+
/// with Device::registerHostMemory. Otherwise, the enqueuing operation may
109+
/// block until the copy operation is fully complete.
111110
///
112111
/// The arguments and bounds checking for these methods match the API of the
113-
/// \ref ExecutorHostSyncCopyGroup
114-
/// "host-synchronous device memory copying functions" of Executor.
112+
/// \ref DeviceHostSyncCopyGroup
113+
/// "host-synchronous device memory copying functions" of Device.
115114
///@{
116115

117116
template <typename T>
@@ -125,9 +124,9 @@ class Stream {
125124
setError("copying too many elements, " + llvm::Twine(ElementCount) +
126125
", to a host array of element count " + llvm::Twine(Dst.size()));
127126
else
128-
setError(PExecutor->copyD2H(ThePlatformStream.get(), Src.getBaseMemory(),
129-
Src.getElementOffset() * sizeof(T),
130-
Dst.data(), 0, ElementCount * sizeof(T)));
127+
setError(PDevice->copyD2H(ThePlatformStream.get(), Src.getBaseMemory(),
128+
Src.getElementOffset() * sizeof(T), Dst.data(),
129+
0, ElementCount * sizeof(T)));
131130
return *this;
132131
}
133132

@@ -182,7 +181,7 @@ class Stream {
182181
", to a device array of element count " +
183182
llvm::Twine(Dst.getElementCount()));
184183
else
185-
setError(PExecutor->copyH2D(
184+
setError(PDevice->copyH2D(
186185
ThePlatformStream.get(), Src.data(), 0, Dst.getBaseMemory(),
187186
Dst.getElementOffset() * sizeof(T), ElementCount * sizeof(T)));
188187
return *this;
@@ -238,7 +237,7 @@ class Stream {
238237
", to a device array of element count " +
239238
llvm::Twine(Dst.getElementCount()));
240239
else
241-
setError(PExecutor->copyD2D(
240+
setError(PDevice->copyD2D(
242241
ThePlatformStream.get(), Src.getBaseMemory(),
243242
Src.getElementOffset() * sizeof(T), Dst.getBaseMemory(),
244243
Dst.getElementOffset() * sizeof(T), ElementCount * sizeof(T)));
@@ -322,8 +321,8 @@ class Stream {
322321
ErrorMessage = Message.str();
323322
}
324323

325-
/// The PlatformExecutor that supports the operations of this stream.
326-
PlatformExecutor *PExecutor;
324+
/// The PlatformDevice that supports the operations of this stream.
325+
PlatformDevice *PDevice;
327326

328327
/// The platform-specific stream handle for this instance.
329328
std::unique_ptr<PlatformStreamHandle> ThePlatformStream;

‎parallel-libs/streamexecutor/lib/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ add_library(
66
add_library(
77
streamexecutor
88
$<TARGET_OBJECTS:utils>
9-
Executor.cpp
9+
Device.cpp
1010
Kernel.cpp
1111
KernelSpec.cpp
1212
PackedKernelArgumentArray.cpp

‎parallel-libs/streamexecutor/lib/Executor.cpp ‎parallel-libs/streamexecutor/lib/Device.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- Executor.cpp - Executor implementation ----------------------------===//
1+
//===-- Device.cpp - Device implementation --------------------------------===//
22
//
33
// The LLVM Compiler Infrastructure
44
//
@@ -8,11 +8,11 @@
88
//===----------------------------------------------------------------------===//
99
///
1010
/// \file
11-
/// Implementation of Executor class internals.
11+
/// Implementation of Device class internals.
1212
///
1313
//===----------------------------------------------------------------------===//
1414

15-
#include "streamexecutor/Executor.h"
15+
#include "streamexecutor/Device.h"
1616

1717
#include <cassert>
1818

@@ -23,17 +23,17 @@
2323

2424
namespace streamexecutor {
2525

26-
Executor::Executor(PlatformExecutor *PExecutor) : PExecutor(PExecutor) {}
26+
Device::Device(PlatformDevice *PDevice) : PDevice(PDevice) {}
2727

28-
Executor::~Executor() = default;
28+
Device::~Device() = default;
2929

30-
Expected<std::unique_ptr<Stream>> Executor::createStream() {
30+
Expected<std::unique_ptr<Stream>> Device::createStream() {
3131
Expected<std::unique_ptr<PlatformStreamHandle>> MaybePlatformStream =
32-
PExecutor->createStream();
32+
PDevice->createStream();
3333
if (!MaybePlatformStream) {
3434
return MaybePlatformStream.takeError();
3535
}
36-
assert((*MaybePlatformStream)->getExecutor() == PExecutor &&
36+
assert((*MaybePlatformStream)->getDevice() == PDevice &&
3737
"an executor created a stream with a different stored executor");
3838
return llvm::make_unique<Stream>(std::move(*MaybePlatformStream));
3939
}

‎parallel-libs/streamexecutor/lib/Kernel.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,31 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
#include "streamexecutor/Kernel.h"
16-
#include "streamexecutor/Executor.h"
16+
#include "streamexecutor/Device.h"
1717
#include "streamexecutor/PlatformInterfaces.h"
1818

1919
#include "llvm/DebugInfo/Symbolize/Symbolize.h"
2020

2121
namespace streamexecutor {
2222

23-
KernelBase::KernelBase(Executor *ParentExecutor, const std::string &Name,
23+
KernelBase::KernelBase(Device *Dev, const std::string &Name,
2424
const std::string &DemangledName,
2525
std::unique_ptr<KernelInterface> Implementation)
26-
: ParentExecutor(ParentExecutor), Name(Name), DemangledName(DemangledName),
26+
: TheDevice(Dev), Name(Name), DemangledName(DemangledName),
2727
Implementation(std::move(Implementation)) {}
2828

2929
KernelBase::~KernelBase() = default;
3030

31-
Expected<KernelBase> KernelBase::create(Executor *ParentExecutor,
31+
Expected<KernelBase> KernelBase::create(Device *Dev,
3232
const MultiKernelLoaderSpec &Spec) {
33-
auto MaybeImplementation = ParentExecutor->getKernelImplementation(Spec);
33+
auto MaybeImplementation = Dev->getKernelImplementation(Spec);
3434
if (!MaybeImplementation) {
3535
return MaybeImplementation.takeError();
3636
}
3737
std::string Name = Spec.getKernelName();
3838
std::string DemangledName =
3939
llvm::symbolize::LLVMSymbolizer::DemangleName(Name, nullptr);
40-
KernelBase Instance(ParentExecutor, Name, DemangledName,
40+
KernelBase Instance(Dev, Name, DemangledName,
4141
std::move(*MaybeImplementation));
4242
return std::move(Instance);
4343
}

‎parallel-libs/streamexecutor/lib/PlatformInterfaces.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ namespace streamexecutor {
1818

1919
PlatformStreamHandle::~PlatformStreamHandle() = default;
2020

21-
PlatformExecutor::~PlatformExecutor() = default;
21+
PlatformDevice::~PlatformDevice() = default;
2222

2323
} // namespace streamexecutor

‎parallel-libs/streamexecutor/lib/Stream.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
namespace streamexecutor {
1818

1919
Stream::Stream(std::unique_ptr<PlatformStreamHandle> PStream)
20-
: PExecutor(PStream->getExecutor()), ThePlatformStream(std::move(PStream)) {
21-
}
20+
: PDevice(PStream->getDevice()), ThePlatformStream(std::move(PStream)) {}
2221

2322
Stream::~Stream() = default;
2423

‎parallel-libs/streamexecutor/lib/unittests/CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
add_executable(
2-
executor_test
3-
ExecutorTest.cpp)
2+
device_test
3+
DeviceTest.cpp)
44
target_link_libraries(
5-
executor_test
5+
device_test
66
streamexecutor
77
${GTEST_BOTH_LIBRARIES}
88
${CMAKE_THREAD_LIBS_INIT})
9-
add_test(ExecutorTest executor_test)
9+
add_test(DeviceTest device_test)
1010

1111
add_executable(
1212
kernel_test

‎parallel-libs/streamexecutor/lib/unittests/DeviceTest.cpp

+476
Large diffs are not rendered by default.

‎parallel-libs/streamexecutor/lib/unittests/ExecutorTest.cpp

-478
This file was deleted.

‎parallel-libs/streamexecutor/lib/unittests/KernelTest.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <cassert>
1616

17-
#include "streamexecutor/Executor.h"
17+
#include "streamexecutor/Device.h"
1818
#include "streamexecutor/Kernel.h"
1919
#include "streamexecutor/KernelSpec.h"
2020
#include "streamexecutor/PlatformInterfaces.h"
@@ -27,7 +27,7 @@ namespace {
2727

2828
namespace se = ::streamexecutor;
2929

30-
// An Executor that returns a dummy KernelInterface.
30+
// A Device that returns a dummy KernelInterface.
3131
//
3232
// During construction it creates a unique_ptr to a dummy KernelInterface and it
3333
// also stores a separate copy of the raw pointer that is stored by that
@@ -39,10 +39,10 @@ namespace se = ::streamexecutor;
3939
// object. The raw pointer copy can then be used to identify the unique_ptr in
4040
// its new location (by comparing the raw pointer with unique_ptr::get), to
4141
// verify that the unique_ptr ended up where it was supposed to be.
42-
class MockExecutor : public se::Executor {
42+
class MockDevice : public se::Device {
4343
public:
44-
MockExecutor()
45-
: se::Executor(nullptr), Unique(llvm::make_unique<se::KernelInterface>()),
44+
MockDevice()
45+
: se::Device(nullptr), Unique(llvm::make_unique<se::KernelInterface>()),
4646
Raw(Unique.get()) {}
4747

4848
// Moves the unique pointer into the returned se::Expected instance.
@@ -51,7 +51,7 @@ class MockExecutor : public se::Executor {
5151
// out.
5252
se::Expected<std::unique_ptr<se::KernelInterface>>
5353
getKernelImplementation(const se::MultiKernelLoaderSpec &) override {
54-
assert(Unique && "MockExecutor getKernelImplementation should not be "
54+
assert(Unique && "MockDevice getKernelImplementation should not be "
5555
"called more than once");
5656
return std::move(Unique);
5757
}
@@ -79,15 +79,15 @@ TYPED_TEST_CASE(GetImplementationTest, GetImplementationTypes);
7979

8080
// Tests that the kernel create functions properly fetch the implementation
8181
// pointers for the kernel objects they construct from the passed-in
82-
// Executor objects.
82+
// Device objects.
8383
TYPED_TEST(GetImplementationTest, SetImplementationDuringCreate) {
8484
se::MultiKernelLoaderSpec Spec;
85-
MockExecutor MockExecutor;
85+
MockDevice Dev;
8686

87-
auto MaybeKernel = TypeParam::create(&MockExecutor, Spec);
87+
auto MaybeKernel = TypeParam::create(&Dev, Spec);
8888
EXPECT_TRUE(static_cast<bool>(MaybeKernel));
8989
se::KernelInterface *Implementation = MaybeKernel->getImplementation();
90-
EXPECT_EQ(MockExecutor.getRaw(), Implementation);
90+
EXPECT_EQ(Dev.getRaw(), Implementation);
9191
}
9292

9393
} // namespace

‎parallel-libs/streamexecutor/lib/unittests/StreamTest.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <cstring>
1616

17-
#include "streamexecutor/Executor.h"
17+
#include "streamexecutor/Device.h"
1818
#include "streamexecutor/Kernel.h"
1919
#include "streamexecutor/KernelSpec.h"
2020
#include "streamexecutor/PlatformInterfaces.h"
@@ -26,14 +26,14 @@ namespace {
2626

2727
namespace se = ::streamexecutor;
2828

29-
/// Mock PlatformExecutor that performs asynchronous memcpy operations by
29+
/// Mock PlatformDevice that performs asynchronous memcpy operations by
3030
/// ignoring the stream argument and calling std::memcpy on device memory
3131
/// handles.
32-
class MockPlatformExecutor : public se::PlatformExecutor {
32+
class MockPlatformDevice : public se::PlatformDevice {
3333
public:
34-
~MockPlatformExecutor() override {}
34+
~MockPlatformDevice() override {}
3535

36-
std::string getName() const override { return "MockPlatformExecutor"; }
36+
std::string getName() const override { return "MockPlatformDevice"; }
3737

3838
se::Expected<std::unique_ptr<se::PlatformStreamHandle>>
3939
createStream() override {
@@ -83,7 +83,7 @@ class StreamTest : public ::testing::Test {
8383
DeviceA7(se::GlobalDeviceMemory<int>::makeFromElementCount(HostA7, 7)),
8484
DeviceB7(se::GlobalDeviceMemory<int>::makeFromElementCount(HostB7, 7)),
8585
Host5{24, 25, 26, 27, 28}, Host7{29, 30, 31, 32, 33, 34, 35},
86-
Stream(llvm::make_unique<se::PlatformStreamHandle>(&PExecutor)) {}
86+
Stream(llvm::make_unique<se::PlatformStreamHandle>(&PDevice)) {}
8787

8888
protected:
8989
// Device memory is backed by host arrays.
@@ -100,7 +100,7 @@ class StreamTest : public ::testing::Test {
100100
int Host5[5];
101101
int Host7[7];
102102

103-
MockPlatformExecutor PExecutor;
103+
MockPlatformDevice PDevice;
104104
se::Stream Stream;
105105
};
106106

0 commit comments

Comments
 (0)
Please sign in to comment.