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

Commit 004760e

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

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if(CHECK_SYCL_ALL)
3333
endif()
3434

3535
add_custom_target(${TARGET}
36-
COMMAND ${SYCL_PYTHON} ${TEST_SUITE_LIT} ${TEST_SUITE_LIT_FLAGS} --param sycl_be=${TARGET_BE} --param target_devices=${TARGET_DEVICES} .
36+
COMMAND ${SYCL_PYTHON} ${TEST_SUITE_LIT} ${TEST_SUITE_LIT_FLAGS} --filter=Basic/single_task.cpp --param sycl_be=${TARGET_BE} --param target_devices=${TARGET_DEVICES} .
3737
COMMENT "Running the SYCL tests for ${TARGET} backend"
3838
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
3939
DEPENDS ${TEST_SUITE_TARGETS}

SYCL/lit.cfg.py

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

378378
if config.sycl_be == 'ext_oneapi_cuda' or (config.sycl_be == 'ext_oneapi_hip' and config.hip_platform == 'NVIDIA'):
379-
config.substitutions.append( ('%sycl_triple', "nvptx64-nvidia-cuda" ) )
379+
config.substitutions.append( ('%sycl_triple', "nvptx64-nvidia-cuda-syclmlir" ) )
380380
elif config.sycl_be == 'ext_oneapi_hip' and config.hip_platform == 'AMD':
381-
config.substitutions.append( ('%sycl_triple', "amdgcn-amd-amdhsa" ) )
381+
config.substitutions.append( ('%sycl_triple', "amdgcn-amd-amdhsa-syclmlir" ) )
382382
else:
383-
config.substitutions.append( ('%sycl_triple', "spir64" ) )
383+
config.substitutions.append( ('%sycl_triple', "spir64-unknown-unknown-syclmlir" ) )
384384

385385
if find_executable('sycl-ls'):
386386
config.available_features.add('sycl-ls')

0 commit comments

Comments
 (0)