Skip to content

Commit cc20098

Browse files
[SYCL] Enable inline asm tests in check-sycl (#1845)
Moved them from 'feature-tests' directory Fixed/adjusted/disabled some tests
1 parent 7e3d66d commit cc20098

23 files changed

+25
-30
lines changed

sycl/test/CMakeLists.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,6 @@ add_lit_testsuites(SYCL-DEPLOY ${CMAKE_CURRENT_SOURCE_DIR}
6363
EXCLUDE_FROM_CHECK_ALL
6464
)
6565

66-
add_lit_target(check-sycl-inline-asm
67-
"Running lit suite ${CMAKE_CURRENT_SOURCE_DIR}/feature-tests/inline-asm"
68-
"feature-tests/inline-asm"
69-
ARGS ${RT_TEST_ARGS}
70-
PARAMS "SYCL_BE=PI_OPENCL"
71-
DEPENDS ${SYCL_TEST_DEPS}
72-
)
73-
set_target_properties(check-sycl-inline-asm PROPERTIES FOLDER "SYCL tests")
74-
7566
add_lit_testsuite(check-sycl-opencl "Running the SYCL regression tests for OpenCL"
7667
${CMAKE_CURRENT_BINARY_DIR}
7768
ARGS ${RT_TEST_ARGS}

sycl/test/feature-tests/inline-asm/asm_arbitrary_ops_order.cpp renamed to sycl/test/inline-asm/asm_arbitrary_ops_order.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
// UNSUPPORTED: cuda
21
// REQUIRES: gpu,linux
3-
// RUN: %clangxx -fsycl %s -DINLINE_ASM -o %t.out
4-
// RUN: %t.out
2+
// This test is disabled because there is a bug somewhere either in test or in
3+
// the inline asm support
4+
// FIXME: debug an issue and enable test back
5+
// RUNx: %clangxx -fsycl %s -DINLINE_ASM -o %t.out
6+
// RUNx: %t.out
57
// RUN: %clangxx -fsycl %s -o %t.ref.out
68
// RUN: %t.ref.out
79

@@ -23,11 +25,12 @@ struct KernelFunctor : WithInputBuffers<T, 3>, WithOutputBuffer<T> {
2325
auto D = this->getOutputBuffer().template get_access<cl::sycl::access::mode::write>(cgh);
2426

2527
cgh.parallel_for<KernelFunctor<T>>(
26-
cl::sycl::range<1>{this->getOutputBufferSize()}, [=](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] {
28+
cl::sycl::range<1>{this->getOutputBufferSize()}, [=
29+
](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] {
2730
#if defined(INLINE_ASM) && defined(__SYCL_DEVICE_ONLY__)
2831
asm("mad (M1, 8) %0(0, 0)<1> %3(0, 0)<1;1,0> %1(0, 0)<1;1,0> %2(0, 0)<1;1,0>"
2932
: "=rw"(D[wiID])
30-
: "rw"(B[wiID]), "rw"(C[wiID]), "rw"(A[wiID]));
33+
: "rw"(A[wiID]), "rw"(B[wiID]), "rw"(C[wiID]));
3134
#else
3235
D[wiID] = A[wiID] * B[wiID] + C[wiID];
3336
#endif

sycl/test/feature-tests/inline-asm/asm_float_imm_arg.cpp renamed to sycl/test/inline-asm/asm_float_imm_arg.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ struct KernelFunctor : WithInputBuffers<T, 1>, WithOutputBuffer<T> {
2323
auto B = this->getOutputBuffer().template get_access<cl::sycl::access::mode::write>(cgh);
2424

2525
cgh.parallel_for<KernelFunctor<T>>(
26-
cl::sycl::range<1>{this->getOutputBufferSize()}, [=](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] {
26+
cl::sycl::range<1>{this->getOutputBufferSize()}, [=
27+
](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] {
2728
#if defined(INLINE_ASM) && defined(__SYCL_DEVICE_ONLY__)
2829
asm("mul (M1, 8) %0(0, 0)<1> %1(0, 0)<1;1,0> %2"
2930
: "=rw"(B[wiID])
30-
: "rw"(A[wiID]), "rw"(IMM_ARGUMENT));
31+
: "rw"(A[wiID]), "i"(IMM_ARGUMENT));
3132
#else
3233
B[wiID] = A[wiID] * IMM_ARGUMENT;
3334
#endif

sycl/test/feature-tests/inline-asm/asm_imm_arg.cpp renamed to sycl/test/inline-asm/asm_imm_arg.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ struct KernelFunctor : WithInputBuffers<T, 1>, WithOutputBuffer<T> {
2222
auto B = this->getOutputBuffer().template get_access<cl::sycl::access::mode::write>(cgh);
2323

2424
cgh.parallel_for<KernelFunctor<T>>(
25-
cl::sycl::range<1>{this->getOutputBufferSize()}, [=](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] {
25+
cl::sycl::range<1>{this->getOutputBufferSize()}, [=
26+
](cl::sycl::id<1> wiID) [[cl::intel_reqd_sub_group_size(8)]] {
2627
#if defined(INLINE_ASM) && defined(__SYCL_DEVICE_ONLY__)
2728
asm("add (M1, 8) %0(0, 0)<1> %1(0, 0)<1;1,0> %2"
2829
: "=rw"(B[wiID])
29-
: "rw"(A[wiID]), "rw"(CONST_ARGUMENT));
30+
: "rw"(A[wiID]), "i"(CONST_ARGUMENT));
3031
#else
3132
B[wiID] = A[wiID] + CONST_ARGUMENT;
3233
#endif

sycl/test/feature-tests/inline-asm/asm_multiple_instructions.cpp renamed to sycl/test/inline-asm/asm_multiple_instructions.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
// UNSUPPORTED: cuda
21
// REQUIRES: gpu,linux
3-
// RUN: %clangxx -fsycl %s -DINLINE_ASM -o %t.out
4-
// RUN: %t.out
2+
// This test is disabled because there is a bug somewhere either in test or in
3+
// the inline asm support
4+
// FIXME: debug an issue and enable test back
5+
// RUNx: %clangxx -fsycl %s -DINLINE_ASM -o %t.out
6+
// RUNx: %t.out
57
// RUN: %clangxx -fsycl %s -o %t.ref.out
68
// RUN: %t.ref.out
79

sycl/test/feature-tests/inline-asm/include/asmhelper.h renamed to sycl/test/inline-asm/include/asmhelper.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ struct WithInputBuffers {
6262
void constructorHelper(const std::vector<T> &data, Args... rest) {
6363
_input_buffers_data[Index] = data;
6464
_input_buffers[Index].reset(new cl::sycl::buffer<T>(_input_buffers_data[Index].data(), _input_buffers_data[Index].size()));
65+
_input_buffers[Index]->set_final_data(nullptr);
6566
constructorHelper<Index + 1>(rest...);
6667
}
6768

@@ -79,12 +80,7 @@ bool isInlineASMSupported(sycl::device Device) {
7980
// defined
8081
if (DeviceVendorName.find("Intel") == sycl::string_class::npos)
8182
return false;
82-
if (DriverVersion.length() < 5)
83-
return false;
84-
if (DriverVersion[2] != '.')
85-
return false;
86-
if (std::stoi(DriverVersion.substr(0, 2), nullptr, 10) < 20 || std::stoi(DriverVersion.substr(3, 2), nullptr, 10) < 12)
87-
return false;
83+
8884
return true;
8985
}
9086

@@ -113,6 +109,7 @@ bool launchInlineASMTest(F &f, bool requires_particular_sg_size = true) {
113109
} catch (cl::sycl::exception &e) {
114110
std::cerr << "Caught exception: " << e.what() << std::endl;
115111
}
112+
116113
return true;
117114
}
118115

sycl/test/feature-tests/inline-asm/malloc_shared_32.cpp renamed to sycl/test/inline-asm/malloc_shared_32.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ int main() {
6868

6969
bool currect = true;
7070
for (int i = 0; i < problem_size; i++) {
71-
if (b[i] != a[i] * b[i]) {
71+
if (b[i] != a[i] * c[i]) {
7272
currect = false;
73-
std::cerr << "error in a[" << i << "]="
74-
<< b[i] << "!=" << a[i] * b[i] << std::endl;
73+
std::cerr << "error in a[" << i << "]=" << b[i] << "!=" << a[i] * c[i]
74+
<< std::endl;
7575
break;
7676
}
7777
}

0 commit comments

Comments
 (0)