mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Merge with Benoit.
This commit is contained in:
commit
9aa7c30163
@ -120,23 +120,23 @@ macro(ei_add_test_internal_sycl testname testname_with_suffix)
|
|||||||
set(filename ${testname}.cpp)
|
set(filename ${testname}.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set( include_file ${CMAKE_CURRENT_BINARY_DIR}/inc_${filename})
|
set( include_file "${CMAKE_CURRENT_BINARY_DIR}/inc_${filename}")
|
||||||
set( bc_file ${CMAKE_CURRENT_BINARY_DIR}/${filename})
|
set( bc_file "${CMAKE_CURRENT_BINARY_DIR}/${filename}.sycl")
|
||||||
set( host_file ${CMAKE_CURRENT_SOURCE_DIR}/${filename})
|
set( host_file "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
|
||||||
|
|
||||||
ADD_CUSTOM_COMMAND(
|
ADD_CUSTOM_COMMAND(
|
||||||
OUTPUT ${include_file}
|
OUTPUT ${include_file}
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo "\\#include \\\"${host_file}\\\"" > ${include_file}
|
COMMAND ${CMAKE_COMMAND} -E echo "\\#include \\\"${host_file}\\\"" > ${include_file}
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo "\\#include \\\"${bc_file}.sycl\\\"" >> ${include_file}
|
COMMAND ${CMAKE_COMMAND} -E echo "\\#include \\\"${bc_file}\\\"" >> ${include_file}
|
||||||
DEPENDS ${filename} ${bc_file}.sycl
|
DEPENDS ${host_file} ${bc_file}
|
||||||
COMMENT "Building ComputeCpp integration header file ${include_file}"
|
COMMENT "Building ComputeCpp integration header file ${include_file}"
|
||||||
)
|
)
|
||||||
# Add a custom target for the generated integration header
|
# Add a custom target for the generated integration header
|
||||||
add_custom_target(${testname}_integration_header_sycl DEPENDS ${include_file})
|
add_custom_target("${testname}_integration_header_sycl" DEPENDS ${include_file})
|
||||||
|
|
||||||
add_executable(${targetname} ${include_file})
|
add_executable(${targetname} ${include_file})
|
||||||
add_dependencies(${targetname} ${testname}_integration_header_sycl)
|
add_dependencies(${targetname} "${testname}_integration_header_sycl")
|
||||||
add_sycl_to_target(${targetname} ${filename} ${CMAKE_CURRENT_BINARY_DIR})
|
add_sycl_to_target(${targetname} ${CMAKE_CURRENT_BINARY_DIR} ${filename})
|
||||||
|
|
||||||
if (targetname MATCHES "^eigen2_")
|
if (targetname MATCHES "^eigen2_")
|
||||||
add_dependencies(eigen2_buildtests ${targetname})
|
add_dependencies(eigen2_buildtests ${targetname})
|
||||||
@ -720,4 +720,4 @@ macro(ei_test_get_compilerver_from_cxx_version_string)
|
|||||||
ei_test1_get_compilerver_from_cxx_version_string("i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)" "llvm-g++" "4.2.1")
|
ei_test1_get_compilerver_from_cxx_version_string("i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)" "llvm-g++" "4.2.1")
|
||||||
ei_test1_get_compilerver_from_cxx_version_string("g++-mp-4.4 (GCC) 4.4.6" "g++" "4.4.6")
|
ei_test1_get_compilerver_from_cxx_version_string("g++-mp-4.4 (GCC) 4.4.6" "g++" "4.4.6")
|
||||||
ei_test1_get_compilerver_from_cxx_version_string("g++-mp-4.4 (GCC) 2011" "g++" "4.4")
|
ei_test1_get_compilerver_from_cxx_version_string("g++-mp-4.4 (GCC) 2011" "g++" "4.4")
|
||||||
endmacro(ei_test_get_compilerver_from_cxx_version_string)
|
endmacro(ei_test_get_compilerver_from_cxx_version_string)
|
@ -201,7 +201,8 @@ function(__build_spir targetName sourceFile binaryDir)
|
|||||||
${device_compiler_includes}
|
${device_compiler_includes}
|
||||||
-o ${outputSyclFile}
|
-o ${outputSyclFile}
|
||||||
-c ${CMAKE_CURRENT_SOURCE_DIR}/${sourceFile}
|
-c ${CMAKE_CURRENT_SOURCE_DIR}/${sourceFile}
|
||||||
DEPENDS ${sourceFile}
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${sourceFile}
|
||||||
|
IMPLICIT_DEPENDS CXX "${CMAKE_CURRENT_SOURCE_DIR}/${sourceFile}"
|
||||||
WORKING_DIRECTORY ${binaryDir}
|
WORKING_DIRECTORY ${binaryDir}
|
||||||
COMMENT "Building ComputeCpp integration header file ${outputSyclFile}")
|
COMMENT "Building ComputeCpp integration header file ${outputSyclFile}")
|
||||||
|
|
||||||
@ -233,8 +234,9 @@ endfunction()
|
|||||||
# sourceFile : Source file to be compiled for SYCL.
|
# sourceFile : Source file to be compiled for SYCL.
|
||||||
# binaryDir : Intermediate directory to output the integration header.
|
# binaryDir : Intermediate directory to output the integration header.
|
||||||
#
|
#
|
||||||
function(add_sycl_to_target targetName sourceFile binaryDir)
|
function(add_sycl_to_target targetName binaryDir sourceFile)
|
||||||
|
|
||||||
|
set(sourceFiles ${sourceFiles} ${ARGN})
|
||||||
# Add custom target to run compute++ and generate the integration header
|
# Add custom target to run compute++ and generate the integration header
|
||||||
__build_spir(${targetName} ${sourceFile} ${binaryDir})
|
__build_spir(${targetName} ${sourceFile} ${binaryDir})
|
||||||
|
|
||||||
@ -242,4 +244,4 @@ function(add_sycl_to_target targetName sourceFile binaryDir)
|
|||||||
target_link_libraries(${targetName} PUBLIC ${COMPUTECPP_RUNTIME_LIBRARY}
|
target_link_libraries(${targetName} PUBLIC ${COMPUTECPP_RUNTIME_LIBRARY}
|
||||||
PUBLIC ${OpenCL_LIBRARIES})
|
PUBLIC ${OpenCL_LIBRARIES})
|
||||||
|
|
||||||
endfunction(add_sycl_to_target)
|
endfunction(add_sycl_to_target)
|
@ -81,28 +81,26 @@ struct memsetCghFunctor{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//get_devices returns all the available opencl devices. Either use device_selector or exclude devices that computecpp does not support (AMD OpenCL for CPU and intel GPU)
|
//get_devices returns all the available opencl devices. Either use device_selector or exclude devices that computecpp does not support (AMD OpenCL for CPU and intel GPU)
|
||||||
EIGEN_STRONG_INLINE auto get_sycl_supported_devices()->decltype(cl::sycl::device::get_devices()){
|
EIGEN_STRONG_INLINE auto get_sycl_supported_devices()->decltype(cl::sycl::device::get_devices()){
|
||||||
auto devices = cl::sycl::device::get_devices();
|
std::vector<cl::sycl::device> supported_devices;
|
||||||
std::vector<cl::sycl::device>::iterator it =devices.begin();
|
auto plafrom_list =cl::sycl::platform::get_platforms();
|
||||||
while(it!=devices.end()) {
|
for(const auto& platform : plafrom_list){
|
||||||
///FIXME: Currently there is a bug in amd cpu OpenCL
|
auto device_list = platform.get_devices();
|
||||||
auto name = (*it).template get_info<cl::sycl::info::device::name>();
|
auto platform_name =platform.template get_info<cl::sycl::info::platform::name>();
|
||||||
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
|
std::transform(platform_name.begin(), platform_name.end(), platform_name.begin(), ::tolower);
|
||||||
auto vendor = (*it).template get_info<cl::sycl::info::device::vendor>();
|
for(const auto& device : device_list){
|
||||||
|
auto vendor = device.template get_info<cl::sycl::info::device::vendor>();
|
||||||
std::transform(vendor.begin(), vendor.end(), vendor.begin(), ::tolower);
|
std::transform(vendor.begin(), vendor.end(), vendor.begin(), ::tolower);
|
||||||
|
bool unsuported_condition = (device.is_cpu() && platform_name.find("amd")!=std::string::npos && vendor.find("apu") == std::string::npos) ||
|
||||||
if((*it).is_cpu() && vendor.find("amd")!=std::string::npos && vendor.find("apu") == std::string::npos){ // remove amd cpu as it is not supported by computecpp allow APUs
|
(device.is_gpu() && platform_name.find("intel")!=std::string::npos);
|
||||||
it = devices.erase(it);
|
if(!unsuported_condition){
|
||||||
//FIXME: currently there is a bug in intel gpu driver regarding memory allignment issue.
|
std::cout << "Platform name "<< platform_name << std::endl;
|
||||||
}else if((*it).is_gpu() && name.find("intel")!=std::string::npos){
|
supported_devices.push_back(device);
|
||||||
it = devices.erase(it);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return devices;
|
}
|
||||||
|
return supported_devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
class QueueInterface {
|
class QueueInterface {
|
||||||
|
@ -172,7 +172,7 @@ if(EIGEN_TEST_CXX11)
|
|||||||
ei_add_test_sycl(cxx11_tensor_generator_sycl "-std=c++11")
|
ei_add_test_sycl(cxx11_tensor_generator_sycl "-std=c++11")
|
||||||
ei_add_test_sycl(cxx11_tensor_patch_sycl "-std=c++11")
|
ei_add_test_sycl(cxx11_tensor_patch_sycl "-std=c++11")
|
||||||
ei_add_test_sycl(cxx11_tensor_image_patch_sycl "-std=c++11")
|
ei_add_test_sycl(cxx11_tensor_image_patch_sycl "-std=c++11")
|
||||||
ei_add_test_sycl(cxx11_tensor_volume_patcP_sycl "-std=c++11")
|
ei_add_test_sycl(cxx11_tensor_volume_patch_sycl "-std=c++11")
|
||||||
ei_add_test_sycl(cxx11_tensor_argmax_sycl "-std=c++11")
|
ei_add_test_sycl(cxx11_tensor_argmax_sycl "-std=c++11")
|
||||||
ei_add_test_sycl(cxx11_tensor_custom_op_sycl "-std=c++11")
|
ei_add_test_sycl(cxx11_tensor_custom_op_sycl "-std=c++11")
|
||||||
endif(EIGEN_TEST_SYCL)
|
endif(EIGEN_TEST_SYCL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user