-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #242 from kopylovanat/oneapi_property_list
Add tests for oneapi extension compile-time property_list
- Loading branch information
Showing
5 changed files
with
326 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
tests/extension/oneapi_property_list/property_list_different_order.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/******************************************************************************* | ||
// | ||
// SYCL 2020 Extension Conformance Test | ||
// | ||
// Provides test for compile-time property_list initialized with different | ||
// order | ||
// | ||
*******************************************************************************/ | ||
|
||
#include "../../common/common.h" | ||
|
||
#define TEST_NAME property_list_different_order | ||
|
||
namespace TEST_NAMESPACE { | ||
|
||
using namespace sycl_cts; | ||
|
||
/** test compile-time property_list initialized with different order | ||
*/ | ||
class TEST_NAME : public util::test_base { | ||
public: | ||
/** return information about this test | ||
*/ | ||
void get_info(test_base::info &out) const override { | ||
set_test_info(out, TOSTRING(TEST_NAME), TEST_FILE); | ||
} | ||
|
||
/** execute the test | ||
*/ | ||
void run(util::logger &log) override { | ||
#if !defined(SYCL_EXT_ONEAPI_PROPERTY_LIST) | ||
WARN("SYCL_EXT_ONEAPI_PROPERTY_LIST is not defined, test is skipped"); | ||
#elif !defined(SYCL_EXT_ONEAPI_DEVICE_GLOBAL) | ||
WARN("SYCL_EXT_ONEAPI_DEVICE_GLOBAL is not defined, test is skipped"); | ||
#else | ||
{ | ||
using namespace sycl::ext::oneapi; | ||
property_list P1{implement_in_csr_v<true>, device_image_scope_v}; | ||
property_list P2{device_image_scope_v, implement_in_csr_v<true>}; | ||
if (!std::is_same_v<decltype(P1), decltype(P2)>) | ||
FAIL(log, | ||
"property lists initialized with different order are not the same " | ||
"type"); | ||
} | ||
#endif | ||
} | ||
}; | ||
|
||
// register this test with the test_collection. | ||
util::test_proxy<TEST_NAME> proxy; | ||
|
||
} /* namespace TEST_NAMESPACE */ |
57 changes: 57 additions & 0 deletions
57
tests/extension/oneapi_property_list/property_list_has_property.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/******************************************************************************* | ||
// | ||
// SYCL 2020 Extension Conformance Test | ||
// | ||
// Provides test for compile-time property_list::has_property | ||
// | ||
*******************************************************************************/ | ||
|
||
#include "../../common/common.h" | ||
|
||
#define TEST_NAME property_list_has_property | ||
|
||
namespace TEST_NAMESPACE { | ||
|
||
using namespace sycl_cts; | ||
|
||
/** test compile-time property_list::has_property | ||
*/ | ||
class TEST_NAME : public util::test_base { | ||
public: | ||
/** return information about this test | ||
*/ | ||
void get_info(test_base::info &out) const override { | ||
set_test_info(out, TOSTRING(TEST_NAME), TEST_FILE); | ||
} | ||
|
||
/** execute the test | ||
*/ | ||
void run(util::logger &log) override { | ||
#if !defined(SYCL_EXT_ONEAPI_PROPERTY_LIST) | ||
WARN("SYCL_EXT_ONEAPI_PROPERTY_LIST is not defined, test is skipped"); | ||
#elif !defined(SYCL_EXT_ONEAPI_DEVICE_GLOBAL) | ||
WARN("SYCL_EXT_ONEAPI_DEVICE_GLOBAL is not defined, test is skipped"); | ||
#else | ||
{ | ||
using namespace sycl::ext::oneapi; | ||
property_list prop_list{device_image_scope_v, implement_in_csr_v<true>, | ||
host_access_v<host_access::access::read>}; | ||
|
||
if (!prop_list.has_property<device_image_scope>()) | ||
FAIL(log, "property_list should have device_image_scope property"); | ||
if (!prop_list.has_property<implement_in_csr>()) | ||
FAIL(log, "property_list should have implement_in_csr property"); | ||
if (!prop_list.has_property<host_access>()) | ||
FAIL(log, "property_list should have host_access property"); | ||
|
||
if (prop_list.has_property<init_mode>()) | ||
FAIL(log, "property_list shouldn't have init_mode property"); | ||
} | ||
#endif | ||
} | ||
}; | ||
|
||
// register this test with the test_collection. | ||
util::test_proxy<TEST_NAME> proxy; | ||
|
||
} /* namespace TEST_NAMESPACE */ |
97 changes: 97 additions & 0 deletions
97
tests/extension/oneapi_property_list/property_list_is_device_copyable.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/******************************************************************************* | ||
// | ||
// SYCL 2020 Extension Conformance Test | ||
// | ||
// Provides test for sycl::is_device_copyable for compile-time properties | ||
// | ||
*******************************************************************************/ | ||
|
||
#include "../../common/common.h" | ||
|
||
#define TEST_NAME property_list_is_device_copyable | ||
|
||
namespace TEST_NAMESPACE { | ||
|
||
using namespace sycl_cts; | ||
|
||
/** test sycl::is_device_copyable for compile-time properties | ||
*/ | ||
class TEST_NAME : public util::test_base { | ||
public: | ||
/** return information about this test | ||
*/ | ||
void get_info(test_base::info &out) const override { | ||
set_test_info(out, TOSTRING(TEST_NAME), TEST_FILE); | ||
} | ||
|
||
/** execute the test | ||
*/ | ||
void run(util::logger &log) override { | ||
#if !defined(SYCL_EXT_ONEAPI_PROPERTY_LIST) | ||
WARN("SYCL_EXT_ONEAPI_PROPERTY_LIST is not defined, test is skipped"); | ||
#elif !defined(SYCL_EXT_ONEAPI_DEVICE_GLOBAL) | ||
WARN("SYCL_EXT_ONEAPI_DEVICE_GLOBAL is not defined, test is skipped"); | ||
#else | ||
{ | ||
using namespace sycl::ext::oneapi; | ||
|
||
// is_device_copyable for compile-time-constant properties | ||
if (!sycl::is_device_copyable_v<decltype(device_image_scope_v)>) | ||
FAIL(log, "is_device_copyable_v for device_image_scope_v is not true"); | ||
if (!sycl::is_device_copyable_v<decltype( | ||
host_access_v<host_access::access::read>)>) | ||
FAIL( | ||
log, | ||
"is_device_copyable_v for host_access_v<access::read> is not true"); | ||
if (!sycl::is_device_copyable_v<decltype( | ||
host_access_v<host_access::access::write>)>) | ||
FAIL(log, | ||
"is_device_copyable_v for host_access_v<access::write> is not " | ||
"true"); | ||
if (!sycl::is_device_copyable_v<decltype( | ||
host_access_v<host_access::access::read_write>)>) | ||
FAIL(log, | ||
"is_device_copyable_v for host_access_v<access::read_write> is " | ||
"not true"); | ||
if (!sycl::is_device_copyable_v<decltype( | ||
host_access_v<host_access::access::none>)>) | ||
FAIL( | ||
log, | ||
"is_device_copyable_v for host_access_v<access::none> is not true"); | ||
if (!sycl::is_device_copyable_v<decltype( | ||
init_mode_v<init_mode::trigger::reprogram>)>) | ||
FAIL(log, | ||
"is_device_copyable_v for init_mode_v<trigger::reprogram is not " | ||
"true"); | ||
if (!sycl::is_device_copyable_v<decltype( | ||
init_mode_v<init_mode::trigger::reset>)>) | ||
FAIL(log, | ||
"is_device_copyable_v for init_mode_v<trigger::reset is not true"); | ||
if (!sycl::is_device_copyable_v<decltype(implement_in_csr_v<true>)>) | ||
FAIL(log, | ||
"is_device_copyable_v for implement_in_csr_v<true> is not true"); | ||
if (!sycl::is_device_copyable_v<decltype(implement_in_csr_v<false>)>) | ||
FAIL(log, | ||
"is_device_copyable_v for implement_in_csr_v<false> is not true"); | ||
|
||
// is_device_copyable for empty property_list | ||
property_list prop_list1{}; | ||
if (!sycl::is_device_copyable_v<decltype(prop_list1)>) | ||
FAIL(log, "is_device_copyable_v for empty property_list is not true"); | ||
|
||
// is_device_copyable for property_list with only compile-time-constant | ||
// properties | ||
property_list prop_list2{implement_in_csr_v<true>, device_image_scope_v}; | ||
if (!sycl::is_device_copyable_v<decltype(prop_list2)>) | ||
FAIL(log, | ||
"is_device_copyable_v for property_list with only " | ||
"compile-time-constant properties is not true"); | ||
} | ||
#endif | ||
} | ||
}; | ||
|
||
// register this test with the test_collection. | ||
util::test_proxy<TEST_NAME> proxy; | ||
|
||
} /* namespace TEST_NAMESPACE */ |
55 changes: 55 additions & 0 deletions
55
tests/extension/oneapi_property_list/property_list_is_property_check.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/******************************************************************************* | ||
// | ||
// SYCL 2020 Extension Conformance Test | ||
// | ||
// Provides test for sycl::is_property for compile-time properties | ||
// | ||
*******************************************************************************/ | ||
|
||
#include "../../common/common.h" | ||
|
||
#define TEST_NAME property_list_is_property_check | ||
|
||
namespace TEST_NAMESPACE { | ||
|
||
using namespace sycl_cts; | ||
|
||
/** test sycl::is_property for compile-time properties | ||
*/ | ||
class TEST_NAME : public util::test_base { | ||
public: | ||
/** return information about this test | ||
*/ | ||
void get_info(test_base::info &out) const override { | ||
set_test_info(out, TOSTRING(TEST_NAME), TEST_FILE); | ||
} | ||
|
||
/** execute the test | ||
*/ | ||
void run(util::logger &log) override { | ||
#if !defined(SYCL_EXT_ONEAPI_PROPERTY_LIST) | ||
WARN("SYCL_EXT_ONEAPI_PROPERTY_LIST is not defined, test is skipped"); | ||
#elif !defined(SYCL_EXT_ONEAPI_DEVICE_GLOBAL) | ||
WARN("SYCL_EXT_ONEAPI_DEVICE_GLOBAL is not defined, test is skipped"); | ||
#else | ||
{ | ||
using namespace sycl::ext::oneapi; | ||
|
||
// is_device_copyable for compile-time-constant properties | ||
if (!sycl::is_property_v<device_image_scope>) | ||
FAIL(log, "is_property_v for device_image_scope is not true"); | ||
if (!sycl::is_property_v<host_access>) | ||
FAIL(log, "is_property_v for device_image_scope is not true"); | ||
if (!sycl::is_property_v<init_mode>) | ||
FAIL(log, "is_property_v for device_image_scope is not true"); | ||
if (!sycl::is_property_v<implement_in_csr>) | ||
FAIL(log, "is_property_v for device_image_scope is not true"); | ||
} | ||
#endif | ||
} | ||
}; | ||
|
||
// register this test with the test_collection. | ||
util::test_proxy<TEST_NAME> proxy; | ||
|
||
} /* namespace TEST_NAMESPACE */ |
65 changes: 65 additions & 0 deletions
65
tests/extension/oneapi_property_list/property_list_is_property_list.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/******************************************************************************* | ||
// | ||
// SYCL 2020 Extension Conformance Test | ||
// | ||
// Provides test for sycl::ext::oneapi::is_property_list | ||
// | ||
*******************************************************************************/ | ||
|
||
#include "../../common/common.h" | ||
|
||
#define TEST_NAME property_list_is_property_list | ||
|
||
namespace TEST_NAMESPACE { | ||
|
||
class A {}; | ||
|
||
using namespace sycl_cts; | ||
|
||
/** test sycl::ext::oneapi::is_property_list | ||
*/ | ||
class TEST_NAME : public util::test_base { | ||
public: | ||
/** return information about this test | ||
*/ | ||
void get_info(test_base::info &out) const override { | ||
set_test_info(out, TOSTRING(TEST_NAME), TEST_FILE); | ||
} | ||
|
||
/** execute the test | ||
*/ | ||
void run(util::logger &log) override { | ||
#if !defined(SYCL_EXT_ONEAPI_PROPERTY_LIST) | ||
WARN("SYCL_EXT_ONEAPI_PROPERTY_LIST is not defined, test is skipped"); | ||
#elif !defined(SYCL_EXT_ONEAPI_DEVICE_GLOBAL) | ||
WARN("SYCL_EXT_ONEAPI_DEVICE_GLOBAL is not defined, test is skipped"); | ||
#else | ||
{ | ||
using namespace sycl::ext::oneapi; | ||
property_list prop_list{device_image_scope_v, implement_in_csr_v<true>}; | ||
|
||
if (!std::is_base_of_v<std::true_type, | ||
is_property_list<decltype(prop_list)>>) | ||
FAIL(log, | ||
"is_property_list for property list is not derived from " | ||
"std::true_type"); | ||
|
||
if (!is_property_list_v<decltype(prop_list)>) | ||
FAIL(log, "is_property_list_v for property list is not true"); | ||
|
||
if (std::is_base_of_v<std::true_type, is_property_list<A>>) | ||
FAIL(log, | ||
"is_property_list for not property list is derived from " | ||
"std::true_type"); | ||
|
||
if (is_property_list_v<A>) | ||
FAIL(log, "is_property_list_v for not property list is true"); | ||
} | ||
#endif | ||
} | ||
}; | ||
|
||
// register this test with the test_collection. | ||
util::test_proxy<TEST_NAME> proxy; | ||
|
||
} /* namespace TEST_NAMESPACE */ |