Skip to content

Commit cf3a365

Browse files
committed
[NFC] A few more changes
Added some comments here and there. Wrapped some code in `ModuleSplitter.cpp` into `namespace { ... }`. Removed `default` case from a fully-coverage switch: we have downstream environments where this is considered an error.
1 parent 7fa60bf commit cf3a365

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ void EntryPointGroup::rebuildFromNames(const std::vector<std::string> &Names,
625625
});
626626
}
627627

628+
namespace {
628629
// This is a helper class, which allows to group/categorize function based on
629630
// provided rules. It is intended to be used in device code split
630631
// implementation.
@@ -812,6 +813,7 @@ std::string FunctionsCategorizer::computeCategoryFor(Function *F) const {
812813

813814
return (std::string)Result;
814815
}
816+
} // namespace
815817

816818
std::unique_ptr<ModuleSplitterBase>
817819
getDeviceCodeSplitter(ModuleDesc &&MD, IRSplitMode Mode, bool IROutputOnly,
@@ -842,13 +844,13 @@ getDeviceCodeSplitter(ModuleDesc &&MD, IRSplitMode Mode, bool IROutputOnly,
842844
sycl::utils::ATTR_SYCL_MODULE_ID);
843845

844846
// Optional features
847+
// Note: Add more rules at the end of the list to avoid chaning orders of
848+
// output files in existing tests.
845849
Categorizer.registerSimpleFlagAttributeRule(
846850
::sycl::kernel_props::ATTR_LARGE_GRF, "large-grf");
847851
Categorizer.registerListOfIntegersInMetadataSortedRule("sycl_used_aspects");
848852
Categorizer.registerListOfIntegersInMetadataRule("reqd_work_group_size");
849853
break;
850-
default:
851-
llvm_unreachable("Unexpected split scope");
852854
}
853855

854856
// std::map is used here to ensure stable ordering of entry point groups,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,9 @@ processInputModule(std::unique_ptr<Module> M) {
781781
if (DeviceGlobals)
782782
Splitter->verifyNoCrossModuleDeviceGlobalUsage();
783783

784+
// It is important that we *DO NOT* preserve all the splits in memory at the
785+
// same time, because it leads to a huge RAM consumption by the tool on bigger
786+
// inputs.
784787
while (Splitter->hasMoreSplits()) {
785788
module_split::ModuleDesc MDesc = Splitter->nextSplit();
786789
DUMP_ENTRY_POINTS(MDesc.entries(), MDesc.Name.c_str(), 1);

0 commit comments

Comments
 (0)