-
Notifications
You must be signed in to change notification settings - Fork 745
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Implement accessor default constructor (#6940)
This patch implements SYCL 2020 accessor default constructor
- Loading branch information
1 parent
f3d245d
commit 04928f9
Showing
7 changed files
with
111 additions
and
39 deletions.
There are no files selected for viewing
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
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
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,19 @@ | ||
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
int main() { | ||
sycl::accessor<int, 0, sycl::access::mode::read_write, sycl::target::device> | ||
B; | ||
assert(B.empty()); | ||
assert(B.size() == 0); | ||
assert(B.max_size() == 0); | ||
assert(B.byte_size() == 0); | ||
// The return values of get_pointer() and get_multi_ptr() are unspecified. | ||
assert(B.get_pointer() == nullptr); | ||
// TODO: uncomment check with get_multi_ptr() when SYCL 2020 mupti_ptr feature | ||
// will be merged | ||
// assert(B.get_multi_ptr() == nullptr); | ||
|
||
return 0; | ||
} |
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,42 @@ | ||
#include "SchedulerTest.hpp" | ||
#include "SchedulerTestUtils.hpp" | ||
#include <detail/handler_impl.hpp> | ||
|
||
#include <helpers/PiMock.hpp> | ||
#include <helpers/ScopedEnvVar.hpp> | ||
#include <helpers/TestKernel.hpp> | ||
|
||
#include <vector> | ||
|
||
using namespace sycl; | ||
|
||
TEST_F(SchedulerTest, AccDefaultCtorDoesntAffectDepGraph) { | ||
unittest::PiMock Mock; | ||
platform Plt = Mock.getPlatform(); | ||
|
||
queue QueueDev(context(Plt), default_selector_v); | ||
MockScheduler MS; | ||
|
||
detail::QueueImplPtr QueueDevImpl = detail::getSyclObjImpl(QueueDev); | ||
|
||
std::vector<detail::Command *> ToEnqueue; | ||
|
||
MockHandlerCustomFinalize MockCGH(QueueDevImpl, false); | ||
|
||
sycl::accessor<int, 0, sycl::access::mode::read_write, sycl::target::device> | ||
B; | ||
|
||
MockCGH.single_task<class acc_with_zero_dim>([=]() { | ||
int size = B.size(); | ||
(void)size; | ||
}); | ||
|
||
std::unique_ptr<sycl::detail::CG> CmdGroup = MockCGH.finalize(); | ||
|
||
detail::Command *NewCmd = | ||
MS.addCG(std::move(CmdGroup), QueueDevImpl, ToEnqueue); | ||
|
||
// if MDeps is empty, accessor built from default ctor does not affect | ||
// dependency graph in accordance with SYCL 2020 | ||
EXPECT_TRUE(NewCmd->MDeps.empty()); | ||
} |
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
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
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