[SYCL][USM] Improve USM allocator test and fix improper behavior.#1538
[SYCL][USM] Improve USM allocator test and fix improper behavior.#1538bader merged 2 commits intointel:syclfrom
Conversation
Signed-off-by: James Brodman <james.brodman@intel.com>
| vec.resize(N); | ||
|
|
||
| int *res = &vec[0]; | ||
| int *vals = &vec[0]; |
|
|
||
| auto e0 = q.submit([=](handler &h) { | ||
| h.single_task<class baz_init>([=]() { | ||
| res[0] = 0; |
There was a problem hiding this comment.
Confused by this, res and vals point to the same device vector data, so res[0] = 0 is redundant to the first loop iteration below where vals[i=0] = 0. This also means the res[0] == vals[0] is added to itself an extra time, which works because is happens to be 0, but again confusing.
There was a problem hiding this comment.
I see i=0 is skipped in the second loop so no double add. Anyway I know it's just a test, but having res and vals point at the same memory is still confusing to me, takes a minute to verify that it's not a problem in this case.
There was a problem hiding this comment.
The computation is sort of irrelevant.
|
Testing with inteloneapi v 2021.1-beta05, with usm_allocator.hpp header change manually applied. The test program works for me when Note that I am also seeing this behavior in my own usm test programs, with Perhaps there is something I am missing from latest git commits? I will try to build from source and see if I can still reproduce. |
Looks like this was already fixed in #1132, sorry for the noise. Looks like USM is still very much in active development and anyone wanting to use it would be advised to track develop. |
|
@jbrodman What was wrong with previous version of the test? |
It was only testing the allocator with host allocations, not device/shared allocations - hence a method on device allocations wasn't working as intended. |
sycl/test/usm/allocator_vector.cpp
Outdated
| auto ctxt = q.get_context(); | ||
|
|
||
| if (!dev.get_info<info::device::usm_host_allocations>()) | ||
| if (!(dev.get_info<info::device::usm_host_allocations>() && |
There was a problem hiding this comment.
In this test you expect that a single device/environment/runtime will provide you with all three types of allocations. Dunno if it's possible that, say, CPU device/runtime provide you with either two out of three allocation facilities. Anyway, I suggest splitting the cases into three distinct ones. One way I see how this can be achieved is to if test blocks with appropriate dev.get_info<info::device::usm_xxx_allocations>().
|
@jbrodman ping. |
|
Sorry, what exactly is the request again? |
|
This one: #discussion_r411543369 |
Signed-off-by: James Brodman <james.brodman@intel.com>
|
@bader looks good to me. I ran the tests with some added debug prints against beta 05. With In beta06, which appears to have #1132 but not this, the tests almost pass but the feature not supported exception is thrown on device vector destructor. If I comment out the throw at Using my source build llvm install with this fix applied (and the already merged queue fix from #1132), all pass. |
|
@bd4, thanks! |
…_docs * origin/sycl: (6482 commits) [SYCL][NFC] Clean formatting in Markdown documents (intel#1635) [SYCL][Doc] Remove obsolete parens from README (intel#1637) [SYCL] Fix failing ABI tests when LLVM_LIBDIR_SUFFIX is set (intel#1605) [SYCL] Fix warnings in libdevice (intel#1630) [SYCL][CUDA] Triage and clean LIT (intel#1620) [SYCL][NFC] Fix GCC 8 compilation warnings (intel#1631) [SYCL] Minor fixes in LowerWGScope [SYCL] PI: correct default interoperability plugin selection [SYCL] Add faster reduction implementations using atomic or/and intel::reduce() (intel#1615) [SYCL] Add sycl-ls utility for listing devices discovered/selected by SYCL RT (intel#1575) [SYCL] Fix getDeviceFromHandler declarations (intel#1626) [SPIR-V] Correct/improve declaration of SPIR-V builtins (intel#1519) [SYCL][USM] Improve USM allocator test and fix improper behavior. (intel#1538) [SYCL] Fix failing ABI LITs (intel#1622) [SYCL] Add support for MSVC internal math functions in device library (intel#1441) [SYCL] Add runtime library versioning (intel#1604) [SYCL] Check weak symbols in ABI dumps (intel#1609) [NFC][SYCL] Improve kernel metadata test (intel#1610) Revert "[SYCL] XFAIL LIT test due to duplicate diagnostic" (intel#1460) [SYCL] Move the reduction command group funcs out of handler.hpp (intel#1602) ...
… (#154163) This reverts commit 7c53c61. This patch hit an issue in hip test. revert and will reopen later
Signed-off-by: James Brodman james.brodman@intel.com