Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit b8c6aa0

Browse files
[SYCL-MLIR] Start with only the single_task.cpp test case (#1330)
Signed-off-by: Tsang, Whitney <[email protected]>
1 parent 283c598 commit b8c6aa0

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

SYCL/Basic/single_task.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2+
// RUN: %CPU_RUN_PLACEHOLDER %t.out
3+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
4+
// RUN: %ACC_RUN_PLACEHOLDER %t.out
5+
// REQUIRES: linux
6+
7+
#include <sycl/sycl.hpp>
8+
using namespace sycl;
9+
10+
void host_single_task(std::array<int, 1> &A) {
11+
auto q = queue{};
12+
device d = q.get_device();
13+
std::cout << "Using " << d.get_info<info::device::name>() << "\n";
14+
15+
{
16+
auto buf = buffer<int, 1>{A.data(), 1};
17+
q.submit([&](handler &cgh) {
18+
auto A = buf.get_access<access::mode::write>(cgh);
19+
cgh.single_task<class kernel_single_task>([=]() {
20+
A[0] = 1;
21+
});
22+
});
23+
}
24+
}
25+
26+
int main() {
27+
std::array<int, 1> A = {0};
28+
A[0] = 0;
29+
host_single_task(A);
30+
assert(A[0] == 1);
31+
std::cout << "Test passed" << std::endl;
32+
}

SYCL/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ if(CHECK_SYCL_ALL)
2727
string(REPLACE "," "_" TARGET check-sycl-${TARGET_BE}-${TARGET_DEVICES})
2828

2929
add_custom_target(${TARGET}
30-
COMMAND python3 ${TEST_SUITE_LIT} ${TEST_SUITE_LIT_FLAGS} --param sycl_be=${TARGET_BE} --param target_devices=${TARGET_DEVICES} .
30+
# HACK: Only run test files in cgeist directory.
31+
COMMAND python3 ${TEST_SUITE_LIT} ${TEST_SUITE_LIT_FLAGS} --filter=Basic/single_task.cpp --param sycl_be=${TARGET_BE} --param target_devices=${TARGET_DEVICES} .
3132
COMMENT "Running the SYCL tests for ${TARGET} backend"
3233
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
3334
DEPENDS ${TEST_SUITE_TARGETS}

SYCL/lit.cfg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,11 @@
387387
config.substitutions.append( ('%ACC_CHECK_PLACEHOLDER', acc_check_substitute) )
388388

389389
if config.sycl_be == 'ext_oneapi_cuda' or (config.sycl_be == 'ext_oneapi_hip' and config.hip_platform == 'NVIDIA'):
390-
config.substitutions.append( ('%sycl_triple', "nvptx64-nvidia-cuda" ) )
390+
config.substitutions.append( ('%sycl_triple', "nvptx64-nvidia-cuda-syclmlir" ) )
391391
elif config.sycl_be == 'ext_oneapi_hip' and config.hip_platform == 'AMD':
392-
config.substitutions.append( ('%sycl_triple', "amdgcn-amd-amdhsa" ) )
392+
config.substitutions.append( ('%sycl_triple', "amdgcn-amd-amdhsa-syclmlir" ) )
393393
else:
394-
config.substitutions.append( ('%sycl_triple', "spir64" ) )
394+
config.substitutions.append( ('%sycl_triple', "spir64-unknown-unknown-syclmlir" ) )
395395

396396
if find_executable('sycl-ls'):
397397
config.available_features.add('sycl-ls')

0 commit comments

Comments
 (0)