Skip to content

Commit d61e93e

Browse files
committed
Apply comments
1 parent e4b452e commit d61e93e

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

llvm/tools/sycl-post-link/ModuleSplitter.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ class FunctionsCategorizer {
658658
}
659659

660660
// Creates a simple rule, which adds one or another value to a resulting
661-
// identifier based on a presence of a metadata on a function.
661+
// identifier based on the presence of a metadata on a function.
662662
void registerSimpleFlagAttributeRule(StringRef AttrName,
663663
StringRef IfPresentStr,
664664
StringRef IfAbsentStr = "") {
@@ -667,7 +667,7 @@ class FunctionsCategorizer {
667667
}
668668

669669
// Creates a simple rule, which adds one or another value to a resulting
670-
// identifier based on a presence of a metadata on a function.
670+
// identifier based on the presence of a metadata on a function.
671671
void registerSimpleFlagMetadataRule(StringRef MetadataName,
672672
StringRef IfPresentStr,
673673
StringRef IfAbsentStr = "") {
@@ -791,13 +791,13 @@ std::string FunctionsCategorizer::computeCategoryFor(Function *F) const {
791791
if (F->hasMetadata(MetadataName)) {
792792
MDNode *MDN = F->getMetadata(MetadataName);
793793

794-
SmallVector<unsigned, 8> Values;
794+
SmallVector<std::uint64_t, 8> Values;
795795
for (const MDOperand &MDOp : MDN->operands())
796796
Values.push_back(mdconst::extract<ConstantInt>(MDOp)->getZExtValue());
797797

798798
llvm::sort(Values);
799799

800-
for (unsigned V : Values)
800+
for (std::uint64_t V : Values)
801801
Result += "-" + std::to_string(V);
802802
}
803803
} break;
@@ -880,8 +880,8 @@ getDeviceCodeSplitter(ModuleDesc &&MD, IRSplitMode Mode, bool IROutputOnly,
880880
Groups.reserve(EntryPointsMap.size());
881881
// Start with properties of a source module
882882
EntryPointGroup::Properties MDProps = MD.getEntryPointGroup().Props;
883-
for (auto &It : EntryPointsMap)
884-
Groups.emplace_back(It.first, std::move(It.second), MDProps);
883+
for (auto &[Key, EntryPoints] : EntryPointsMap)
884+
Groups.emplace_back(Key, std::move(EntryPoints), MDProps);
885885
}
886886

887887
bool DoSplit = (Mode != SPLIT_NONE &&

llvm/tools/sycl-post-link/sycl-post-link.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,13 @@ std::string saveModuleProperties(module_split::ModuleDesc &MD,
473473
// getAsInteger returns true on error
474474
if (!F.getFnAttribute(llvm::sycl::utils::ATTR_SYCL_OPTLEVEL)
475475
.getValueAsString()
476-
.getAsInteger(10, OptLevel))
477-
break;
476+
.getAsInteger(10, OptLevel)) {
477+
// It is expected that device-code split has separated kernels with
478+
// different values of sycl-optlevel attribute. Therefore, it is enough
479+
// to only look at the first function with such attribute to compute
480+
// the property for the whole device image.
481+
break;
482+
}
478483
}
479484

480485
if (OptLevel != -1)

0 commit comments

Comments
 (0)