Skip to content

Commit 10d0950

Browse files
[SYCL] Skip SYCL/InlineAsm/asm_8* tests if device doesn't support SG size 8 (intel#1513)
1 parent 9ba47b7 commit 10d0950

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

SYCL/InlineAsm/asm_8_empty.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ template <typename T = dataType> struct KernelFunctor : WithOutputBuffer<T> {
3030

3131
int main() {
3232
KernelFunctor<> f(DEFAULT_PROBLEM_SIZE);
33-
if (!launchInlineASMTest(f))
33+
if (!launchInlineASMTest(f, true, false, {8}))
3434
return 0;
3535

3636
if (verify_all_the_same(f.getOutputBufferData(), 43))

SYCL/InlineAsm/asm_8_no_input_int.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ template <typename T = dataType> struct KernelFunctor : WithOutputBuffer<T> {
3333

3434
int main() {
3535
KernelFunctor<> f(DEFAULT_PROBLEM_SIZE);
36-
if (!launchInlineASMTest(f))
36+
if (!launchInlineASMTest(f, true, false, {8}))
3737
return 0;
3838

3939
if (verify_all_the_same(f.getOutputBufferData(), 7))

SYCL/InlineAsm/include/asmhelper.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ auto exception_handler = [](sycl::exception_list exceptions) {
9191
};
9292

9393
template <typename F>
94-
bool launchInlineASMTestImpl(F &f, bool requires_particular_sg_size = true) {
94+
bool launchInlineASMTestImpl(F &f, bool requires_particular_sg_size = true,
95+
std::vector<int> RequiredSGSizes = {}) {
9596
sycl::queue deviceQueue(sycl::gpu_selector_v, exception_handler);
9697
sycl::device device = deviceQueue.get_device();
9798

@@ -108,6 +109,16 @@ bool launchInlineASMTestImpl(F &f, bool requires_particular_sg_size = true) {
108109
return false;
109110
}
110111

112+
auto sg_sizes = device.get_info<sycl::info::device::sub_group_sizes>();
113+
if (std::any_of(RequiredSGSizes.begin(), RequiredSGSizes.end(),
114+
[&](size_t RequiredSGSize) {
115+
return std::find(sg_sizes.begin(), sg_sizes.end(),
116+
RequiredSGSize) == sg_sizes.end();
117+
})) {
118+
std::cout << "Skipping test\n";
119+
return false;
120+
}
121+
111122
deviceQueue.submit(f).wait_and_throw();
112123

113124
return true;
@@ -118,10 +129,12 @@ bool launchInlineASMTestImpl(F &f, bool requires_particular_sg_size = true) {
118129
/// \returns false if test wasn't launched (i.e.was skipped) and true otherwise
119130
template <typename F>
120131
bool launchInlineASMTest(F &f, bool requires_particular_sg_size = true,
121-
bool exception_expected = false) {
132+
bool exception_expected = false,
133+
std::vector<int> RequiredSGSizes = {}) {
122134
bool result = false;
123135
try {
124-
result = launchInlineASMTestImpl(f, requires_particular_sg_size);
136+
result = launchInlineASMTestImpl(f, requires_particular_sg_size,
137+
RequiredSGSizes);
125138
} catch (sycl::exception &e) {
126139
std::string what = e.what();
127140
if (exception_expected &&

0 commit comments

Comments
 (0)