Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[ESIMD] Add a test for lsc_slm_block_load with merging semantics #1637

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions SYCL/ESIMD/lsc/Inputs/lsc_slm_load.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,17 @@ bool test(queue Q, uint32_t PMask = ~0) {
barrier();

if constexpr (Transpose) {
auto Vals = lsc_slm_block_load<T, VL, DS>(LID * VL * sizeof(T));
Vals.copy_to(Out + GID * VL);
if constexpr (TestMergeOperand) {
simd_mask<1> Pred =
(GID & 0x1) == 0; // Do actual load of even elements.
simd<T, VL> OldValues(GID, 1);
auto Vals = lsc_slm_block_load<T, VL, DS>(LID * VL * sizeof(T), Pred,
OldValues);
Vals.copy_to(Out + GID * VL);
} else {
auto Vals = lsc_slm_block_load<T, VL, DS>(LID * VL * sizeof(T));
Vals.copy_to(Out + GID * VL);
}
} else {
simd<uint32_t, VL> Offsets(LID * VL * NChannels * sizeof(T),
NChannels * sizeof(T));
Expand Down Expand Up @@ -111,7 +120,12 @@ bool test(queue Q, uint32_t PMask = ~0) {
for (uint32_t I = 0; I < OutSize; I++) {
uint32_t GroupId = I / (LocalRange * VL * NChannels);
uint32_t LID = I % (LocalRange * VL * NChannels);
uint32_t GID = I / VL;
bool Pred = (GID & 0x1) == 0;
T ExpectedVal = GroupId * 1000000 + LID;
if (TestMergeOperand && !Pred)
ExpectedVal = GID + (I % VL);

if (Out[I] != ExpectedVal && NErrors++ < 32) {
std::cout << "Error: " << I << ": Value = " << Out[I]
<< ", Expected value = " << ExpectedVal << std::endl;
Expand Down
11 changes: 3 additions & 8 deletions SYCL/ESIMD/lsc/lsc_slm_block_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out

// This test verifies the correctness of LSC intrinsics loading
// from SLM memory.
// This test verifies the correctness of LSC SLM block load intrinsics.

#include "Inputs/lsc_slm_load.hpp"

// This test verifies the correctness of LSC SLM block load intrinsics.

template <typename T, bool TestMerging> bool test_load(queue Q) {
constexpr bool Transpose = true;
constexpr int VS = 1;
Expand Down Expand Up @@ -36,10 +33,8 @@ int main() {
Passed &= test_load<uint32_t, !TestMerging>(Q);
Passed &= test_load<uint64_t, !TestMerging>(Q);

// TODO: Enable the test with 'TestMerging' when lsc_slm_block_load() with
// 'old_values' operand is supported.
// Passed &= test_load<uint32_t, TestMerging>(Q);
// Passed &= test_load<uint64_t, TestMerging>(Q);
Passed &= test_load<uint32_t, TestMerging>(Q);
Passed &= test_load<uint64_t, TestMerging>(Q);

// TODO: Enable the test with 1- and 2-byte element types, with floating point
// types when lsc_slm_block_load() API is ready.
Expand Down