Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
11 changes: 11 additions & 0 deletions llvm/include/llvm/Support/PropertySetIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,17 @@ class PropertySetRegistry {
PropSet.insert({PropName, PropertyValue(PropVal)});
}

void remove(StringRef Category, StringRef PropName) {
auto PropertySetIt = PropSetMap.find(Category);
if (PropertySetIt == PropSetMap.end())
return;
auto &PropertySet = PropertySetIt->second;
auto PropIt = PropertySet.find(PropName);
if (PropIt == PropertySet.end())
return;
PropertySet.erase(PropIt);
}

/// Parses from the given \p Buf a property set registry.
static Expected<std::unique_ptr<PropertySetRegistry>>
read(const MemoryBuffer *Buf);
Expand Down
10 changes: 0 additions & 10 deletions llvm/lib/SYCLLowerIR/SYCLDeviceRequirements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ SYCLDeviceRequirements
llvm::computeDeviceRequirements(const Module &M,
const SetVector<Function *> &EntryPoints) {
SYCLDeviceRequirements Reqs;
bool MultipleReqdWGSize = false;
// Process all functions in the module
for (const Function &F : M) {
if (auto *MDN = F.getMetadata("sycl_used_aspects")) {
Expand Down Expand Up @@ -81,8 +80,6 @@ llvm::computeDeviceRequirements(const Module &M,
ExtractUnsignedIntegerFromMDNodeOperand(MDN, I));
if (!Reqs.ReqdWorkGroupSize.has_value())
Reqs.ReqdWorkGroupSize = NewReqdWorkGroupSize;
if (Reqs.ReqdWorkGroupSize != NewReqdWorkGroupSize)
MultipleReqdWGSize = true;
}

if (auto *MDN = F.getMetadata("sycl_joint_matrix")) {
Expand Down Expand Up @@ -119,13 +116,6 @@ llvm::computeDeviceRequirements(const Module &M,
}
}

// Usually, we would only expect one ReqdWGSize, as the module passed to
// this function would be split according to that. However, when splitting
// is disabled, this cannot be guaranteed. In this case, we reset the value,
// which makes so that no value is reqd_work_group_size data is attached in
// in the device image.
if (MultipleReqdWGSize)
Reqs.ReqdWorkGroupSize.reset();
return Reqs;
}

Expand Down
9 changes: 9 additions & 0 deletions llvm/tools/sycl-post-link/sycl-post-link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,15 @@ std::string saveModuleProperties(module_split::ModuleDesc &MD,
auto PropSet =
computeModuleProperties(MD.getModule(), MD.entries(), GlobProps);

// When the split mode is none, the required work group size will be added
// to the whole module, which will make the runtime unable to
// launch the other kernels in the module that have different
// required work group sizes or no requried work group sizes. So we need to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// required work group sizes or no requried work group sizes. So we need to
// required work group sizes or no required work group sizes. So we need to

// remove the required work group size metadata in this case.
if (SplitMode == module_split::SPLIT_NONE)
PropSet.remove(PropSetRegTy::SYCL_DEVICE_REQUIREMENTS,
"reqd_work_group_size_uint64_t");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we make reqd_work_group_size_uint64_t a constant somewhere so we dont have any typo problems in the future?


std::string NewSuff = Suff.str();
if (!Target.empty()) {
PropSet.add(PropSetRegTy::SYCL_DEVICE_REQUIREMENTS, "compile_target",
Expand Down
19 changes: 19 additions & 0 deletions sycl/test-e2e/Regression/no-split-reqd-wg-size-2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// This test checks that with -fsycl-device-code-split=off, kernels
// with different reqd_work_group_size dimensions can be launched.

// RUN: %{build} -fsycl -fsycl-device-code-split=off -o %t.out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: %{build} includes -fsycl

// RUN: %{run} %t.out

// UNSUPPORTED: hip

#include <sycl/detail/core.hpp>

using namespace sycl;

int main(int argc, char **argv) {
queue q;
q.single_task([] {});
q.parallel_for(range<2>(24, 1),
[=](auto) [[sycl::reqd_work_group_size(24, 1)]] {});
return 0;
}
Loading