[Parallel_libs-commits] [parallel-libs] r278833 - [StreamExecutor] Rename StreamExecutor to Executor

Jason Henline via Parallel_libs-commits parallel_libs-commits at lists.llvm.org
Tue Aug 16 11:18:33 PDT 2016


Author: jhen
Date: Tue Aug 16 13:18:32 2016
New Revision: 278833

URL: http://llvm.org/viewvc/llvm-project?rev=278833&view=rev
Log:
[StreamExecutor] Rename StreamExecutor to Executor

Summary: No functional changes just renaming this class for better readability.

Reviewers: jlebar

Subscribers: jprice, parallel_libs-commits

Differential Revision: https://reviews.llvm.org/D23574

Added:
    parallel-libs/trunk/streamexecutor/include/streamexecutor/Executor.h
      - copied, changed from r278829, parallel-libs/trunk/streamexecutor/include/streamexecutor/StreamExecutor.h
    parallel-libs/trunk/streamexecutor/lib/Executor.cpp
      - copied, changed from r278829, parallel-libs/trunk/streamexecutor/lib/StreamExecutor.cpp
Removed:
    parallel-libs/trunk/streamexecutor/include/streamexecutor/StreamExecutor.h
    parallel-libs/trunk/streamexecutor/lib/StreamExecutor.cpp
Modified:
    parallel-libs/trunk/streamexecutor/include/streamexecutor/Kernel.h
    parallel-libs/trunk/streamexecutor/include/streamexecutor/PlatformInterfaces.h
    parallel-libs/trunk/streamexecutor/include/streamexecutor/Stream.h
    parallel-libs/trunk/streamexecutor/lib/CMakeLists.txt
    parallel-libs/trunk/streamexecutor/lib/Kernel.cpp
    parallel-libs/trunk/streamexecutor/lib/PlatformInterfaces.cpp
    parallel-libs/trunk/streamexecutor/lib/Stream.cpp
    parallel-libs/trunk/streamexecutor/lib/unittests/KernelTest.cpp
    parallel-libs/trunk/streamexecutor/lib/unittests/StreamTest.cpp

Copied: parallel-libs/trunk/streamexecutor/include/streamexecutor/Executor.h (from r278829, parallel-libs/trunk/streamexecutor/include/streamexecutor/StreamExecutor.h)
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/include/streamexecutor/Executor.h?p2=parallel-libs/trunk/streamexecutor/include/streamexecutor/Executor.h&p1=parallel-libs/trunk/streamexecutor/include/streamexecutor/StreamExecutor.h&r1=278829&r2=278833&rev=278833&view=diff
==============================================================================
--- parallel-libs/trunk/streamexecutor/include/streamexecutor/StreamExecutor.h (original)
+++ parallel-libs/trunk/streamexecutor/include/streamexecutor/Executor.h Tue Aug 16 13:18:32 2016
@@ -1,4 +1,4 @@
-//===-- StreamExecutor.h - The StreamExecutor class -------------*- C++ -*-===//
+//===-- Executor.h - The Executor class -------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -8,13 +8,12 @@
 //===----------------------------------------------------------------------===//
 ///
 /// \file
-/// The StreamExecutor class which represents a single device of a specific
-/// platform.
+/// The Executor class which represents a single device of a specific platform.
 ///
 //===----------------------------------------------------------------------===//
 
-#ifndef STREAMEXECUTOR_STREAMEXECUTOR_H
-#define STREAMEXECUTOR_STREAMEXECUTOR_H
+#ifndef STREAMEXECUTOR_EXECUTOR_H
+#define STREAMEXECUTOR_EXECUTOR_H
 
 #include "streamexecutor/KernelSpec.h"
 #include "streamexecutor/Utils/Error.h"
