From b97483cf7faa3928c90f4e7e68d70ec439ef026f Mon Sep 17 00:00:00 2001 From: "Fine, Gregory" Date: Wed, 7 Feb 2024 20:03:37 -0800 Subject: [PATCH] Address PR comments --- llvm/lib/SYCLLowerIR/ESIMD/LowerESIMD.cpp | 2 +- .../ESIMD/unified_memory_api/scatter_usm.cpp | 4 ++-- .../unified_memory_api/scatter_usm_legacy.cpp | 2 +- .../ESIMD/unified_memory_api/slm_scatter.cpp | 6 +++--- .../unified_memory_api/slm_scatter_legacy.cpp | 6 +++--- sycl/test/esimd/memory_properties.cpp | 15 +++++++++++++++ 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/llvm/lib/SYCLLowerIR/ESIMD/LowerESIMD.cpp b/llvm/lib/SYCLLowerIR/ESIMD/LowerESIMD.cpp index 70f3620538fb1..15c5e7c9a625e 100644 --- a/llvm/lib/SYCLLowerIR/ESIMD/LowerESIMD.cpp +++ b/llvm/lib/SYCLLowerIR/ESIMD/LowerESIMD.cpp @@ -1011,9 +1011,9 @@ static void translateScatterStore(CallInst &CI, bool IsSLM) { ESIMDIntrinDesc::GenXArgConversion::TO_I64); Align AlignValue(Val.getZExtValue()); + auto ValsOp = CI.getArgOperand(0); auto OffsetsOp = CI.getArgOperand(1); auto MaskOp = CI.getArgOperand(2); - auto ValsOp = CI.getArgOperand(0); auto DataType = ValsOp->getType(); // Convert the mask from to . diff --git a/sycl/test-e2e/ESIMD/unified_memory_api/scatter_usm.cpp b/sycl/test-e2e/ESIMD/unified_memory_api/scatter_usm.cpp index 3bd02ebf8d581..ff331a421ccef 100644 --- a/sycl/test-e2e/ESIMD/unified_memory_api/scatter_usm.cpp +++ b/sycl/test-e2e/ESIMD/unified_memory_api/scatter_usm.cpp @@ -10,8 +10,8 @@ // The test verifies esimd::scatter() functions accepting USM pointer // and optional compile-time esimd::properties. -// The scatter() calls in this test do not use cache-hint -// properties to not impose using DG2/PVC features. +// The scatter() calls in this test do not use cache-hint properties +// or VS > 1 (number of stores per offset) to not impose using PVC features. #include "Inputs/scatter.hpp" diff --git a/sycl/test-e2e/ESIMD/unified_memory_api/scatter_usm_legacy.cpp b/sycl/test-e2e/ESIMD/unified_memory_api/scatter_usm_legacy.cpp index 8ef57f63abf37..08ac29ba6b605 100644 --- a/sycl/test-e2e/ESIMD/unified_memory_api/scatter_usm_legacy.cpp +++ b/sycl/test-e2e/ESIMD/unified_memory_api/scatter_usm_legacy.cpp @@ -12,7 +12,7 @@ // The test verifies esimd::scatter() functions accepting USM pointer // and optional compile-time esimd::properties. // The scatter() calls in this test do not use cache-hint properties -// or VS > 1 (number of loads per offset) to not impose using PVC features. +// or VS > 1 (number of stores per offset) to not impose using PVC features. // // TODO: Remove this test when GPU driver issue with llvm.masked.scatter is // resolved and ESIMD starts using llvm.masked.scatter by default. diff --git a/sycl/test-e2e/ESIMD/unified_memory_api/slm_scatter.cpp b/sycl/test-e2e/ESIMD/unified_memory_api/slm_scatter.cpp index 226bd66051d1b..ffa0a718e7689 100644 --- a/sycl/test-e2e/ESIMD/unified_memory_api/slm_scatter.cpp +++ b/sycl/test-e2e/ESIMD/unified_memory_api/slm_scatter.cpp @@ -8,9 +8,9 @@ // RUN: %{build} -fsycl-device-code-split=per_kernel -D__ESIMD_GATHER_SCATTER_LLVM_IR -o %t.out // RUN: %{run} %t.out -// The test verifies esimd::slm_scatter() functions accepting -// optional compile-time esimd::properties. -// The scatter() calls in this test do not use DG2/PVC features. +// The test verifies esimd::slm_scatter() functions accepting optional +// compile-time esimd::properties. The slm_scatter() calls in this test do not +// use VS > 1 (number of stores per offset) to not impose using PVC features. #include "Inputs/scatter.hpp" diff --git a/sycl/test-e2e/ESIMD/unified_memory_api/slm_scatter_legacy.cpp b/sycl/test-e2e/ESIMD/unified_memory_api/slm_scatter_legacy.cpp index a17261b8723f7..0aca53311ef6b 100644 --- a/sycl/test-e2e/ESIMD/unified_memory_api/slm_scatter_legacy.cpp +++ b/sycl/test-e2e/ESIMD/unified_memory_api/slm_scatter_legacy.cpp @@ -9,9 +9,9 @@ // RUN: %{build} -fsycl-device-code-split=per_kernel -o %t.out // RUN: %{run} %t.out -// The test verifies esimd::scatter() functions accepting optional compile-time -// esimd::properties. The scatter() calls in this test do not use VS > 1 (number -// of loads per offset) to not impose using PVC features. +// The test verifies esimd::slm_scatter() functions accepting optional +// compile-time esimd::properties. The slm_scatter() calls in this test do not +// use VS > 1 (number of stores per offset) to not impose using PVC features. // // TODO: Remove this test when GPU driver issue with llvm.masked.scatter is // resolved and ESIMD starts using llvm.masked.scatter by default. diff --git a/sycl/test/esimd/memory_properties.cpp b/sycl/test/esimd/memory_properties.cpp index 5e969aa40d03c..8305bd9b83b18 100644 --- a/sycl/test/esimd/memory_properties.cpp +++ b/sycl/test/esimd/memory_properties.cpp @@ -1281,6 +1281,14 @@ test_gather_scatter(AccType &acc, LocalAccType &local_acc, float *ptrf, scatter(ptrf, ioffset_n16_view, usm_view, mask_n16); scatter(ptrf, ioffset_n16_view, usm_view); + + simd ioffset_n10(byte_offset32, 8); + simd usm_n10; + + // Check special case to verify that for cases when N is not power of 2 llvm + // intrinsic is used + // CHECK-COUNT-1: call void @llvm.masked.scatter.v10f32.v10p4(<10 x float> {{[^)]+}}, <10 x ptr addrspace(4)> {{[^)]+}}, i32 4, <10 x i1> {{[^)]+}}) + scatter(ptrf, ioffset_n10, usm_n10); } // CHECK-LABEL: define {{.*}} @_Z23test_slm_gather_scatter{{.*}} @@ -1429,4 +1437,11 @@ test_slm_gather_scatter(int byte_offset32) { slm_scatter(ioffset_n16_view, slm, mask_n16, props_align4); slm_scatter(ioffset_n16, slm_view, mask_n16, props_align4); slm_scatter(ioffset_n16_view, slm_view, mask_n16, props_align4); + + simd ioffset_n10(byte_offset32, 8); + simd usm_n10; + // Check special case to verify that for cases when N is not power of 2 llvm + // intrinsic is used + // CHECK-COUNT-1: call void @llvm.masked.scatter.v10f32.v10p3(<10 x float> {{[^)]+}}, <10 x ptr addrspace(3)> {{[^)]+}}, i32 4, <10 x i1> {{[^)]+}}) + slm_scatter(ioffset_n10, usm_n10); }