-
Notifications
You must be signed in to change notification settings - Fork 738
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL][Fusion][NoSTL][NFC] Move SYCLModuleInfo to its own header (#12413
) Move `SYCLModuleInfo` class to its own header under the `common` directory (because it has users from `jit-compiler` and `passes`). _This PR is part of a series of changes to remove uses of STL classes in the kernel fusion interface to prevent ABI issues in the future._ Signed-off-by: Julian Oppermann <julian.oppermann@codeplay.com>
- Loading branch information
Showing
5 changed files
with
54 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//==------------ ModuleInfo.h - Manages kernel info for the JIT ------------==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef SYCL_FUSION_COMMON_MODULEINFO_H | ||
#define SYCL_FUSION_COMMON_MODULEINFO_H | ||
|
||
#include "Kernel.h" | ||
|
||
#include <algorithm> | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace jit_compiler { | ||
|
||
/// | ||
/// Represents a SPIR-V translation unit containing SYCL kernels by the | ||
/// KernelInfo for each of the contained kernels. | ||
class SYCLModuleInfo { | ||
public: | ||
using KernelInfoList = std::vector<SYCLKernelInfo>; | ||
|
||
void addKernel(SYCLKernelInfo &Kernel) { Kernels.push_back(Kernel); } | ||
|
||
KernelInfoList &kernels() { return Kernels; } | ||
|
||
bool hasKernelFor(const std::string &KernelName) { | ||
return getKernelFor(KernelName) != nullptr; | ||
} | ||
|
||
SYCLKernelInfo *getKernelFor(const std::string &KernelName) { | ||
auto It = | ||
std::find_if(Kernels.begin(), Kernels.end(), [&](SYCLKernelInfo &K) { | ||
return K.Name == KernelName.c_str(); | ||
}); | ||
return (It != Kernels.end()) ? &*It : nullptr; | ||
} | ||
|
||
private: | ||
KernelInfoList Kernels; | ||
}; | ||
|
||
} // namespace jit_compiler | ||
|
||
#endif // SYCL_FUSION_COMMON_MODULEINFO_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters