Skip to content

Latest commit

 

History

History
134 lines (88 loc) · 5.33 KB

deduction_guides.asciidoc

File metadata and controls

134 lines (88 loc) · 5.33 KB

Test plan for deduction guides

This is a test plan for deduction guides functionality of classes with templates, such as buffer, multi_ptr, range, id and vec.

1. Testing scope

1.1. Device coverage

All of the tests described below are performed only on the default device that is selected on the CTS command line if not stated otherwise.

1.2. Types coverage

All of the tests for buffer and multi_ptr described below are performed using each of the following typename T:

In Regular mode:

  • int

  • float

  • A user-defined class with several scalar member variables and a user-defined default constructor.

In full conformance mode:

  • char

  • signed char

  • unsigned char

  • short int

  • unsigned short int

  • unsigned int

  • long int

  • unsigned long int

  • long long int

  • unsigned long long int

  • bool

  • A user-defined struct with several scalar member variables, no constructor, destructor or member functions.

  • A user-defined class with several scalar member variables, a deleted default constructor, and a user-defined (non-default) constructor.

Tests for vec are performed using char, unsigned char, short, unsigned short, int, unsigned int, long, unsigned long and float.

2. Tests

2.1. buffer

Check that constructing an object without specifying template variables initializes object with correct InputIterator, AllocatorT, range<Dimensions> and Container classes.

  • Create std::vector<T> with T from Types coverage

  • Create buffer using following constructors without templates using

    • InputIterator - std::vector<T>::begin() and std::vector<T>::end()

    • Allocator - sycl::buffer_allocator and std::allocator

    • Container - existing std::vector<T>

    • Dimensions from 1 to 3

  • template <class InputIterator, class AllocatorT>
    buffer(InputIterator, InputIterator, AllocatorT, const property_list& = {}) → buffer<typename std::iterator_traits<InputIterator>::value_type, 1, AllocatorT>;

  • template <class InputIterator>
    buffer(InputIterator, InputIterator, const property_list& = {}) → buffer<typename std::iterator_traits<InputIterator>::value_type, 1>;

  • template <class T, int Dimensions, class AllocatorT>
    buffer(const T*, const range<Dimensions>&, AllocatorT, const property_list& = {}) → buffer<T, Dimensions, AllocatorT>;

  • template <class T, int Dimensions>
    buffer(const T*, const range<Dimensions>&, const property_list& = {}) → buffer<T, Dimensions>;

  • template <class Container, class AllocatorT>
    buffer(Container&, AllocatorT, const property_list& = {}) → buffer<typename Container::value_type, 1, AllocatorT>;

  • template <class Container>
    buffer(Container&, const property_list& = {}) → buffer<typename Container::value_type, 1>;

  • Using std::is_same_v compare resulting object with expected type from deduction guide.

Additionaly, use buffer member functions to:

  • Check that value_type is the same with T

  • Check that get_range() returns same range<Dimensions>

  • Check that get_allocator() returns same AllocatorT

2.2. multi_ptr

Check that constructing an object without specifying template variables initializes object with correct T, access_mode, placeholder and Dimensions classes.

  • Create accessor and local_accessor using

    • T from Types coverage

    • Dimensions from 1 to 3

    • Mode for accessor - access::mode::read, access::mode::write, access::mode::read_write

  • Create multi_ptr using following constructors without specifying templates with existing accessor and local_accessor.

    • template <int Dimensions, access_mode Mode, access::placeholder IsPlaceholder,class T>
      multi_ptr(accessor<T, Dimensions, Mode, target::device, IsPlaceholder>) → multi_ptr<T, access::address_space::global_space, access::decorated::no>;

    • template <int Dimensions, access_mode Mode, access::placeholder IsPlaceholder, class T>
      multi_ptr(local_accessor<T, Dimensions>) → multi_ptr<T, access::address_space::local_space, access::decorated::no>;

  • Using std::is_same_v compare resulting object with expected type from deduction guide.

2.3. range and id

Check that constructing an object without specifying Dimensions passes correct number of size_t arguments.

  • Create range and id objects using following constructors

    • range(size_t N) → range<1>;

    • range(size_t N1, size_t N2) → range<2>;

    • range(size_t N1, size_t N2, size_t N3) → range<3>;

    • id(size_t N)→id<1>;

    • id(size_t N1, size_t N2)→id<2>;

    • id(size_t N1, size_t N2, size_t N3)→id<3>;

  • With N, N1 = 4, N2 = 8, N3 = 10, check that size() of resulting range object is N, N1 * N2, N1 * N2 * N3 respectively.

  • Using operator[] of range and id, check that every element inside object is same with passed.

  • Using std::is_same_v compare type of resulting object and type with specified Dimesions template.

2.4. vec

  • Since NumElement of vec can only be 1, 2, 3, 4, 8 and 16, create sets of data with mentioned number of elements and types from Types coverage.

  • Create vec using following constructor and passing created sets of data

    • template <class T, class…​ U> vec(T, U…​) → vec<T, sizeof…​(U) + 1>;

  • Using std::is_same_v compare resulting object with expected type from deduction guide.

  • Use for loop to check that elements inside vectors are the same with passed.