Skip to content

Fix issues with uninitialized_* tests #2415

@danhoeflinger

Description

@danhoeflinger

uninitialized_fill_destroy.pass has some issues when testing for device policies, and when testing trivial types in general:

  1. uninitialized_fill is using a default constructed value when testing fill (often zero) which for debug builds would likely be the uninitialized value. We should use a non-zero value to best avoid false passing results.

  2. For device policies we are using a sequence of default initialized data as initial input. This results in double-constructing this memory. Moreover, because of (1), we are testing a fill of default constructed values on data which is default constructed, so a no-op would suffice to pass the tests. We should use malloc_shared instead of a Sequence, and iterate over usm pointer to uninitialized memory, then test it back on the host.

  3. We are testing destroy for trivial types (which should be a no-op). We can test that calling this API compiles and returns the right iterator result. However, we then verify by counting the elements which don't match the filled result, and confirm it is zero. This, in effect, confirms that the operation is a no-op, but I think the preferred verification would just be to check the returned iterator against last.

  4. Should we be testing non-trivial types with device policies? We currently only with test trivial types on the device. It seems we should be able to test with non-trivial sycl-device-copyable types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions