Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

DPC++ compilation #96

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions CMakeLists.txt
Expand Up @@ -3,8 +3,8 @@ project (SyclSTL)

enable_testing()

option(PARALLEL_STL_BENCHMARKS "Build the internal benchmarks" OFF)
option(USE_COMPUTECPP "Use ComputeCPP" ON)
option(PARALLEL_STL_BENCHMARKS "Build the internal benchmarks" ON)
option(USE_COMPUTECPP "Use ComputeCPP" OFF)

message(STATUS " Path to CMAKE source directory: ${CMAKE_SOURCE_DIR} ")
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules/)
Expand All @@ -27,8 +27,8 @@ if (USE_COMPUTECPP)


else()
message(STATUS " Using triSYCL CMake")
include(FindTriSYCL)
message(STATUS " Using alternate CMake")
# include(FindTriSYCL)
endif()


Expand All @@ -37,8 +37,10 @@ include_directories("include")

add_subdirectory (src)
add_subdirectory (examples)
add_subdirectory (tests)
# add_subdirectory (tests)

add_definitions(-fsycl)
add_link_options(-fsycl)
if (PARALLEL_STL_BENCHMARKS)
add_subdirectory (benchmarks)
endif()
5 changes: 3 additions & 2 deletions benchmarks/CMakeLists.txt
Expand Up @@ -12,8 +12,9 @@ foreach(file ${EXAMPLE_FILES})

target_link_libraries(${SOURCE_NAME} PUBLIC ${CMAKE_THREAD_LIBS_INIT})

add_sycl_to_target(${SOURCE_NAME} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp)
# add_sycl_to_target(${SOURCE_NAME} ${CMAKE_CURRENT_BINARY_DIR}
# ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp)
target_compile_options(${SOURCE_NAME} PRIVATE -fsycl)


endforeach()
2 changes: 1 addition & 1 deletion benchmarks/sycl_reduce.cpp
Expand Up @@ -56,7 +56,7 @@ benchmark<>::time_units_t benchmark_reduce(const unsigned numReps,
cl::sycl::queue q(cds);
auto device = q.get_device();
const cl::sycl::id<3> maxWorkItemSizes =
device.get_info<cl::sycl::info::device::max_work_item_sizes>();
device.get_info<cl::sycl::info::device::max_work_item_sizes<3>>();
const auto local = std::min(
device.get_info<cl::sycl::info::device::max_work_group_size>(),
maxWorkItemSizes[0]);
Expand Down
6 changes: 4 additions & 2 deletions examples/CMakeLists.txt
Expand Up @@ -13,7 +13,9 @@ foreach(file ${BENCHMARK_FILES})
target_compile_options(${SOURCE_NAME} PUBLIC ${HOST_COMPILER_OPTIONS})
target_link_libraries(${SOURCE_NAME} PUBLIC ${CMAKE_THREAD_LIBS_INIT})

add_sycl_to_target(${SOURCE_NAME} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp )
# add_sycl_to_target(${SOURCE_NAME} ${CMAKE_CURRENT_BINARY_DIR}
# ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp )
add_definitions(-fsycl)
add_link_options(-fsycl)

endforeach()
6 changes: 3 additions & 3 deletions include/sycl/algorithm/buffer_algorithms.hpp
Expand Up @@ -87,8 +87,8 @@ sycl_algorithm_descriptor compute_mapreduce_descriptor(cl::sycl::device device,
size_t max_work_group =
device.get_info<cl::sycl::info::device::max_compute_units>();

const cl::sycl::id<3>max_work_item_sizes =
device.get_info<cl::sycl::info::device::max_work_item_sizes>();
const auto max_work_item_sizes =
device.get_info<cl::sycl::info::device::max_work_item_sizes<3>>();
const auto max_work_item = min(
device.get_info<cl::sycl::info::device::max_work_group_size>(),
max_work_item_sizes[0]);
Expand Down Expand Up @@ -344,7 +344,7 @@ sycl_algorithm_descriptor compute_mapscan_descriptor(cl::sycl::device device,
size_t nb_work_group = up_rounded_division(size, size_per_work_group);

const cl::sycl::id<3> max_work_item_sizes =
device.get_info<cl::sycl::info::device::max_work_item_sizes>();
device.get_info<cl::sycl::info::device::max_work_item_sizes<3>>();
const auto max_work_item = min(
device.get_info<cl::sycl::info::device::max_work_group_size>(),
max_work_item_sizes[0]);
Expand Down
2 changes: 1 addition & 1 deletion include/sycl/algorithm/sort.hpp
Expand Up @@ -155,7 +155,7 @@ void sequential_sort(cl::sycl::queue q, cl::sycl::buffer<T, 1, Alloc> buf,
size_t vectorSize) {
auto f = [buf, vectorSize](cl::sycl::handler &h) mutable {
auto a = buf.template get_access<cl::sycl::access::mode::read_write>(h);
h.single_task(sort_kernel_sequential<T>(a, vectorSize));
// h.single_task(sort_kernel_sequential<T>(a, vectorSize));
};
q.submit(f);
}
Expand Down
2 changes: 1 addition & 1 deletion include/sycl/execution_policy
Expand Up @@ -106,7 +106,7 @@ class sycl_execution_policy {
cl::sycl::nd_range<1> calculateNdRange(size_t problemSize) {
const auto& d = m_q.get_device();
const cl::sycl::id<3> maxWorkItemSizes =
d.template get_info<cl::sycl::info::device::max_work_item_sizes>();
d.template get_info<cl::sycl::info::device::max_work_item_sizes<3>>();
const auto localSize = std::min(problemSize,
std::min(
d.template get_info<cl::sycl::info::device::max_work_group_size>(),
Expand Down
3 changes: 1 addition & 2 deletions include/sycl/helpers/sycl_namegen.hpp
Expand Up @@ -35,7 +35,7 @@
#define _EXPERIMENTAL_DETAIL_SYCL_NAMEGEN__

namespace cl {
namespace sycl {
using namespace sycl;
namespace helpers {

/**
Expand All @@ -47,6 +47,5 @@ template <int Index, typename... Details>
class NameGen {};
}
}
}

#endif // _EXPERIMENTAL_DETAIL_SYCL_NAMEGEN__
5 changes: 3 additions & 2 deletions tests/pstl-tests/CMakeLists.txt
Expand Up @@ -9,8 +9,9 @@ function(compile_test source)
PUBLIC "${CMAKE_THREAD_LIBS_INIT}")
add_dependencies(${test_name} gtest_main)
add_dependencies(${test_name} gtest)
add_sycl_to_target(${test_name} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${source})
# add_sycl_to_target(${test_name} ${CMAKE_CURRENT_BINARY_DIR}
# ${CMAKE_CURRENT_SOURCE_DIR}/${source})
target_compile_options(${test_name} PRIVATE -fsycl)
add_test(test.${test_name} ${test_name})
endfunction()

Expand Down