Skip to content

[SYCL] Fix lifetime bug in root group unit tests #19082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: sycl
Choose a base branch
from
Open
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
14 changes: 6 additions & 8 deletions sycl/unittests/Extensions/RootGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,16 @@ struct KernelInfo<QueryKernel> : public unittest::MockKernelInfoBase {
} // namespace _V1
} // namespace sycl

static sycl::unittest::MockDeviceImage Img =
sycl::unittest::generateDefaultImage({"QueryKernel"});
static const sycl::unittest::MockDeviceImageArray<1> ImgArray{&Img};

// Test that querying max_num_work_groups with an invalid (zero) work-group size
// throws the correct exception
TEST(RootGroupTests, InvalidWorkGroupSize) {
namespace syclex = sycl::ext::oneapi::experimental;

// Create a mock device image containing the QueryKernel
sycl::unittest::MockDeviceImage Img =
sycl::unittest::generateDefaultImage({"QueryKernel"});
const sycl::unittest::MockDeviceImageArray<1> ImgArray{&Img};
// Create a UR mock for testing
const sycl::unittest::UrMock<> Mock;

const sycl::queue q;
Expand All @@ -75,10 +76,7 @@ TEST(RootGroupTests, InvalidWorkGroupSize) {
TEST(RootGroupTests, ValidNumWorkGroupsQuery) {
namespace syclex = sycl::ext::oneapi::experimental;

// Create a mock device image containing the QueryKernel
sycl::unittest::MockDeviceImage Img =
sycl::unittest::generateDefaultImage({"QueryKernel"});
const sycl::unittest::MockDeviceImageArray<1> ImgArray{&Img};
// Create a UR mock for testing
const sycl::unittest::UrMock<> Mock;

// Set up a mock callback to return a specific group count when queried
Expand Down