-
Notifications
You must be signed in to change notification settings - Fork 752
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][ESIMD] Fix lsc_load_2d API issue that prevented usage for different types #12244
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
//==----- lsc_load_2d_compare.cpp - DPC++ ESIMD on-device 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// REQUIRES: gpu-intel-pvc | ||
// RUN: %{build} -o %t.out | ||
// RUN: %{run} %t.out | ||
|
||
// The tests makes sure old and new load_2d API produce identical | ||
// results. | ||
#include <iostream> | ||
#include <sycl/ext/intel/esimd.hpp> | ||
#include <sycl/sycl.hpp> | ||
|
||
using bf16 = sycl::ext::oneapi::bfloat16; | ||
using namespace sycl; | ||
using namespace sycl::ext::intel::esimd; | ||
using namespace sycl::ext::intel::experimental::esimd; | ||
template <typename T> bool test() { | ||
sycl::queue Q(sycl::gpu_selector_v); | ||
auto dev = Q.get_device(); | ||
std::cout << "Running on " << dev.get_info<sycl::info::device::name>() | ||
<< "\n"; | ||
|
||
constexpr int TM = 8; | ||
constexpr int TN = 8; | ||
constexpr int NBLOCKS = 2; | ||
constexpr int WIDTH = 2 * TN; | ||
constexpr int HEIGHT = TM; | ||
constexpr int PITCH = WIDTH; | ||
constexpr int SIZE = WIDTH * HEIGHT; | ||
|
||
auto *A = malloc_shared<T>(SIZE, Q); | ||
auto *B = malloc_shared<T>(SIZE, Q); | ||
auto *C = malloc_shared<T>(SIZE, Q); | ||
auto *C1 = malloc_shared<T>(SIZE, Q); | ||
|
||
for (int i = 0; i < SIZE; i++) { | ||
A[i] = static_cast<T>(i); | ||
} | ||
|
||
Q.parallel_for(sycl::nd_range<1>(1, 1), [=](sycl::nd_item<1> | ||
item) SYCL_ESIMD_KERNEL { | ||
config_2d_mem_access<T, TN, TM, NBLOCKS> my_config( | ||
A, WIDTH * sizeof(T) - 1, HEIGHT - 1, PITCH * sizeof(T) - 1, 0, 0); | ||
|
||
simd<T, NBLOCKS * TM * TN> tmp = | ||
lsc_load_2d<T, TN, TM, NBLOCKS, false, false>(my_config); | ||
simd<T, NBLOCKS * TM * TN> tmp1 = lsc_load_2d<T, TN, TM, NBLOCKS>( | ||
my_config.get_data_pointer(), my_config.get_surface_width(), | ||
my_config.get_surface_height(), my_config.get_surface_pitch(), | ||
my_config.get_x(), my_config.get_y()); | ||
|
||
tmp.copy_to(C); | ||
tmp1.copy_to(C1); | ||
}).wait(); | ||
|
||
bool error = false; | ||
for (auto i = 0; i < SIZE; ++i) | ||
error |= C[i] != C1[i]; | ||
|
||
free(A, Q); | ||
free(C, Q); | ||
free(C1, Q); | ||
return error; | ||
} | ||
|
||
int main() { | ||
bool result = false; | ||
result |= test<float>(); | ||
result |= test<uint32_t>(); | ||
result |= test<uint16_t>(); | ||
result |= test<uint8_t>(); | ||
result |= test<sycl::half>(); | ||
|
||
std::cout << (result ? "FAILED" : "passed") << std::endl; | ||
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.
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.
We are in process of adding DG2 tests. I don't remember if load_2d supported by DG2. If Yes, then lease add one it for DG2. Perhaps this test will simply work for both DG2 and PVC
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.
Tried to run it on dg2 and it gets stuck. There is probably another version of load_2d for dg2 or other platforms but this one appears to be for PVC only
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.
The untyped load/store/prefetch 2d block operations are not supported by DG2/MTL/ARL. They are only available for PVC and Xe2+.