-
Notifications
You must be signed in to change notification settings - Fork 808
[SYCL][USM] Improve USM Allocator. #2026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
9efaeee
Enable allocate_shared
186cf79
Improve USM Allocator. Add equality operators. Enable allocate_shared.
836d9b2
Remove test as behavior has changed. Construct is a NOP for device a…
78bd876
Clang-format fix.
6c6309e
Make assert more verbose in test.
9f24380
Remove test for device allocations as they cannot work. Fix formatting.
ce67702
Remove cuda XFAIL
c81bb03
Merge branch 'allocshared' of https://github.com/jbrodman/llvm into a…
0e776b5
Modernize allocator. Disallow device allocations due to too many com…
df1a5a4
clang format
b175024
Remove level0 xfail
18a20fe
Move static_assert to class body.
40fbf49
Change default align to alignof(T)
29649c4
clang-format
101dee6
clang-format
50307bd
Remove XFAIL cuda on tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 @@ | ||
| // piextUSM*Alloc functions for CUDA are not behaving as described in | ||
| // https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc | ||
| // https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc | ||
| // | ||
| // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out | ||
| // RUN: env SYCL_DEVICE_TYPE=HOST %t1.out | ||
| // RUN: %CPU_RUN_PLACEHOLDER %t1.out | ||
| // RUN: %GPU_RUN_PLACEHOLDER %t1.out | ||
|
|
||
| //==---------- allocator_equal.cpp - Allocator Equality test ---------------==// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include <CL/sycl.hpp> | ||
jbrodman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| #include <cassert> | ||
|
|
||
| using namespace cl::sycl; | ||
|
|
||
| int main() { | ||
| queue q; | ||
| auto dev = q.get_device(); | ||
| auto ctxt = q.get_context(); | ||
|
|
||
| queue q2; | ||
| auto dev2 = q2.get_device(); | ||
| auto ctxt2 = q2.get_context(); | ||
|
|
||
| // Test allocator equality | ||
| if (dev.get_info<info::device::usm_host_allocations>()) { | ||
| usm_allocator<int, usm::alloc::host> alloc1(ctxt, dev); | ||
| usm_allocator<int, usm::alloc::host> alloc2(q); | ||
|
|
||
| assert((alloc1 == alloc2) && "Allocators should be equal."); | ||
|
|
||
| usm_allocator<int, usm::alloc::host, 8> alloc3(ctxt, dev); | ||
| usm_allocator<int, usm::alloc::host, 16> alloc4(q); | ||
|
|
||
| assert((alloc1 == alloc2) && "Allocators should be equal."); | ||
| } | ||
|
|
||
| if (dev.get_info<info::device::usm_shared_allocations>() && | ||
| dev.get_info<info::device::usm_host_allocations>()) { | ||
| usm_allocator<int, usm::alloc::shared> alloc1(ctxt, dev); | ||
| usm_allocator<int, usm::alloc::host> alloc2(ctxt, dev); | ||
|
|
||
| assert((alloc1 != alloc2) && "Allocators should NOT be equal."); | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.