-
Notifications
You must be signed in to change notification settings - Fork 787
Add negative tests for inline asm #2406
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
Merged
romanovvlad
merged 6 commits into
intel:sycl
from
fadeeval:private/fadeeval/asm_negative_tests
Sep 3, 2020
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8f7b5d2
[SYCL] Fix incorrect data type (#2394)
rbegam 00330da
Refactor negative inline asm tests
AlexeySachkov 53b0f7f
Fix asm negative tests
fadeeval 5afddf6
Simplify asm negative tests
fadeeval f4fbcb0
Correct Formating
fadeeval e832784
Remove controversial tests
fadeeval File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// UNSUPPORTED: cuda | ||
// REQUIRES: gpu,linux | ||
// RUN: %clangxx -fsycl %s -DINLINE_ASM -o %t.out | ||
// RUN: not %t.out 2>&1 | FileCheck %s | ||
|
||
// CHECK: syntax error | ||
|
||
#include "../include/asmhelper.h" | ||
#include <CL/sycl.hpp> | ||
|
||
using dataType = cl::sycl::cl_int; | ||
|
||
template <typename T = dataType> | ||
struct KernelFunctor : WithOutputBuffer<T> { | ||
KernelFunctor(size_t problem_size) : WithOutputBuffer<T>(problem_size) {} | ||
|
||
void operator()(cl::sycl::handler &cgh) { | ||
cgh.parallel_for<KernelFunctor<T>>( | ||
cl::sycl::range<1>{this->getOutputBufferSize()}, [=](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] { | ||
#if defined(INLINE_ASM) && defined(__SYCL_DEVICE_ONLY__) | ||
asm volatile(".decl tmp1 v_type=G type=d num_elts=16 align=GRF\n" | ||
".decl tmp2 v_type=G type=d num_elts=16 align=GRF\n" | ||
"movi (M1_NM, 8) tmp1(0,1)<1> tmp2(0,0)\n"); | ||
#endif | ||
}); | ||
} | ||
}; | ||
|
||
int main() { | ||
KernelFunctor<> f(DEFAULT_PROBLEM_SIZE); | ||
launchInlineASMTest(f); | ||
return 0; | ||
} |
33 changes: 33 additions & 0 deletions
33
sycl/test/inline-asm/negative_tests/asm_bad_operand_syntax.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// UNSUPPORTED: cuda | ||
// REQUIRES: gpu,linux | ||
// RUN: %clangxx -fsycl %s -DINLINE_ASM -o %t.out | ||
// RUN: not %t.out 2>&1 | FileCheck %s | ||
|
||
// CHECK: syntax error | ||
|
||
#include "../include/asmhelper.h" | ||
#include <CL/sycl.hpp> | ||
|
||
using dataType = cl::sycl::cl_int; | ||
|
||
template <typename T = dataType> | ||
struct KernelFunctor : WithOutputBuffer<T> { | ||
KernelFunctor(size_t problem_size) : WithOutputBuffer<T>(problem_size) {} | ||
|
||
void operator()(cl::sycl::handler &cgh) { | ||
cgh.parallel_for<KernelFunctor<T>>( | ||
cl::sycl::range<1>{this->getOutputBufferSize()}, [=](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] { | ||
#if defined(INLINE_ASM) && defined(__SYCL_DEVICE_ONLY__) | ||
asm volatile(".decl tmp1 v_type=G type=d num_elts=16 align=GRF\n" | ||
".decl tmp2 v_type=G type=d num_elts=16 align=GRF\n" | ||
"mov (M1_NM, 8) tmp1(0,1)<1>:f tmp2(0,0)<1;1,0>\n"); | ||
#endif | ||
}); | ||
} | ||
}; | ||
|
||
int main() { | ||
KernelFunctor<> f(DEFAULT_PROBLEM_SIZE); | ||
launchInlineASMTest(f); | ||
return 0; | ||
} |
33 changes: 33 additions & 0 deletions
33
sycl/test/inline-asm/negative_tests/asm_duplicate_label.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// UNSUPPORTED: cuda | ||
// REQUIRES: gpu,linux | ||
// RUN: %clangxx -fsycl %s -DINLINE_ASM -o %t.out | ||
// RUN: not %t.out 2>&1 | FileCheck %s | ||
|
||
// CHECK: label is redefined | ||
|
||
#include "../include/asmhelper.h" | ||
#include <CL/sycl.hpp> | ||
|
||
using dataType = cl::sycl::cl_int; | ||
|
||
template <typename T = dataType> | ||
struct KernelFunctor : WithOutputBuffer<T> { | ||
KernelFunctor(size_t problem_size) : WithOutputBuffer<T>(problem_size) {} | ||
|
||
void operator()(cl::sycl::handler &cgh) { | ||
cgh.parallel_for<KernelFunctor<T>>( | ||
cl::sycl::range<1>{this->getOutputBufferSize()}, [=](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] { | ||
#if defined(INLINE_ASM) && defined(__SYCL_DEVICE_ONLY__) | ||
asm volatile(".decl tmp1 v_type=G type=d num_elts=16 align=GRF\n" | ||
".decl tmp2 v_type=G type=d num_elts=16 align=GRF\n" | ||
"check_label0:\\ncheck_label0:\n"); | ||
#endif | ||
}); | ||
} | ||
}; | ||
|
||
int main() { | ||
KernelFunctor<> f(DEFAULT_PROBLEM_SIZE); | ||
launchInlineASMTest(f); | ||
return 0; | ||
} |
33 changes: 33 additions & 0 deletions
33
sycl/test/inline-asm/negative_tests/asm_illegal_exec_size.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// UNSUPPORTED: cuda | ||
// REQUIRES: gpu,linux | ||
// RUN: %clangxx -fsycl %s -DINLINE_ASM -o %t.out | ||
// RUN: not %t.out 2>&1 | FileCheck %s | ||
|
||
// CHECK: invalid execution size | ||
|
||
#include "../include/asmhelper.h" | ||
#include <CL/sycl.hpp> | ||
|
||
using dataType = cl::sycl::cl_int; | ||
|
||
template <typename T = dataType> | ||
struct KernelFunctor : WithOutputBuffer<T> { | ||
KernelFunctor(size_t problem_size) : WithOutputBuffer<T>(problem_size) {} | ||
|
||
void operator()(cl::sycl::handler &cgh) { | ||
cgh.parallel_for<KernelFunctor<T>>( | ||
cl::sycl::range<1>{this->getOutputBufferSize()}, [=](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] { | ||
#if defined(INLINE_ASM) && defined(__SYCL_DEVICE_ONLY__) | ||
asm volatile(".decl tmp1 v_type=G type=d num_elts=16 align=GRF\n" | ||
".decl tmp2 v_type=G type=d num_elts=16 align=GRF\n" | ||
"mov (M1_NM, 6) tmp1(0,1)<1> tmp2(0,0)<1;1,0>\n"); | ||
#endif | ||
}); | ||
} | ||
}; | ||
|
||
int main() { | ||
KernelFunctor<> f(DEFAULT_PROBLEM_SIZE); | ||
launchInlineASMTest(f); | ||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// UNSUPPORTED: cuda | ||
// REQUIRES: gpu,linux | ||
// RUN: %clangxx -fsycl %s -DINLINE_ASM -o %t.out | ||
// RUN: not %t.out 2>&1 | FileCheck %s | ||
|
||
// CHECK: undefined label: check_label0 | ||
|
||
#include "../include/asmhelper.h" | ||
#include <CL/sycl.hpp> | ||
|
||
using dataType = cl::sycl::cl_int; | ||
|
||
template <typename T = dataType> | ||
struct KernelFunctor : WithOutputBuffer<T> { | ||
KernelFunctor(size_t problem_size) : WithOutputBuffer<T>(problem_size) {} | ||
|
||
void operator()(cl::sycl::handler &cgh) { | ||
cgh.parallel_for<KernelFunctor<T>>( | ||
cl::sycl::range<1>{this->getOutputBufferSize()}, [=](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] { | ||
#if defined(INLINE_ASM) && defined(__SYCL_DEVICE_ONLY__) | ||
asm volatile(".decl tmp1 v_type=G type=d num_elts=16 align=GRF\n" | ||
".decl tmp2 v_type=G type=d num_elts=16 align=GRF\n" | ||
"goto (M1, 16) check_label0\n"); | ||
#endif | ||
}); | ||
} | ||
}; | ||
|
||
int main() { | ||
KernelFunctor<> f(DEFAULT_PROBLEM_SIZE); | ||
launchInlineASMTest(f); | ||
return 0; | ||
} |
33 changes: 33 additions & 0 deletions
33
sycl/test/inline-asm/negative_tests/asm_missing_region.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// UNSUPPORTED: cuda | ||
// REQUIRES: gpu,linux | ||
// RUN: %clangxx -fsycl %s -DINLINE_ASM -o %t.out | ||
// RUN: not %t.out 2>&1 | FileCheck %s | ||
|
||
// CHECK: syntax error | ||
|
||
#include "../include/asmhelper.h" | ||
#include <CL/sycl.hpp> | ||
|
||
using dataType = cl::sycl::cl_int; | ||
|
||
template <typename T = dataType> | ||
struct KernelFunctor : WithOutputBuffer<T> { | ||
KernelFunctor(size_t problem_size) : WithOutputBuffer<T>(problem_size) {} | ||
|
||
void operator()(cl::sycl::handler &cgh) { | ||
cgh.parallel_for<KernelFunctor<T>>( | ||
cl::sycl::range<1>{this->getOutputBufferSize()}, [=](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] { | ||
#if defined(INLINE_ASM) && defined(__SYCL_DEVICE_ONLY__) | ||
asm volatile(".decl tmp1 v_type=G type=d num_elts=16 align=GRF\n" | ||
".decl tmp2 v_type=G type=d num_elts=16 align=GRF\n" | ||
"mov (M1_NM, 8) tmp1(0,1)<1> tmp2(0,0)\n"); | ||
#endif | ||
}); | ||
} | ||
}; | ||
|
||
int main() { | ||
KernelFunctor<> f(DEFAULT_PROBLEM_SIZE); | ||
launchInlineASMTest(f); | ||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// UNSUPPORTED: cuda | ||
// REQUIRES: gpu,linux | ||
// RUN: %clangxx -fsycl %s -DINLINE_ASM -o %t.out | ||
// RUN: not %t.out 2>&1 | FileCheck %s | ||
|
||
// CHECK: syntax error | ||
|
||
#include "../include/asmhelper.h" | ||
#include <CL/sycl.hpp> | ||
|
||
using dataType = cl::sycl::cl_int; | ||
|
||
template <typename T = dataType> | ||
struct KernelFunctor : WithOutputBuffer<T> { | ||
KernelFunctor(size_t problem_size) : WithOutputBuffer<T>(problem_size) {} | ||
|
||
void operator()(cl::sycl::handler &cgh) { | ||
cgh.parallel_for<KernelFunctor<T>>( | ||
cl::sycl::range<1>{this->getOutputBufferSize()}, [=](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] { | ||
#if defined(INLINE_ASM) && defined(__SYCL_DEVICE_ONLY__) | ||
asm volatile(".decl tmp1 v_type=G type=d num_elts=16 align=GRF\n" | ||
".decl tmp2 v_type=G type=d num_elts=16 align=GRF\n" | ||
"@@\n"); | ||
#endif | ||
}); | ||
} | ||
}; | ||
|
||
int main() { | ||
KernelFunctor<> f(DEFAULT_PROBLEM_SIZE); | ||
launchInlineASMTest(f); | ||
return 0; | ||
} |
33 changes: 33 additions & 0 deletions
33
sycl/test/inline-asm/negative_tests/asm_undefined_decl.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// UNSUPPORTED: cuda | ||
// REQUIRES: gpu,linux | ||
// RUN: %clangxx -fsycl %s -DINLINE_ASM -o %t.out | ||
// RUN: not %t.out 2>&1 | FileCheck %s | ||
|
||
// CHECK: syntax error | ||
|
||
#include "../include/asmhelper.h" | ||
#include <CL/sycl.hpp> | ||
|
||
using dataType = cl::sycl::cl_int; | ||
|
||
template <typename T = dataType> | ||
struct KernelFunctor : WithOutputBuffer<T> { | ||
KernelFunctor(size_t problem_size) : WithOutputBuffer<T>(problem_size) {} | ||
|
||
void operator()(cl::sycl::handler &cgh) { | ||
cgh.parallel_for<KernelFunctor<T>>( | ||
cl::sycl::range<1>{this->getOutputBufferSize()}, [=](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] { | ||
#if defined(INLINE_ASM) && defined(__SYCL_DEVICE_ONLY__) | ||
asm volatile(".decl tmp1 v_type=G type=d num_elts=16 align=GRF\n" | ||
".decl tmp2 v_type=G type=d num_elts=16 align=GRF\n" | ||
"mov (M1_NM, 8) tmp1(0,1)<1> my_super_var(0,0)\n"); | ||
#endif | ||
}); | ||
} | ||
}; | ||
|
||
int main() { | ||
KernelFunctor<> f(DEFAULT_PROBLEM_SIZE); | ||
launchInlineASMTest(f); | ||
return 0; | ||
} |
33 changes: 33 additions & 0 deletions
33
sycl/test/inline-asm/negative_tests/asm_undefined_pred.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// UNSUPPORTED: cuda | ||
// REQUIRES: gpu,linux | ||
// RUN: %clangxx -fsycl %s -DINLINE_ASM -o %t.out | ||
// RUN: not %t.out 2>&1 | FileCheck %s | ||
|
||
// CHECK: undefined predicate variable | ||
|
||
#include "../include/asmhelper.h" | ||
#include <CL/sycl.hpp> | ||
|
||
using dataType = cl::sycl::cl_int; | ||
|
||
template <typename T = dataType> | ||
struct KernelFunctor : WithOutputBuffer<T> { | ||
KernelFunctor(size_t problem_size) : WithOutputBuffer<T>(problem_size) {} | ||
|
||
void operator()(cl::sycl::handler &cgh) { | ||
cgh.parallel_for<KernelFunctor<T>>( | ||
cl::sycl::range<1>{this->getOutputBufferSize()}, [=](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] { | ||
#if defined(INLINE_ASM) && defined(__SYCL_DEVICE_ONLY__) | ||
asm volatile(".decl tmp1 v_type=G type=d num_elts=16 align=GRF\n" | ||
".decl tmp2 v_type=G type=d num_elts=16 align=GRF\n" | ||
"cmp.lt (M1_NM, 8) P3 tmp1(0,0)<0;1,0> 0x3:ud\n"); | ||
#endif | ||
}); | ||
} | ||
}; | ||
|
||
int main() { | ||
KernelFunctor<> f(DEFAULT_PROBLEM_SIZE); | ||
launchInlineASMTest(f); | ||
return 0; | ||
} |
33 changes: 33 additions & 0 deletions
33
sycl/test/inline-asm/negative_tests/asm_unsup_instruction_divm_skl.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// UNSUPPORTED: cuda | ||
// REQUIRES: gpu,linux | ||
// RUN: %clangxx -fsycl %s -DINLINE_ASM -o %t.out | ||
// RUN: not %t.out 2>&1 | FileCheck %s | ||
|
||
// CHECK: Build succeeded | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder why do we have tests that expected to be successfully built in If these tests require particular HW to catch device program build error, than I suggest to remove them as they are too fragile, IMHO |
||
|
||
#include "../include/asmhelper.h" | ||
#include <CL/sycl.hpp> | ||
|
||
using dataType = cl::sycl::cl_int; | ||
|
||
template <typename T = dataType> | ||
struct KernelFunctor : WithOutputBuffer<T> { | ||
KernelFunctor(size_t problem_size) : WithOutputBuffer<T>(problem_size) {} | ||
|
||
void operator()(cl::sycl::handler &cgh) { | ||
cgh.parallel_for<KernelFunctor<T>>( | ||
cl::sycl::range<1>{this->getOutputBufferSize()}, [=](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] { | ||
#if defined(INLINE_ASM) && defined(__SYCL_DEVICE_ONLY__) | ||
asm volatile(".decl tmp1 v_type=G type=d num_elts=16 align=GRF\n" | ||
".decl tmp2 v_type=G type=d num_elts=16 align=GRF\n" | ||
"divm (M1, 8) tmp1(0,0)<1> tmp2(0,0)<1;1,0> 0x2:f\n"); | ||
#endif | ||
}); | ||
} | ||
}; | ||
|
||
int main() { | ||
KernelFunctor<> f(DEFAULT_PROBLEM_SIZE); | ||
launchInlineASMTest(f); | ||
return 0; | ||
} |
33 changes: 33 additions & 0 deletions
33
sycl/test/inline-asm/negative_tests/asm_unsup_instruction_rol_skl.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// UNSUPPORTED: cuda | ||
// REQUIRES: gpu,linux | ||
// RUN: %clangxx -fsycl %s -DINLINE_ASM -o %t.out | ||
// RUN: not %t.out 2>&1 | FileCheck %s | ||
|
||
// CHECK: Build succeeded | ||
|
||
#include "../include/asmhelper.h" | ||
#include <CL/sycl.hpp> | ||
|
||
using dataType = cl::sycl::cl_int; | ||
|
||
template <typename T = dataType> | ||
struct KernelFunctor : WithOutputBuffer<T> { | ||
KernelFunctor(size_t problem_size) : WithOutputBuffer<T>(problem_size) {} | ||
|
||
void operator()(cl::sycl::handler &cgh) { | ||
cgh.parallel_for<KernelFunctor<T>>( | ||
cl::sycl::range<1>{this->getOutputBufferSize()}, [=](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] { | ||
#if defined(INLINE_ASM) && defined(__SYCL_DEVICE_ONLY__) | ||
asm volatile(".decl tmp1 v_type=G type=d num_elts=16 align=GRF\n" | ||
".decl tmp2 v_type=G type=d num_elts=16 align=GRF\n" | ||
"rol (M1, 8) tmp1(0,0)<1> tmp2(0,0)<1;1,0> 0x2:d\n"); | ||
#endif | ||
}); | ||
} | ||
}; | ||
|
||
int main() { | ||
KernelFunctor<> f(DEFAULT_PROBLEM_SIZE); | ||
launchInlineASMTest(f); | ||
return 0; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this INLINE_ASM macro since you seem to always define it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It remained from positive tests, I will delete it.