Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions llvm/include/llvm/SYCLPostLink/ModuleSplitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class Function;

namespace cl {
class OptionCategory;
}
} // namespace cl

namespace module_split {

constexpr char SYCL_ESIMD_SPLIT_MD_NAME[] = "sycl-esimd-split-status";
constexpr char SyclEsimdSplitMdName[] = "sycl-esimd-split-status";
constexpr std::array<const char *, 2> SYCLDeviceLibs = {
"libsycl-fallback-bfloat16.bc", "libsycl-native-bfloat16.bc"};

Expand Down Expand Up @@ -144,7 +144,7 @@ class ModuleDesc {
: M(std::move(M)), IsTopLevel(true), Name(Name) {
// DeviceLib module doesn't include any entry point,it can be constructed
// using ctor without any entry point related parameter.
for (auto Fn : SYCLDeviceLibs) {
for (const auto *Fn : SYCLDeviceLibs) {
if (StringRef(Fn) == Name) {
IsSYCLDeviceLib = true;
break;
Expand Down
17 changes: 9 additions & 8 deletions llvm/lib/SYCLPostLink/ComputeModuleRuntimeInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Demangle/Demangle.h"
#include "llvm/IR/PassInstrumentation.h"
#include "llvm/SYCLLowerIR/CompileTimePropertiesPass.h"
#include "llvm/SYCLLowerIR/DeviceGlobals.h"
Expand All @@ -32,7 +31,7 @@ namespace llvm::sycl {
namespace {
module_split::SyclEsimdSplitStatus
getSYCLESIMDSplitStatusFromMetadata(const Module &M) {
auto *SplitMD = M.getNamedMetadata(module_split::SYCL_ESIMD_SPLIT_MD_NAME);
auto *SplitMD = M.getNamedMetadata(module_split::SyclEsimdSplitMdName);
assert(SplitMD && "Unexpected metadata");
auto *MDOp = SplitMD->getOperand(0);
assert(MDOp && "Unexpected metadata operand");
Expand Down Expand Up @@ -67,7 +66,7 @@ bool isModuleUsingTsan(const Module &M) {
// Optional.
// Otherwise, it returns an Optional containing a list of reached
// SPIR kernel function's names.
std::optional<std::vector<StringRef>>
static std::optional<std::vector<StringRef>>
traverseCGToFindSPIRKernels(const Function *StartingFunction) {
std::queue<const Function *> FunctionsToVisit;
std::unordered_set<const Function *> VisitedFunctions;
Expand Down Expand Up @@ -106,7 +105,8 @@ traverseCGToFindSPIRKernels(const Function *StartingFunction) {

return {std::move(KernelNames)};
}
std::vector<StringRef> getKernelNamesUsingAssert(const Module &M) {

static std::vector<StringRef> getKernelNamesUsingAssert(const Module &M) {
auto *DevicelibAssertFailFunction = M.getFunction("__devicelib_assert_fail");
if (!DevicelibAssertFailFunction)
return {};
Expand All @@ -131,8 +131,8 @@ std::vector<StringRef> getKernelNamesUsingAssert(const Module &M) {
// Gets 1- to 3-dimension work-group related information for function Func.
// Returns an empty vector if not present.
template <typename T>
std::vector<T> getKernelWorkGroupMetadata(const Function &Func,
const char *MDName) {
static std::vector<T> getKernelWorkGroupMetadata(const Function &Func,
const char *MDName) {
MDNode *WorkGroupMD = Func.getMetadata(MDName);
if (!WorkGroupMD)
return {};
Expand All @@ -149,8 +149,8 @@ std::vector<T> getKernelWorkGroupMetadata(const Function &Func,
// Gets a single-dimensional piece of information for function Func.
// Returns std::nullopt if metadata is not present.
template <typename T>
std::optional<T> getKernelSingleEltMetadata(const Function &Func,
const char *MDName) {
static std::optional<T> getKernelSingleEltMetadata(const Function &Func,
const char *MDName) {
if (MDNode *MaxDimMD = Func.getMetadata(MDName)) {
assert(MaxDimMD->getNumOperands() == 1 && "Malformed node.");
return mdconst::extract<ConstantInt>(MaxDimMD->getOperand(0))
Expand Down Expand Up @@ -543,6 +543,7 @@ PropSetRegTy computeModuleProperties(const Module &M,

return PropSet;
}

std::string computeModuleSymbolTable(const Module &M,
const EntryPointSet &EntryPoints) {

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/SYCLPostLink/ModuleSplitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ void ModuleDesc::dump() const {
void ModuleDesc::saveSplitInformationAsMetadata() {
// Add metadata to the module so we can identify what kind of SYCL/ESIMD split
// later.
auto *SplitMD = M->getOrInsertNamedMetadata(SYCL_ESIMD_SPLIT_MD_NAME);
auto *SplitMD = M->getOrInsertNamedMetadata(SyclEsimdSplitMdName);
auto *SplitMDOp = MDNode::get(
M->getContext(), ConstantAsMetadata::get(ConstantInt::get(
Type::getInt8Ty(M->getContext()),
Expand Down
Loading