-
Notifications
You must be signed in to change notification settings - Fork 809
[SYCL] Fix 2D slicepitch info #18960
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 2 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1703227
Modify 2D slicepitch info
hdelan b848cad
Add test to check urMemImageCreate
hdelan e45607b
Update test
hdelan cb8607d
Update test
hdelan e0754d1
Only support test for OpenCL
hdelan ad7a562
Merge branch 'sycl' into image-pitch-bugfix
hdelan 8f37ed8
Only check trace for host ptr
hdelan 99fd91e
Whitespace
hdelan 1e64e92
Allow early exit for non host ptr
hdelan f62a8aa
Update typo
hdelan 2a035e6
Merge branch 'sycl' into image-pitch-bugfix
hdelan 460a0ce
Only support test for CPU
hdelan f4c322c
Typo
hdelan 2588848
Typo
hdelan 18c9fef
Update includes
hdelan 17aeee0
Update test
hdelan 6d9fbc5
Clang format
hdelan 80b78d9
Merge branch 'sycl' into image-pitch-bugfix
hdelan 5316db2
Match return occurence
hdelan 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,73 @@ | ||
| // REQUIRES: aspect-ext_intel_legacy_image | ||
| // RUN: %{build} -o %t.out | ||
| // RUN: env SYCL_UR_TRACE=-1 %{run} %t.out | FileCheck %s | ||
|
|
||
| //==------------------- image_trace.cpp - SYCL image trace test ------------==// | ||
| // | ||
| // Ensures the correct params are being passed to urMemImageCreate | ||
| // | ||
| // 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 <sycl/accessor_image.hpp> | ||
| #include <sycl/builtins.hpp> | ||
| #include <sycl/detail/core.hpp> | ||
|
|
||
| #include <iostream> | ||
| #include <vector> | ||
|
|
||
| #include "../../helpers.hpp" | ||
|
|
||
| #include <sycl/accessor_image.hpp> | ||
hdelan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| #include <sycl/image.hpp> | ||
|
|
||
| int main() { | ||
| const sycl::image_channel_order ChanOrder = sycl::image_channel_order::rgba; | ||
| const sycl::image_channel_type ChanType = sycl::image_channel_type::fp32; | ||
|
|
||
| constexpr auto SYCLRead = sycl::access::mode::read; | ||
| constexpr auto SYCLWrite = sycl::access::mode::write; | ||
|
|
||
| const sycl::range<2> Img1Size(4, 4); | ||
| const sycl::range<2> Img2Size(4, 4); | ||
|
|
||
| std::vector<sycl::float4> Img1HostData(Img1Size.size(), {1, 2, 3, 4}); | ||
| std::vector<sycl::float4> Img2HostData(Img2Size.size(), {0, 0, 0, 0}); | ||
|
|
||
| { | ||
| sycl::image<2> Img1(Img1HostData.data(), ChanOrder, ChanType, Img1Size); | ||
| sycl::image<2> Img2(Img2HostData.data(), ChanOrder, ChanType, Img2Size); | ||
| TestQueue Q{sycl::default_selector_v}; | ||
| Q.submit([&](sycl::handler &CGH) { | ||
| auto Img1Acc = Img1.get_access<sycl::float4, SYCLRead>(CGH); | ||
| auto Img2Acc = Img2.get_access<sycl::float4, SYCLWrite>(CGH); | ||
|
|
||
| CGH.parallel_for<class ImgCopy>(Img1Size, [=](sycl::item<2> Item) { | ||
| sycl::float4 Data = Img1Acc.read(sycl::int2{Item[0], Item[1]}); | ||
| Img2Acc.write(sycl::int2{Item[0], Item[1]}, Data); | ||
| }); | ||
| // CHECK: urMemImageCreate({{.*}} .flags = UR_MEM_FLAG_READ_WRITE | UR_MEM_FLAG_USE_HOST_POINTER, .pImageFormat = {{.*}} ((struct ur_image_format_t){.channelOrder = UR_IMAGE_CHANNEL_ORDER_RGBA, .channelType = UR_IMAGE_CHANNEL_TYPE_FLOAT}), .pImageDesc = {{.*}} ((struct ur_image_desc_t){.stype = UR_STRUCTURE_TYPE_IMAGE_DESC, .pNext = nullptr, .type = UR_MEM_TYPE_IMAGE2D, .width = 4, .height = 4, .depth = 1, .arraySize = 0, .rowPitch = 64, .slicePitch = 256, .numMipLevel = 0, .numSamples = 0}), .pHost = {{.*}}, .phMem = {{.*}}) -> UR_RESULT_SUCCESS; | ||
| // CHECK: urMemImageCreate({{.*}} .flags = UR_MEM_FLAG_READ_WRITE | UR_MEM_FLAG_USE_HOST_POINTER, .pImageFormat = {{.*}} ((struct ur_image_format_t){.channelOrder = UR_IMAGE_CHANNEL_ORDER_RGBA, .channelType = UR_IMAGE_CHANNEL_TYPE_FLOAT}), .pImageDesc = {{.*}} ((struct ur_image_desc_t){.stype = UR_STRUCTURE_TYPE_IMAGE_DESC, .pNext = nullptr, .type = UR_MEM_TYPE_IMAGE2D, .width = 4, .height = 4, .depth = 1, .arraySize = 0, .rowPitch = 64, .slicePitch = 256, .numMipLevel = 0, .numSamples = 0}), {{.*}}) -> UR_RESULT_SUCCESS; | ||
| }); | ||
| } | ||
|
|
||
| for (int X = 0; X < Img2Size[0]; ++X) | ||
| for (int Y = 0; Y < Img2Size[1]; ++Y) { | ||
| sycl::float4 Vec1 = Img1HostData[X * Img1Size[1] + Y]; | ||
| sycl::float4 Vec2 = Img2HostData[X * Img2Size[1] + Y]; | ||
|
|
||
| if (sycl::any(sycl::isnotequal(Vec1, Vec2))) { | ||
| std::cerr << "Failed" << std::endl; | ||
| std::cerr << "Element [ " << X << ", " << Y << " ]" << std::endl; | ||
| std::cerr << "Expected: " << printableVec(Vec1) << std::endl; | ||
| std::cerr << " Got : " << printableVec(Vec2) << std::endl; | ||
| return 1; | ||
| } | ||
| } | ||
|
|
||
| std::cout << "Success" << std::endl; | ||
maarquitos14 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return 0; | ||
| } | ||
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.