mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
[SYCL] Fix some SYCL tests
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
27367017bd
commit
2f7cce2dd5
@@ -86,7 +86,8 @@ void test_unary_builtins_for_scalar(const Eigen::SyclDevice& sycl_device,
|
||||
{
|
||||
/* Assignment(out, Operator(out)) */
|
||||
Tensor<DataType, 3, DataLayout, int64_t> out(tensor_range);
|
||||
out = out.random() + DataType(0.01);
|
||||
// Offset with 1 to avoid tiny output (< 1e-6) as they can easily fail.
|
||||
out = out.random() + DataType(1);
|
||||
Tensor<DataType, 3, DataLayout, int64_t> reference(out);
|
||||
DataType *gpu_data_out = static_cast<DataType *>(
|
||||
sycl_device.allocate(out.size() * sizeof(DataType)));
|
||||
|
||||
@@ -94,12 +94,8 @@ template<typename DataType, typename dev_Selector> void sycl_computing_test_per_
|
||||
auto sycl_device = Eigen::SyclDevice(&queueInterface);
|
||||
test_tanh_sycl<DataType, RowMajor, int64_t>(sycl_device);
|
||||
test_tanh_sycl<DataType, ColMajor, int64_t>(sycl_device);
|
||||
// Sigmoid broke for SYCL as of 0b5873 because of missing functions in PacketMath.h.
|
||||
// Disable the test for now.
|
||||
#if 0
|
||||
test_sigmoid_sycl<DataType, RowMajor, int64_t>(sycl_device);
|
||||
test_sigmoid_sycl<DataType, ColMajor, int64_t>(sycl_device);
|
||||
#endif
|
||||
}
|
||||
|
||||
EIGEN_DECLARE_TEST(cxx11_tensor_math_sycl) {
|
||||
|
||||
@@ -37,14 +37,8 @@ static void test_sycl_random_uniform(const Eigen::SyclDevice& sycl_device)
|
||||
|
||||
gpu_out.device(sycl_device)=gpu_out.random();
|
||||
sycl_device.memcpyDeviceToHost(out.data(), d_out,out_bytes);
|
||||
for(IndexType i=1; i<sizeDim0; i++)
|
||||
for(IndexType j=1; j<sizeDim1; j++)
|
||||
{
|
||||
VERIFY_IS_NOT_EQUAL(out(i,j), out(i-1,j));
|
||||
VERIFY_IS_NOT_EQUAL(out(i,j), out(i,j-1));
|
||||
VERIFY_IS_NOT_EQUAL(out(i,j), out(i-1,j-1)); }
|
||||
|
||||
// For now we just check thes code doesn't crash.
|
||||
// For now we just check the code doesn't crash.
|
||||
// TODO: come up with a valid test of randomness
|
||||
sycl_device.deallocate(d_out);
|
||||
}
|
||||
@@ -66,16 +60,8 @@ void test_sycl_random_normal(const Eigen::SyclDevice& sycl_device)
|
||||
Eigen::internal::NormalRandomGenerator<DataType> gen(true);
|
||||
gpu_out.device(sycl_device)=gpu_out.random(gen);
|
||||
sycl_device.memcpyDeviceToHost(out.data(), d_out,out_bytes);
|
||||
for(IndexType i=1; i<sizeDim0; i++)
|
||||
for(IndexType j=1; j<sizeDim1; j++)
|
||||
{
|
||||
VERIFY_IS_NOT_EQUAL(out(i,j), out(i-1,j));
|
||||
VERIFY_IS_NOT_EQUAL(out(i,j), out(i,j-1));
|
||||
VERIFY_IS_NOT_EQUAL(out(i,j), out(i-1,j-1));
|
||||
|
||||
}
|
||||
|
||||
// For now we just check thes code doesn't crash.
|
||||
// For now we just check the code doesn't crash.
|
||||
// TODO: come up with a valid test of randomness
|
||||
sycl_device.deallocate(d_out);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user