Skip to content
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

[SYCL] Rewrite Tests Containing Deprecated Overloads #2 #16371

Closed
wants to merge 21 commits into from
Closed
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
28 changes: 9 additions & 19 deletions sycl/test-e2e/Basic/max_linear_work_group_size_props.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,15 @@ template <size_t I> struct KernelFunctorWithMaxWGSizeProp {
}
};

template <Variant KernelVariant, size_t I, typename PropertiesT,
typename KernelType>
int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
template <Variant KernelVariant, size_t I, typename KernelType>
int test(queue &Q, KernelType KernelFunc) {
constexpr size_t Dims = 1;

// Positive test case: Specify local size that matches required size.
try {
Q.submit([&](handler &CGH) {
CGH.parallel_for<MaxLinearWGSizePositive<KernelVariant, false, I>>(
nd_range<Dims>(repeatRange<Dims>(8), range<Dims>(I)), Props,
KernelFunc);
nd_range<Dims>(repeatRange<Dims>(8), range<Dims>(I)), KernelFunc);
});
Q.wait_and_throw();
} catch (exception &E) {
Expand All @@ -80,8 +78,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
// Same as above but using the queue shortcuts.
try {
Q.parallel_for<MaxLinearWGSizePositive<KernelVariant, true, I>>(
nd_range<Dims>(repeatRange<Dims>(8), range<Dims>(I)), Props,
KernelFunc);
nd_range<Dims>(repeatRange<Dims>(8), range<Dims>(I)), KernelFunc);
Q.wait_and_throw();
} catch (exception &E) {
std::cerr
Expand All @@ -96,7 +93,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
try {
Q.submit([&](handler &CGH) {
CGH.parallel_for<MaxLinearWGSizeNoLocalPositive<KernelVariant, false, I>>(
repeatRange<Dims>(16), Props, KernelFunc);
repeatRange<Dims>(16), KernelFunc);
});
Q.wait_and_throw();
} catch (exception &E) {
Expand All @@ -108,7 +105,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {

try {
Q.parallel_for<MaxLinearWGSizeNoLocalPositive<KernelVariant, true, I>>(
repeatRange<Dims>(16), Props, KernelFunc);
repeatRange<Dims>(16), KernelFunc);
Q.wait_and_throw();
} catch (exception &E) {
std::cerr << "Test case MaxLinearWGSizeNoLocalPositive shortcut failed: "
Expand All @@ -121,7 +118,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
try {
Q.submit([&](handler &CGH) {
CGH.parallel_for<MaxLinearWGSizeNegative<KernelVariant, false, I>>(
nd_range<Dims>(repeatRange<Dims>(16), repeatRange<Dims>(8)), Props,
nd_range<Dims>(repeatRange<Dims>(16), repeatRange<Dims>(8)),
KernelFunc);
});
Q.wait_and_throw();
Expand All @@ -146,7 +143,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
// Same as above but using the queue shortcuts.
try {
Q.parallel_for<MaxLinearWGSizeNegative<KernelVariant, true, I>>(
nd_range<Dims>(repeatRange<Dims>(16), repeatRange<Dims>(8)), Props,
nd_range<Dims>(repeatRange<Dims>(16), repeatRange<Dims>(8)),
KernelFunc);
Q.wait_and_throw();
std::cerr
Expand All @@ -173,17 +170,10 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
}

template <size_t I> int test_max(queue &Q) {
auto Props = ext::oneapi::experimental::properties{
ext::oneapi::experimental::max_linear_work_group_size<I>};
auto KernelFunction = [](auto) {};

auto EmptyProps = ext::oneapi::experimental::properties{};
KernelFunctorWithMaxWGSizeProp<I> KernelFunctor;

int Res = 0;
Res += test<Variant::Function, I>(Q, Props, KernelFunction);
Res += test<Variant::Functor, I>(Q, EmptyProps, KernelFunctor);
Res += test<Variant::FunctorAndProperty, I>(Q, Props, KernelFunctor);
Res += test<Variant::Functor, I>(Q, KernelFunctor);
return Res;
}

Expand Down
28 changes: 9 additions & 19 deletions sycl/test-e2e/Basic/max_work_group_size_props.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,15 @@ template <size_t... Is> struct KernelFunctorWithMaxWGSizeProp {
}
};

template <Variant KernelVariant, size_t... Is, typename PropertiesT,
typename KernelType>
int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
template <Variant KernelVariant, size_t... Is, typename KernelType>
int test(queue &Q, KernelType KernelFunc) {
constexpr size_t Dims = sizeof...(Is);

// Positive test case: Specify local size that matches required size.
try {
Q.submit([&](handler &CGH) {
CGH.parallel_for<MaxWGSizePositive<KernelVariant, false, Is...>>(
nd_range<Dims>(repeatRange<Dims>(8), range<Dims>(Is...)), Props,
KernelFunc);
nd_range<Dims>(repeatRange<Dims>(8), range<Dims>(Is...)), KernelFunc);
});
Q.wait_and_throw();
} catch (exception &E) {
Expand All @@ -70,8 +68,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
// Same as above but using the queue shortcuts.
try {
Q.parallel_for<MaxWGSizePositive<KernelVariant, true, Is...>>(
nd_range<Dims>(repeatRange<Dims>(8), range<Dims>(Is...)), Props,
KernelFunc);
nd_range<Dims>(repeatRange<Dims>(8), range<Dims>(Is...)), KernelFunc);
Q.wait_and_throw();
} catch (exception &E) {
std::cerr << "Test case MaxWGSizePositive shortcut failed: unexpected "
Expand All @@ -85,7 +82,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
try {
Q.submit([&](handler &CGH) {
CGH.parallel_for<MaxWGSizeNoLocalPositive<KernelVariant, false, Is...>>(
repeatRange<Dims>(16), Props, KernelFunc);
repeatRange<Dims>(16), KernelFunc);
});
Q.wait_and_throw();
} catch (exception &E) {
Expand All @@ -97,7 +94,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {

try {
Q.parallel_for<MaxWGSizeNoLocalPositive<KernelVariant, true, Is...>>(
repeatRange<Dims>(16), Props, KernelFunc);
repeatRange<Dims>(16), KernelFunc);
Q.wait_and_throw();
} catch (exception &E) {
std::cerr << "Test case MaxWGSizeNoLocalPositive shortcut failed: "
Expand All @@ -110,7 +107,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
try {
Q.submit([&](handler &CGH) {
CGH.parallel_for<MaxWGSizeNegative<KernelVariant, false, Is...>>(
nd_range<Dims>(repeatRange<Dims>(16), repeatRange<Dims>(8)), Props,
nd_range<Dims>(repeatRange<Dims>(16), repeatRange<Dims>(8)),
KernelFunc);
});
Q.wait_and_throw();
Expand All @@ -133,7 +130,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
// Same as above but using the queue shortcuts.
try {
Q.parallel_for<MaxWGSizeNegative<KernelVariant, true, Is...>>(
nd_range<Dims>(repeatRange<Dims>(16), repeatRange<Dims>(8)), Props,
nd_range<Dims>(repeatRange<Dims>(16), repeatRange<Dims>(8)),
KernelFunc);
Q.wait_and_throw();
std::cerr << "Test case MaxWGSizeNegative shortcut failed: no exception "
Expand All @@ -158,17 +155,10 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
}

template <size_t... Is> int test_max(queue &Q) {
auto Props = ext::oneapi::experimental::properties{
ext::oneapi::experimental::max_work_group_size<Is...>};
auto KernelFunction = [](auto) {};

auto EmptyProps = ext::oneapi::experimental::properties{};
KernelFunctorWithMaxWGSizeProp<Is...> KernelFunctor;

int Res = 0;
Res += test<Variant::Function, Is...>(Q, Props, KernelFunction);
Res += test<Variant::Functor, Is...>(Q, EmptyProps, KernelFunctor);
Res += test<Variant::FunctorAndProperty, Is...>(Q, Props, KernelFunctor);
Res += test<Variant::Functor, Is...>(Q, KernelFunctor);
return Res;
}

Expand Down
28 changes: 9 additions & 19 deletions sycl/test-e2e/Basic/work_group_size_prop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ template <size_t... Is> struct KernelFunctorWithWGSizeProp {
}
};

template <Variant KernelVariant, size_t... Is, typename PropertiesT,
typename KernelType>
int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
template <Variant KernelVariant, size_t... Is, typename KernelType>
int test(queue &Q, KernelType KernelFunc) {
constexpr size_t Dims = sizeof...(Is);

bool IsOpenCL = (Q.get_backend() == backend::opencl);
Expand All @@ -56,8 +55,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
try {
Q.submit([&](handler &CGH) {
CGH.parallel_for<ReqdWGSizePositiveA<KernelVariant, false, Is...>>(
nd_range<Dims>(repeatRange<Dims>(8), range<Dims>(Is...)), Props,
KernelFunc);
nd_range<Dims>(repeatRange<Dims>(8), range<Dims>(Is...)), KernelFunc);
});
Q.wait_and_throw();
} catch (exception &E) {
Expand All @@ -69,8 +67,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
// Same as above but using the queue shortcuts.
try {
Q.parallel_for<ReqdWGSizePositiveA<KernelVariant, true, Is...>>(
nd_range<Dims>(repeatRange<Dims>(8), range<Dims>(Is...)), Props,
KernelFunc);
nd_range<Dims>(repeatRange<Dims>(8), range<Dims>(Is...)), KernelFunc);
Q.wait_and_throw();
} catch (exception &E) {
std::cerr << "Test case ReqdWGSizePositiveA shortcut failed: unexpected "
Expand All @@ -87,7 +84,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
Q.submit([&](handler &CGH) {
CGH.parallel_for<
ReqdWGSizeNoLocalPositive<KernelVariant, false, Is...>>(
repeatRange<Dims>(16), Props, KernelFunc);
repeatRange<Dims>(16), KernelFunc);
});
Q.wait_and_throw();
} catch (exception &E) {
Expand All @@ -99,7 +96,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {

try {
Q.parallel_for<ReqdWGSizeNoLocalPositive<KernelVariant, true, Is...>>(
repeatRange<Dims>(16), Props, KernelFunc);
repeatRange<Dims>(16), KernelFunc);
Q.wait_and_throw();
} catch (exception &E) {
std::cerr << "Test case ReqdWGSizeNoLocalPositive shortcut failed: "
Expand All @@ -113,7 +110,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
try {
Q.submit([&](handler &CGH) {
CGH.parallel_for<ReqdWGSizeNegativeA<KernelVariant, false, Is...>>(
nd_range<Dims>(repeatRange<Dims>(16), repeatRange<Dims>(8)), Props,
nd_range<Dims>(repeatRange<Dims>(16), repeatRange<Dims>(8)),
KernelFunc);
});
Q.wait_and_throw();
Expand All @@ -137,7 +134,7 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
// Same as above but using the queue shortcuts.
try {
Q.parallel_for<ReqdWGSizeNegativeA<KernelVariant, true, Is...>>(
nd_range<Dims>(repeatRange<Dims>(16), repeatRange<Dims>(8)), Props,
nd_range<Dims>(repeatRange<Dims>(16), repeatRange<Dims>(8)),
KernelFunc);
Q.wait_and_throw();
std::cerr << "Test case ReqdWGSizeNegativeA shortcut failed: no exception "
Expand All @@ -162,17 +159,10 @@ int test(queue &Q, PropertiesT Props, KernelType KernelFunc) {
}

template <size_t... Is> int test(queue &Q) {
auto Props = ext::oneapi::experimental::properties{
ext::oneapi::experimental::work_group_size<Is...>};
auto KernelFunction = [](auto) {};

auto EmptyProps = ext::oneapi::experimental::properties{};
KernelFunctorWithWGSizeProp<Is...> KernelFunctor;

int Res = 0;
Res += test<Variant::Function, Is...>(Q, Props, KernelFunction);
Res += test<Variant::Functor, Is...>(Q, EmptyProps, KernelFunctor);
Res += test<Variant::FunctorAndProperty, Is...>(Q, Props, KernelFunctor);
Res += test<Variant::Functor, Is...>(Q, KernelFunctor);
return Res;
}

Expand Down
Loading
Loading