-
Notifications
You must be signed in to change notification settings - Fork 792
[SYCL][ESIMD] Fix lsc_load_2d API issue that prevented usage for different types #12244
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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+. |
||
// 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; | ||
} |
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.
@vmustya - can you please take a look at this block of code and the initialization of 'desc' at L2463 ?
Uh oh!
There was an error while loading. Please reload this page.
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.
According to the hardware spec, dest size is encoded in units of registers.
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.
Fixed