mirror of
https://github.com/intel/llvm.git
synced 2026-01-18 16:50:51 +08:00
Summary: Add the Stream class and a few of the operations it supports. Reviewers: jlebar, tra Subscribers: jprice, parallel_libs-commits Differential Revision: https://reviews.llvm.org/D23333 llvm-svn: 278829
46 lines
1.7 KiB
C++
46 lines
1.7 KiB
C++
//===-- Kernel.cpp - General kernel implementation ------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
///
|
|
/// \file
|
|
/// This file contains the implementation details for kernel types.
|
|
///
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "streamexecutor/Kernel.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,
|
|
const std::string &DemangledName,
|
|
std::unique_ptr<KernelInterface> Implementation)
|
|
: ParentExecutor(ParentExecutor), Name(Name), DemangledName(DemangledName),
|
|
Implementation(std::move(Implementation)) {}
|
|
|
|
KernelBase::~KernelBase() = default;
|
|
|
|
Expected<KernelBase> KernelBase::create(StreamExecutor *ParentExecutor,
|
|
const MultiKernelLoaderSpec &Spec) {
|
|
auto MaybeImplementation = ParentExecutor->getKernelImplementation(Spec);
|
|
if (!MaybeImplementation) {
|
|
return MaybeImplementation.takeError();
|
|
}
|
|
std::string Name = Spec.getKernelName();
|
|
std::string DemangledName =
|
|
llvm::symbolize::LLVMSymbolizer::DemangleName(Name, nullptr);
|
|
KernelBase Instance(ParentExecutor, Name, DemangledName,
|
|
std::move(*MaybeImplementation));
|
|
return std::move(Instance);
|
|
}
|
|
|
|
} // namespace streamexecutor
|