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

[SYCL-MLIR] Start with only the single_task.cpp test case #1330

Merged
merged 4 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions SYCL/Basic/single_task.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
// REQUIRES: linux

#include <sycl/sycl.hpp>
using namespace sycl;

void host_single_task(std::array<int, 1> &A) {
auto q = queue{};
device d = q.get_device();
std::cout << "Using " << d.get_info<info::device::name>() << "\n";

{
auto buf = buffer<int, 1>{A.data(), 1};
q.submit([&](handler &cgh) {
auto A = buf.get_access<access::mode::write>(cgh);
cgh.single_task<class kernel_single_task>([=]() {
A[0] = 1;
});
});
}
}

int main() {
std::array<int, 1> A = {0};
A[0] = 0;
host_single_task(A);
assert(A[0] == 1);
std::cout << "Test passed" << std::endl;
}
3 changes: 2 additions & 1 deletion SYCL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ if(CHECK_SYCL_ALL)
string(REPLACE "," "_" TARGET check-sycl-${TARGET_BE}-${TARGET_DEVICES})

add_custom_target(${TARGET}
COMMAND python3 ${TEST_SUITE_LIT} ${TEST_SUITE_LIT_FLAGS} --param sycl_be=${TARGET_BE} --param target_devices=${TARGET_DEVICES} .
# HACK: Only run test files in cgeist directory.
COMMAND python3 ${TEST_SUITE_LIT} ${TEST_SUITE_LIT_FLAGS} --filter=Basic/single_task.cpp --param sycl_be=${TARGET_BE} --param target_devices=${TARGET_DEVICES} .
COMMENT "Running the SYCL tests for ${TARGET} backend"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${TEST_SUITE_TARGETS}
Expand Down
6 changes: 3 additions & 3 deletions SYCL/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,11 @@
config.substitutions.append( ('%ACC_CHECK_PLACEHOLDER', acc_check_substitute) )

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

if find_executable('sycl-ls'):
config.available_features.add('sycl-ls')
Expand Down