-
Notifications
You must be signed in to change notification settings - Fork 744
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
[SYCL][Bindless] Add image_mem_handle to image_mem_handle devices copies. #12449
Merged
sommerlukas
merged 55 commits into
intel:sycl
from
codeplaysoftware:chedy/device-to-device-copy
Apr 25, 2024
Merged
Changes from 53 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
ed2b572
[SYCL][Bindless] Add image_mem_handle to image_mem_handle devices cop…
cppchedy d121d49
add missing linux symbols
cppchedy 4c429f8
add windows symbols
cppchedy f5bf437
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 666caf3
update UR commit
cppchedy 6d61e57
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 3296a50
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 8a34c10
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy c630290
update UR
cppchedy e48fa84
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy e888eb9
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 4aee726
update UR tag
cppchedy d6e5dfe
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 31de6b3
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 7d53123
update UR tag
cppchedy 04edafb
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 9c85c51
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy d2c3f3c
update UR tag
cppchedy 731ab58
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 046dda4
update UR tag
cppchedy f3420c1
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 077ed5c
update UR tag
cppchedy 1299957
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy adf9fb1
update UR tag
cppchedy ced64a2
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy bffce26
update UR tag
cppchedy 1dec9ac
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 64705bf
update UR
cppchedy cb91837
update order and sizes of test cases
cppchedy 8061fa2
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy ef7aa03
update UR tag
cppchedy e493465
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 3699f21
update UR tag
cppchedy 46bd117
add support for copying image arrays with tests
cppchedy c6e42b6
update UR tag
cppchedy a443907
comment verbose print
cppchedy 4e130f1
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 45340bd
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 5efd58e
update UR tag
cppchedy 8df8365
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 6400dab
update UR tag
cppchedy 15e9302
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 50ebbfe
update UR tag
cppchedy b6b4c8b
fix formatting
cppchedy 2420b83
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 41c1154
update UR tag
cppchedy 3ef180e
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy be980ce
update UR tag for cuda adapter
cppchedy 32b6963
update UR cuda adapter tag
cppchedy bd6803c
update UR cuda tag
cppchedy 08dd61b
Merge branch 'sycl' into chedy/device-to-device-copy
cppchedy 4f38436
handle cubemap copies
cppchedy 0810baf
update CUDA UR tag
cppchedy 5d8abb1
Merge branch 'sycl' into chedy/device-to-device-copy
przemektmalon b9adf7d
Update UR CUDA tag
przemektmalon 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 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
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
119 changes: 119 additions & 0 deletions
119
sycl/test-e2e/bindless_images/device_to_device_copy.cpp
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,119 @@ | ||
// REQUIRES: linux | ||
// REQUIRES: cuda | ||
|
||
// RUN: %{build} -o %t.out | ||
// RUN: %{run} %t.out | ||
|
||
#include <iostream> | ||
#include <sycl/sycl.hpp> | ||
|
||
// Uncomment to print additional test information | ||
// #define VERBOSE_PRINT | ||
|
||
namespace syclexp = sycl::ext::oneapi::experimental; | ||
|
||
void copy_image_mem_handle_to_image_mem_handle( | ||
syclexp::image_descriptor &desc, const std::vector<float> &testData, | ||
sycl::device dev, sycl::queue q, std::vector<float> &out) { | ||
syclexp::image_mem imgMemSrc(desc, dev, q.get_context()); | ||
syclexp::image_mem imgMemDst(desc, dev, q.get_context()); | ||
|
||
q.ext_oneapi_copy((void *)testData.data(), imgMemSrc.get_handle(), desc); | ||
q.wait_and_throw(); | ||
|
||
q.ext_oneapi_copy(imgMemSrc.get_handle(), imgMemDst.get_handle(), desc); | ||
q.wait_and_throw(); | ||
|
||
q.ext_oneapi_copy(imgMemDst.get_handle(), (void *)out.data(), desc); | ||
q.wait_and_throw(); | ||
} | ||
|
||
bool check_test(const std::vector<float> &out, | ||
const std::vector<float> &expected) { | ||
assert(out.size() == expected.size()); | ||
bool validated = true; | ||
for (int i = 0; i < out.size(); i++) { | ||
bool mismatch = false; | ||
if (out[i] != expected[i]) { | ||
mismatch = true; | ||
validated = false; | ||
} | ||
|
||
if (mismatch) { | ||
#ifdef VERBOSE_PRINT | ||
std::cout << "Result mismatch! Expected: " << expected[i] | ||
<< ", Actual: " << out[i] << std::endl; | ||
#else | ||
break; | ||
#endif | ||
} | ||
} | ||
return validated; | ||
} | ||
|
||
template <sycl::image_channel_order channelOrder, | ||
sycl::image_channel_type channelType, int dim, | ||
syclexp::image_type type = syclexp::image_type::standard> | ||
bool run_copy_test_with(sycl::device &dev, sycl::queue &q, | ||
sycl::range<dim> dims) { | ||
std::vector<float> dataSequence(dims.size()); | ||
std::vector<float> out(dims.size()); | ||
|
||
std::vector<float> expected(dims.size()); | ||
|
||
std::iota(dataSequence.begin(), dataSequence.end(), 0); | ||
std::iota(expected.begin(), expected.end(), 0); | ||
|
||
syclexp::image_descriptor desc; | ||
|
||
if constexpr (type == syclexp::image_type::standard) { | ||
desc = syclexp::image_descriptor(dims, channelOrder, channelType); | ||
} else { | ||
desc = syclexp::image_descriptor( | ||
{dims[0], dim > 2 ? dims[1] : 0}, channelOrder, channelType, | ||
syclexp::image_type::array, 1, dim > 2 ? dims[2] : dims[1]); | ||
} | ||
|
||
copy_image_mem_handle_to_image_mem_handle(desc, dataSequence, dev, q, out); | ||
|
||
return check_test(out, expected); | ||
} | ||
|
||
int main() { | ||
|
||
sycl::device dev; | ||
sycl::queue q(dev); | ||
auto ctxt = q.get_context(); | ||
|
||
// Standard images copies | ||
bool validated = run_copy_test_with<sycl::image_channel_order::r, | ||
sycl::image_channel_type::fp32, 2>( | ||
dev, q, {2048 * 8, 2048 * 8}); | ||
|
||
validated &= run_copy_test_with<sycl::image_channel_order::r, | ||
sycl::image_channel_type::fp32, 1>( | ||
dev, q, {512 * 256}); | ||
|
||
validated &= run_copy_test_with<sycl::image_channel_order::r, | ||
sycl::image_channel_type::fp32, 3>( | ||
dev, q, {2048, 2048, 64}); | ||
|
||
// Layered images copies | ||
validated &= | ||
run_copy_test_with<sycl::image_channel_order::r, | ||
sycl::image_channel_type::fp32, 2, | ||
syclexp::image_type::array>(dev, q, {956, 38}); | ||
validated &= | ||
run_copy_test_with<sycl::image_channel_order::r, | ||
sycl::image_channel_type::fp32, 3, | ||
syclexp::image_type::array>(dev, q, {2048, 2048, 64}); | ||
|
||
if (!validated) { | ||
std::cout << "Tests failed"; | ||
return 1; | ||
} | ||
|
||
std::cout << "Tests passed"; | ||
|
||
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oneapi-src/unified-runtime#1265 is merged. We are using the main tag just now so if you could update that instead of this to point at this commit that'd be very helpful.