@@ -22,13 +21,13 @@
 namespace streamexecutor {
 
 class KernelInterface;
-class PlatformStreamExecutor;
+class PlatformExecutor;
 class Stream;
 
-class StreamExecutor {
+class Executor {
 public:
-  explicit StreamExecutor(PlatformStreamExecutor *PlatformExecutor);
-  virtual ~StreamExecutor();
+  explicit Executor(PlatformExecutor *PExecutor);
+  virtual ~Executor();
 
   /// Gets the kernel implementation for the underlying platform.
   virtual Expected<std::unique_ptr<KernelInterface>>
@@ -40,9 +39,9 @@ public:
   Expected<std::unique_ptr<Stream>> createStream();
 
 private:
-  PlatformStreamExecutor *PlatformExecutor;
+  PlatformExecutor *PExecutor;
 };
 
 } // namespace streamexecutor
 
-#endif // STREAMEXECUTOR_STREAMEXECUTOR_H
+#endif // STREAMEXECUTOR_EXECUTOR_H

Modified: parallel-libs/trunk/streamexecutor/include/streamexecutor/Kernel.h
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/include/streamexecutor/Kernel.h?rev=278833&r1=278832&r2=278833&view=diff
==============================================================================
--- parallel-libs/trunk/streamexecutor/include/streamexecutor/Kernel.h (original)
+++ parallel-libs/trunk/streamexecutor/include/streamexecutor/Kernel.h Tue Aug 16 13:18:32 2016
@@ -84,8 +84,8 @@
 
 namespace streamexecutor {
 
+class Executor;
 class KernelInterface;
-class StreamExecutor;
 
 /// The base class for device kernel functions.
 ///
@@ -100,13 +100,13 @@ public:
   KernelBase &operator=(KernelBase &&) = default;
   ~KernelBase();
 
-  /// Creates a kernel object from a StreamExecutor and a MultiKernelLoaderSpec.
+  /// Creates a kernel object from an Executor and a MultiKernelLoaderSpec.
   ///
-  /// The StreamExecutor knows which platform it belongs to and the
+  /// The Executor knows which platform it belongs to and the
   /// MultiKernelLoaderSpec knows how to find the kernel code for different
   /// platforms, so the combined information is enough to get the kernel code
   /// for the appropriate platform.
-  static Expected<KernelBase> create(StreamExecutor *ParentExecutor,
+  static Expected<KernelBase> create(Executor *ParentExecutor,
                                      const MultiKernelLoaderSpec &Spec);
 
   const std::string &getName() const { return Name; }
@@ -116,11 +116,11 @@ public:
   KernelInterface *getImplementation() { return Implementation.get(); }
 
 private:
-  KernelBase(StreamExecutor *ParentExecutor, const std::string &Name,
+  KernelBase(Executor *ParentExecutor, const std::string &Name,
              const std::string &DemangledName,
              std::unique_ptr<KernelInterface> Implementation);
 
-  StreamExecutor *ParentExecutor;
+  Executor *ParentExecutor;
   std::string Name;
   std::string DemangledName;
   std::unique_ptr<KernelInterface> Implementation;
@@ -136,7 +136,7 @@ public:
   TypedKernel &operator=(TypedKernel &&) = default;
 
   /// Parameters here have the same meaning as in KernelBase::create.
-  static Expected<TypedKernel> create(StreamExecutor *ParentExecutor,
+  static Expected<TypedKernel> create(Executor *ParentExecutor,
                                       const MultiKernelLoaderSpec &Spec) {
     auto MaybeBase = KernelBase::create(ParentExecutor, Spec);
     if (!MaybeBase) {

Modified: parallel-libs/trunk/streamexecutor/include/streamexecutor/PlatformInterfaces.h
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/include/streamexecutor/PlatformInterfaces.h?rev=278833&r1=278832&r2=278833&view=diff
==============================================================================
--- parallel-libs/trunk/streamexecutor/include/streamexecutor/PlatformInterfaces.h (original)
+++ parallel-libs/trunk/streamexecutor/include/streamexecutor/PlatformInterfaces.h Tue Aug 16 13:18:32 2016
@@ -31,7 +31,7 @@
 
 namespace streamexecutor {
 
-class PlatformStreamExecutor;
+class PlatformExecutor;
 
 /// Methods supported by device kernel function objects on all platforms.
 class KernelInterface {
@@ -41,15 +41,15 @@ class KernelInterface {
 /// Platform-specific stream handle.
 class PlatformStreamHandle {
 public:
-  explicit PlatformStreamHandle(PlatformStreamExecutor *Executor)
-      : Executor(Executor) {}
+  explicit PlatformStreamHandle(PlatformExecutor *PExecutor)
+      : PExecutor(PExecutor) {}
 
   virtual ~PlatformStreamHandle();
 
-  PlatformStreamExecutor *getExecutor() { return Executor; }
+  PlatformExecutor *getExecutor() { return PExecutor; }
 
 private:
-  PlatformStreamExecutor *Executor;
+  PlatformExecutor *PExecutor;
 };
 
 /// Raw executor methods that must be implemented by each platform.
@@ -57,11 +57,11 @@ private:
 /// This class defines the platform interface that supports executing work on a
 /// device.
 ///
-/// The public StreamExecutor and Stream classes have the type-safe versions of
-/// the functions in this interface.
-class PlatformStreamExecutor {
+/// The public Executor and Stream classes have the type-safe versions of the
+/// functions in this interface.
+class PlatformExecutor {
 public:
-  virtual ~PlatformStreamExecutor();
+  virtual ~PlatformExecutor();
 
   virtual std::string getName() const = 0;
 

Modified: parallel-libs/trunk/streamexecutor/include/streamexecutor/Stream.h
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/include/streamexecutor/Stream.h?rev=278833&r1=278832&r2=278833&view=diff
==============================================================================
--- parallel-libs/trunk/streamexecutor/include/streamexecutor/Stream.h (original)
+++ parallel-libs/trunk/streamexecutor/include/streamexecutor/Stream.h Tue Aug 16 13:18:32 2016
@@ -12,17 +12,17 @@
 /// A Stream instance represents a queue of sequential, host-asynchronous work
 /// to be performed on a device.
 ///
-/// To enqueue work on a device, first create a StreamExecutor instance for a
-/// given device and then use that StreamExecutor to create a Stream instance.
+/// To enqueue work on a device, first create a Executor instance for a
+/// given device and then use that Executor to create a Stream instance.
 /// The Stream instance will perform its work on the device managed by the
-/// StreamExecutor that created it.
+/// Executor that created it.
 ///
 /// The various "then" methods of the Stream object, such as thenMemcpyH2D and
 /// thenLaunch, may be used to enqueue work on the Stream, and the
 /// blockHostUntilDone() method may be used to block the host code until the
 /// Stream has completed all its work.
 ///
-/// Multiple Stream instances can be created for the same StreamExecutor. This
+/// Multiple Stream instances can be created for the same Executor. This
 /// allows several independent streams of computation to be performed
 /// simultaneously on a single device.
 ///
@@ -94,8 +94,8 @@ public:
                      const ParameterTs &... Arguments) {
     auto ArgumentArray =
         make_kernel_argument_pack<ParameterTs...>(Arguments...);
-    setError(PlatformExecutor->launch(ThePlatformStream.get(), BlockSize,
-                                      GridSize, Kernel, ArgumentArray));
+    setError(PExecutor->launch(ThePlatformStream.get(), BlockSize, GridSize,
+                               Kernel, ArgumentArray));
     return *this;
   }
 
@@ -103,8 +103,8 @@ public:
   /// device source to a host destination.
   ///
   /// HostDst must be a pointer to host memory allocated by
-  /// StreamExecutor::allocateHostMemory or otherwise allocated and then
-  /// registered with StreamExecutor::registerHostMemory.
+  /// Executor::allocateHostMemory or otherwise allocated and then
+  /// registered with Executor::registerHostMemory.
   template <typename T>
   Stream &thenMemcpyD2H(const GlobalDeviceMemory<T> &DeviceSrc,
                         llvm::MutableArrayRef<T> HostDst, size_t ElementCount) {
@@ -116,9 +116,8 @@ public:
       setError("copying too many elements, " + llvm::Twine(ElementCount) +
                ", to host array of size " + llvm::Twine(HostDst.size()));
     else
-      setError(PlatformExecutor->memcpyD2H(ThePlatformStream.get(), DeviceSrc,
-                                           HostDst.data(),
-                                           ElementCount * sizeof(T)));
+      setError(PExecutor->memcpyD2H(ThePlatformStream.get(), DeviceSrc,
+                                    HostDst.data(), ElementCount * sizeof(T)));
     return *this;
   }
 
@@ -134,8 +133,8 @@ public:
   /// source to a device destination.
   ///
   /// HostSrc must be a pointer to host memory allocated by
-  /// StreamExecutor::allocateHostMemory or otherwise allocated and then
-  /// registered with StreamExecutor::registerHostMemory.
+  /// Executor::allocateHostMemory or otherwise allocated and then
+  /// registered with Executor::registerHostMemory.
   template <typename T>
   Stream &thenMemcpyH2D(llvm::ArrayRef<T> HostSrc,
                         GlobalDeviceMemory<T> *DeviceDst, size_t ElementCount) {
@@ -147,9 +146,8 @@ public:
                ", to device memory array of size " +
                llvm::Twine(DeviceDst->getElementCount()));
     else
-      setError(PlatformExecutor->memcpyH2D(ThePlatformStream.get(),
-                                           HostSrc.data(), DeviceDst,
-                                           ElementCount * sizeof(T)));
+      setError(PExecutor->memcpyH2D(ThePlatformStream.get(), HostSrc.data(),
+                                    DeviceDst, ElementCount * sizeof(T)));
     return *this;
   }
 
@@ -175,9 +173,8 @@ public:
                ", to device memory array of size " +
                llvm::Twine(DeviceDst->getElementCount()));
     else
-      setError(PlatformExecutor->memcpyD2D(ThePlatformStream.get(), DeviceSrc,
-                                           DeviceDst,
-                                           ElementCount * sizeof(T)));
+      setError(PExecutor->memcpyD2D(ThePlatformStream.get(), DeviceSrc,
+                                    DeviceDst, ElementCount * sizeof(T)));
     return *this;
   }
 
@@ -194,7 +191,7 @@ public:
   ///
   /// Returns true if there are no errors on the stream.
   bool blockHostUntilDone() {
-    Error E = PlatformExecutor->blockHostUntilDone(ThePlatformStream.get());
+    Error E = PExecutor->blockHostUntilDone(ThePlatformStream.get());
     bool returnValue = static_cast<bool>(E);
     setError(std::move(E));
     return returnValue;
@@ -221,8 +218,8 @@ private:
       ErrorMessage = Message.str();
   }
 
-  /// The PlatformStreamExecutor that supports the operations of this stream.
-  PlatformStreamExecutor *PlatformExecutor;
+  /// The PlatformExecutor that supports the operations of this stream.
+  PlatformExecutor *PExecutor;
 
   /// The platform-specific stream handle for this instance.
   std::unique_ptr<PlatformStreamHandle> ThePlatformStream;

Removed: parallel-libs/trunk/streamexecutor/include/streamexecutor/StreamExecutor.h
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/include/streamexecutor/StreamExecutor.h?rev=278832&view=auto
==============================================================================
--- parallel-libs/trunk/streamexecutor/include/streamexecutor/StreamExecutor.h (original)
+++ parallel-libs/trunk/streamexecutor/include/streamexecutor/StreamExecutor.h (removed)
@@ -1,48 +0,0 @@
-//===-- StreamExecutor.h - The StreamExecutor class -------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-///
-/// \file
-/// The StreamExecutor class which represents a single device of a specific
-/// platform.
-///
-//===----------------------------------------------------------------------===//
-
-#ifndef STREAMEXECUTOR_STREAMEXECUTOR_H
-#define STREAMEXECUTOR_STREAMEXECUTOR_H
-
-#include "streamexecutor/KernelSpec.h"
-#include "streamexecutor/Utils/Error.h"
-
-namespace streamexecutor {
-
-class KernelInterface;
-class PlatformStreamExecutor;
-class Stream;
-
-class StreamExecutor {
-public:
-  explicit StreamExecutor(PlatformStreamExecutor *PlatformExecutor);
-  virtual ~StreamExecutor();
-
-  /// Gets the kernel implementation for the underlying platform.
-  virtual Expected<std::unique_ptr<KernelInterface>>
-  getKernelImplementation(const MultiKernelLoaderSpec &Spec) {
-    // TODO(jhen): Implement this.
-    return nullptr;
-  }
-
-  Expected<std::unique_ptr<Stream>> createStream();
-
-private:
-  PlatformStreamExecutor *PlatformExecutor;
-};
-
-} // namespace streamexecutor
-
-#endif // STREAMEXECUTOR_STREAMEXECUTOR_H

Modified: parallel-libs/trunk/streamexecutor/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/lib/CMakeLists.txt?rev=278833&r1=278832&r2=278833&view=diff
==============================================================================
--- parallel-libs/trunk/streamexecutor/lib/CMakeLists.txt (original)
+++ parallel-libs/trunk/streamexecutor/lib/CMakeLists.txt Tue Aug 16 13:18:32 2016
@@ -6,12 +6,12 @@ add_library(
 add_library(
     streamexecutor
     $<TARGET_OBJECTS:utils>
+    Executor.cpp
     Kernel.cpp
     KernelSpec.cpp
     PackedKernelArgumentArray.cpp
     PlatformInterfaces.cpp
-    Stream.cpp
-    StreamExecutor.cpp)
+    Stream.cpp)
 target_link_libraries(streamexecutor ${llvm_libs})
 
 if(STREAM_EXECUTOR_UNIT_TESTS)

Copied: parallel-libs/trunk/streamexecutor/lib/Executor.cpp (from r278829, parallel-libs/trunk/streamexecutor/lib/StreamExecutor.cpp)
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/lib/Executor.cpp?p2=parallel-libs/trunk/streamexecutor/lib/Executor.cpp&p1=parallel-libs/trunk/streamexecutor/lib/StreamExecutor.cpp&r1=278829&r2=278833&rev=278833&view=diff
==============================================================================
--- parallel-libs/trunk/streamexecutor/lib/StreamExecutor.cpp (original)
+++ parallel-libs/trunk/streamexecutor/lib/Executor.cpp Tue Aug 16 13:18:32 2016
@@ -1,4 +1,4 @@
-//===-- StreamExecutor.cpp - StreamExecutor implementation ----------------===//
+//===-- Executor.cpp - Executor implementation ----------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -8,11 +8,11 @@
 //===----------------------------------------------------------------------===//
 ///
 /// \file
-/// Implementation of StreamExecutor class internals.
+/// Implementation of Executor class internals.
 ///
 //===----------------------------------------------------------------------===//
 
-#include "streamexecutor/StreamExecutor.h"
+#include "streamexecutor/Executor.h"
 
 #include <cassert>
 
@@ -23,18 +23,17 @@
 
 namespace streamexecutor {
 
-StreamExecutor::StreamExecutor(PlatformStreamExecutor *PlatformExecutor)
-    : PlatformExecutor(PlatformExecutor) {}
+Executor::Executor(PlatformExecutor *PExecutor) : PExecutor(PExecutor) {}
 
-StreamExecutor::~StreamExecutor() = default;
+Executor::~Executor() = default;
 
-Expected<std::unique_ptr<Stream>> StreamExecutor::createStream() {
+Expected<std::unique_ptr<Stream>> Executor::createStream() {
   Expected<std::unique_ptr<PlatformStreamHandle>> MaybePlatformStream =
-      PlatformExecutor->createStream();
+      PExecutor->createStream();
   if (!MaybePlatformStream) {
     return MaybePlatformStream.takeError();
   }
-  assert((*MaybePlatformStream)->getExecutor() == PlatformExecutor &&
+  assert((*MaybePlatformStream)->getExecutor() == PExecutor &&
          "an executor created a stream with a different stored executor");
   return llvm::make_unique<Stream>(std::move(*MaybePlatformStream));
 }

Modified: parallel-libs/trunk/streamexecutor/lib/Kernel.cpp
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/lib/Kernel.cpp?rev=278833&r1=278832&r2=278833&view=diff
==============================================================================
--- parallel-libs/trunk/streamexecutor/lib/Kernel.cpp (original)
+++ parallel-libs/trunk/streamexecutor/lib/Kernel.cpp Tue Aug 16 13:18:32 2016
@@ -13,14 +13,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "streamexecutor/Kernel.h"
+#include "streamexecutor/Executor.h"
 #include "streamexecutor/PlatformInterfaces.h"
-#include "streamexecutor/StreamExecutor.h"
 
 #include "llvm/DebugInfo/Symbolize/Symbolize.h"
 
 namespace streamexecutor {
 
-KernelBase::KernelBase(StreamExecutor *ParentExecutor, const std::string &Name,
+KernelBase::KernelBase(Executor *ParentExecutor, const std::string &Name,
                        const std::string &DemangledName,
                        std::unique_ptr<KernelInterface> Implementation)
     : ParentExecutor(ParentExecutor), Name(Name), DemangledName(DemangledName),
@@ -28,7 +28,7 @@ KernelBase::KernelBase(StreamExecutor *P
 
 KernelBase::~KernelBase() = default;
 
-Expected<KernelBase> KernelBase::create(StreamExecutor *ParentExecutor,
+Expected<KernelBase> KernelBase::create(Executor *ParentExecutor,
                                         const MultiKernelLoaderSpec &Spec) {
   auto MaybeImplementation = ParentExecutor->getKernelImplementation(Spec);
   if (!MaybeImplementation) {

Modified: parallel-libs/trunk/streamexecutor/lib/PlatformInterfaces.cpp
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/lib/PlatformInterfaces.cpp?rev=278833&r1=278832&r2=278833&view=diff
==============================================================================
--- parallel-libs/trunk/streamexecutor/lib/PlatformInterfaces.cpp (original)
+++ parallel-libs/trunk/streamexecutor/lib/PlatformInterfaces.cpp Tue Aug 16 13:18:32 2016
@@ -18,6 +18,6 @@ namespace streamexecutor {
 
 PlatformStreamHandle::~PlatformStreamHandle() = default;
 
-PlatformStreamExecutor::~PlatformStreamExecutor() = default;
+PlatformExecutor::~PlatformExecutor() = default;
 
 } // namespace streamexecutor

Modified: parallel-libs/trunk/streamexecutor/lib/Stream.cpp
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/lib/Stream.cpp?rev=278833&r1=278832&r2=278833&view=diff
==============================================================================
--- parallel-libs/trunk/streamexecutor/lib/Stream.cpp (original)
+++ parallel-libs/trunk/streamexecutor/lib/Stream.cpp Tue Aug 16 13:18:32 2016
@@ -17,8 +17,8 @@
 namespace streamexecutor {
 
 Stream::Stream(std::unique_ptr<PlatformStreamHandle> PStream)
-    : PlatformExecutor(PStream->getExecutor()),
-      ThePlatformStream(std::move(PStream)) {}
+    : PExecutor(PStream->getExecutor()), ThePlatformStream(std::move(PStream)) {
+}
 
 Stream::~Stream() = default;
 

Removed: parallel-libs/trunk/streamexecutor/lib/StreamExecutor.cpp
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/lib/StreamExecutor.cpp?rev=278832&view=auto
==============================================================================
--- parallel-libs/trunk/streamexecutor/lib/StreamExecutor.cpp (original)
+++ parallel-libs/trunk/streamexecutor/lib/StreamExecutor.cpp (removed)
@@ -1,42 +0,0 @@
-//===-- StreamExecutor.cpp - StreamExecutor 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 StreamExecutor class internals.
-///
-//===----------------------------------------------------------------------===//
-
-#include "streamexecutor/StreamExecutor.h"
-
-#include <cassert>
-
-#include "streamexecutor/PlatformInterfaces.h"
-#include "streamexecutor/Stream.h"
-
-#include "llvm/ADT/STLExtras.h"
-
-namespace streamexecutor {
-
-StreamExecutor::StreamExecutor(PlatformStreamExecutor *PlatformExecutor)
-    : PlatformExecutor(PlatformExecutor) {}
-
-StreamExecutor::~StreamExecutor() = default;
-
-Expected<std::unique_ptr<Stream>> StreamExecutor::createStream() {
-  Expected<std::unique_ptr<PlatformStreamHandle>> MaybePlatformStream =
-      PlatformExecutor->createStream();
-  if (!MaybePlatformStream) {
-    return MaybePlatformStream.takeError();
-  }
-  assert((*MaybePlatformStream)->getExecutor() == PlatformExecutor &&
-         "an executor created a stream with a different stored executor");
-  return llvm::make_unique<Stream>(std::move(*MaybePlatformStream));
-}
-
-} // namespace streamexecutor

Modified: parallel-libs/trunk/streamexecutor/lib/unittests/KernelTest.cpp
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/lib/unittests/KernelTest.cpp?rev=278833&r1=278832&r2=278833&view=diff
==============================================================================
--- parallel-libs/trunk/streamexecutor/lib/unittests/KernelTest.cpp (original)
+++ parallel-libs/trunk/streamexecutor/lib/unittests/KernelTest.cpp Tue Aug 16 13:18:32 2016
@@ -14,10 +14,10 @@
 
 #include <cassert>
 
+#include "streamexecutor/Executor.h"
 #include "streamexecutor/Kernel.h"
 #include "streamexecutor/KernelSpec.h"
 #include "streamexecutor/PlatformInterfaces.h"
-#include "streamexecutor/StreamExecutor.h"
 
 #include "llvm/ADT/STLExtras.h"
 
@@ -27,7 +27,7 @@ namespace {
 
 namespace se = ::streamexecutor;
 
-// A StreamExecutor that returns a dummy KernelInterface.
+// An Executor that returns a dummy KernelInterface.
 //
 // During construction it creates a unique_ptr to a dummy KernelInterface and it
 // also stores a separate copy of the raw pointer that is stored by that
@@ -39,11 +39,11 @@ namespace se = ::streamexecutor;
 // object. The raw pointer copy can then be used to identify the unique_ptr in
 // its new location (by comparing the raw pointer with unique_ptr::get), to
 // verify that the unique_ptr ended up where it was supposed to be.
-class MockStreamExecutor : public se::StreamExecutor {
+class MockExecutor : public se::Executor {
 public:
-  MockStreamExecutor()
-      : se::StreamExecutor(nullptr),
-        Unique(llvm::make_unique<se::KernelInterface>()), Raw(Unique.get()) {}
+  MockExecutor()
+      : se::Executor(nullptr), Unique(llvm::make_unique<se::KernelInterface>()),
+        Raw(Unique.get()) {}
 
   // Moves the unique pointer into the returned se::Expected instance.
   //
@@ -51,7 +51,7 @@ public:
   // out.
   se::Expected<std::unique_ptr<se::KernelInterface>>
   getKernelImplementation(const se::MultiKernelLoaderSpec &) override {
-    assert(Unique && "MockStreamExecutor getKernelImplementation should not be "
+    assert(Unique && "MockExecutor getKernelImplementation should not be "
                      "called more than once");
     return std::move(Unique);
   }
@@ -79,10 +79,10 @@ TYPED_TEST_CASE(GetImplementationTest, G
 
 // Tests that the kernel create functions properly fetch the implementation
 // pointers for the kernel objects they construct from the passed-in
-// StreamExecutor objects.
+// Executor objects.
 TYPED_TEST(GetImplementationTest, SetImplementationDuringCreate) {
   se::MultiKernelLoaderSpec Spec;
-  MockStreamExecutor MockExecutor;
+  MockExecutor MockExecutor;
 
   auto MaybeKernel = TypeParam::create(&MockExecutor, Spec);
   EXPECT_TRUE(static_cast<bool>(MaybeKernel));

Modified: parallel-libs/trunk/streamexecutor/lib/unittests/StreamTest.cpp
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/lib/unittests/StreamTest.cpp?rev=278833&r1=278832&r2=278833&view=diff
==============================================================================
--- parallel-libs/trunk/streamexecutor/lib/unittests/StreamTest.cpp (original)
+++ parallel-libs/trunk/streamexecutor/lib/unittests/StreamTest.cpp Tue Aug 16 13:18:32 2016
@@ -14,11 +14,11 @@
 
 #include <cstring>
 
+#include "streamexecutor/Executor.h"
 #include "streamexecutor/Kernel.h"
 #include "streamexecutor/KernelSpec.h"
 #include "streamexecutor/PlatformInterfaces.h"
 #include "streamexecutor/Stream.h"
-#include "streamexecutor/StreamExecutor.h"
 
 #include "gtest/gtest.h"
 
@@ -26,14 +26,14 @@ namespace {
 
 namespace se = ::streamexecutor;
 
-/// Mock PlatformStreamExecutor that performs asynchronous memcpy operations by
+/// Mock PlatformExecutor that performs asynchronous memcpy operations by
 /// ignoring the stream argument and calling std::memcpy on device memory
 /// handles.
-class MockPlatformStreamExecutor : public se::PlatformStreamExecutor {
+class MockPlatformExecutor : public se::PlatformExecutor {
 public:
-  ~MockPlatformStreamExecutor() override {}
+  ~MockPlatformExecutor() override {}
 
-  std::string getName() const override { return "MockPlatformStreamExecutor"; }
+  std::string getName() const override { return "MockPlatformExecutor"; }
 
   se::Expected<std::unique_ptr<se::PlatformStreamHandle>>
   createStream() override {
@@ -70,8 +70,7 @@ public:
   StreamTest()
       : DeviceA(se::GlobalDeviceMemory<int>::makeFromElementCount(HostA, 10)),
         DeviceB(se::GlobalDeviceMemory<int>::makeFromElementCount(HostB, 10)),
-        Stream(llvm::make_unique<se::PlatformStreamHandle>(&PlatformExecutor)) {
-  }
+        Stream(llvm::make_unique<se::PlatformStreamHandle>(&PExecutor)) {}
 
 protected:
   // Device memory is backed by host arrays.
@@ -83,7 +82,7 @@ protected:
   // Host memory to be used as actual host memory.
   int Host[10];
 
-  MockPlatformStreamExecutor PlatformExecutor;
+  MockPlatformExecutor PExecutor;
   se::Stream Stream;
 };
 




More information about the Parallel_libs-commits mailing list