Skip to content

Commit 86734c0

Browse files
authored
[SYCL][ESIMD][E2E] Add DG2 atomic_update tests (#12131)
Add atomic_update tests for DG2. I manually tested these on PVC Linux and DG2 Linux/Windows. For the normal accessor and USM tests, all tests work on DG2 with no changes, so I just moved the PVC tests to be DG2/PVC tests instead of making new files since there's no code change required besides the `REQUIRED` line. For the SLM and SLM accessor tests, we have to skip 64-bit types as those are not supported for LSC SLM atomics on DG2, if we try to use them we get an error explicitly saying that. So for these I did something similar to what I did for block_load/block_store and just have an if check to skip that case. The diff is a little bit weird, some of the file matching is a bit wrong, so you might have to look for the correct files to compare in the file list. --------- Signed-off-by: Sarnie, Nick <[email protected]>
1 parent 1c8a01d commit 86734c0

17 files changed

+273
-189
lines changed

sycl/test-e2e/ESIMD/unified_memory_api/Inputs/atomic_update.hpp

Lines changed: 86 additions & 84 deletions
Large diffs are not rendered by default.

sycl/test-e2e/ESIMD/unified_memory_api/Inputs/atomic_update_slm.hpp

Lines changed: 71 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "../../esimd_test_utils.hpp"
9+
#include "common.hpp"
1010

1111
#include <iostream>
1212
#include <sycl/ext/intel/esimd.hpp>
@@ -553,38 +553,44 @@ auto run_test(queue q) {
553553
}
554554

555555
template <int N, template <class, int> class Op, bool UseMask,
556-
bool UsePVCFeatures, bool UseAcc, int SignMask = (Signed | Unsigned)>
556+
TestFeatures Features, bool UseAcc,
557+
int SignMask = (Signed | Unsigned)>
557558
bool test_int_types(queue q) {
558559
bool passed = true;
559560
if constexpr (SignMask & Signed) {
560-
if constexpr (UsePVCFeatures)
561+
if constexpr (Features == TestFeatures::DG2 ||
562+
Features == TestFeatures::PVC)
561563
passed &= run_test<UseAcc, int16_t, N, Op, UseMask>(q);
562564

563565
passed &= run_test<UseAcc, int32_t, N, Op, UseMask>(q);
564566

565-
if constexpr (UsePVCFeatures) {
567+
// int64_t not supported on DG2
568+
if constexpr (Features == TestFeatures::PVC) {
566569
passed &= run_test<UseAcc, int64_t, N, Op, UseMask>(q);
567570
}
568571
}
569572

570573
if constexpr (SignMask & Unsigned) {
571-
if constexpr (UsePVCFeatures)
574+
if constexpr (Features == TestFeatures::DG2 ||
575+
Features == TestFeatures::PVC)
572576
passed &= run_test<UseAcc, uint16_t, N, Op, UseMask>(q);
573577

574578
passed &= run_test<UseAcc, uint32_t, N, Op, UseMask>(q);
575579

576-
if constexpr (UsePVCFeatures) {
580+
// uint64_t not supported on DG2
581+
if constexpr (Features == TestFeatures::PVC) {
577582
passed &= run_test<UseAcc, uint64_t, N, Op, UseMask>(q);
578583
}
579584
}
580585
return passed;
581586
}
582587

583588
template <int N, template <class, int> class Op, bool UseMask,
584-
bool UsePVCFeatures, bool UseAcc>
589+
TestFeatures Features, bool UseAcc>
585590
bool test_fp_types(queue q) {
586591
bool passed = true;
587-
if constexpr (UsePVCFeatures) {
592+
if constexpr (Features == TestFeatures::DG2 ||
593+
Features == TestFeatures::PVC) {
588594
if constexpr (std::is_same_v<Op<sycl::half, N>,
589595
ImplLSCFmax<sycl::half, N>> ||
590596
std::is_same_v<Op<sycl::half, N>,
@@ -600,7 +606,8 @@ bool test_fp_types(queue q) {
600606

601607
passed &= run_test<UseAcc, float, N, Op, UseMask>(q);
602608

603-
if constexpr (UsePVCFeatures) {
609+
if constexpr (Features == TestFeatures::DG2 ||
610+
Features == TestFeatures::PVC) {
604611
// TODO: fmin/max for double does not pass validation likely due to
605612
// a driver bug. fcmpwr is hanging.
606613
if constexpr (!std::is_same_v<Op<double, N>, ImplLSCFmax<double, N>> &&
@@ -615,142 +622,133 @@ bool test_fp_types(queue q) {
615622
return passed;
616623
}
617624

618-
template <template <class, int> class Op, bool UseMask, bool UsePVCFeatures,
625+
template <template <class, int> class Op, bool UseMask, TestFeatures Features,
619626
bool UseAcc, int SignMask = (Signed | Unsigned)>
620627
bool test_int_types_and_sizes(queue q) {
621628
bool passed = true;
622-
passed &= test_int_types<1, Op, UseMask, UsePVCFeatures, UseAcc, SignMask>(q);
623-
passed &= test_int_types<2, Op, UseMask, UsePVCFeatures, UseAcc, SignMask>(q);
624-
passed &= test_int_types<4, Op, UseMask, UsePVCFeatures, UseAcc, SignMask>(q);
625-
passed &= test_int_types<8, Op, UseMask, UsePVCFeatures, UseAcc, SignMask>(q);
629+
passed &= test_int_types<1, Op, UseMask, Features, UseAcc, SignMask>(q);
630+
passed &= test_int_types<2, Op, UseMask, Features, UseAcc, SignMask>(q);
631+
passed &= test_int_types<4, Op, UseMask, Features, UseAcc, SignMask>(q);
632+
passed &= test_int_types<8, Op, UseMask, Features, UseAcc, SignMask>(q);
626633
// TODO: N=16 and N=32 does not pass on Gen12 with mask due to older driver.
627-
if (UseMask && !UsePVCFeatures &&
634+
if (UseMask && Features == TestFeatures::Generic &&
628635
esimd_test::isGPUDriverGE(q, esimd_test::GPUDriverOS::LinuxAndWindows,
629636
"26918", "101.4953", false)) {
630-
passed &=
631-
test_int_types<16, Op, UseMask, UsePVCFeatures, UseAcc, SignMask>(q);
632-
passed &=
633-
test_int_types<32, Op, UseMask, UsePVCFeatures, UseAcc, SignMask>(q);
637+
passed &= test_int_types<16, Op, UseMask, Features, UseAcc, SignMask>(q);
638+
passed &= test_int_types<32, Op, UseMask, Features, UseAcc, SignMask>(q);
634639
}
635640

636641
// Supported by LSC atomic:
637-
if constexpr (UsePVCFeatures) {
638-
passed &=
639-
test_int_types<64, Op, UseMask, UsePVCFeatures, UseAcc, SignMask>(q);
642+
if constexpr (Features == TestFeatures::DG2 ||
643+
Features == TestFeatures::PVC) {
644+
passed &= test_int_types<64, Op, UseMask, Features, UseAcc, SignMask>(q);
640645
// non power of two values are supported only in newer driver.
641646
// TODO: Enable this when the new driver reaches test infrastructure
642647
// (v27556).
643648
#if 0
644-
passed &= test_int_types<12, Op, UseMask, UsePVCFeatures, UseAcc, SignMask>(q);
645-
passed &= test_int_types<33, Op, UseMask, UsePVCFeatures, UseAcc, SignMask>(q);
649+
passed &= test_int_types<12, Op, UseMask, Features, UseAcc, SignMask>(q);
650+
passed &= test_int_types<33, Op, UseMask, Features, UseAcc, SignMask>(q);
646651
#endif
647652
}
648653

649654
return passed;
650655
}
651656

652-
template <template <class, int> class Op, bool UseMask, bool UsePVCFeatures,
657+
template <template <class, int> class Op, bool UseMask, TestFeatures Features,
653658
bool UseAcc>
654659
bool test_fp_types_and_sizes(queue q) {
655660
bool passed = true;
656-
passed &= test_fp_types<1, Op, UseMask, UsePVCFeatures, UseAcc>(q);
657-
passed &= test_fp_types<2, Op, UseMask, UsePVCFeatures, UseAcc>(q);
658-
passed &= test_fp_types<4, Op, UseMask, UsePVCFeatures, UseAcc>(q);
659-
passed &= test_fp_types<8, Op, UseMask, UsePVCFeatures, UseAcc>(q);
660-
passed &= test_fp_types<16, Op, UseMask, UsePVCFeatures, UseAcc>(q);
661-
passed &= test_fp_types<32, Op, UseMask, UsePVCFeatures, UseAcc>(q);
661+
passed &= test_fp_types<1, Op, UseMask, Features, UseAcc>(q);
662+
passed &= test_fp_types<2, Op, UseMask, Features, UseAcc>(q);
663+
passed &= test_fp_types<4, Op, UseMask, Features, UseAcc>(q);
664+
passed &= test_fp_types<8, Op, UseMask, Features, UseAcc>(q);
665+
passed &= test_fp_types<16, Op, UseMask, Features, UseAcc>(q);
666+
passed &= test_fp_types<32, Op, UseMask, Features, UseAcc>(q);
662667

663668
// Supported by LSC atomic:
664-
if constexpr (UsePVCFeatures) {
665-
passed &= test_fp_types<64, Op, UseMask, UsePVCFeatures, UseAcc>(q);
669+
if constexpr (Features == TestFeatures::DG2 ||
670+
Features == TestFeatures::PVC) {
671+
passed &= test_fp_types<64, Op, UseMask, Features, UseAcc>(q);
666672
// non power of two values are supported only in newer driver.
667673
// TODO: Enable this when the new driver reaches test infrastructure
668674
// (v27556).
669675
#if 0
670-
passed &= test_fp_types<33, Op, UseMask, UsePVCFeatures, UseAcc>(q);
671-
passed &= test_fp_types<65, Op, UseMask, UsePVCFeatures, UseAcc>(q);
676+
passed &= test_fp_types<33, Op, UseMask, Features, UseAcc>(q);
677+
passed &= test_fp_types<65, Op, UseMask, Features, UseAcc>(q);
672678
#endif
673679
}
674680
return passed;
675681
}
676682

677-
template <bool UseMask, bool UsePVCFeatures, bool UseAcc>
683+
template <bool UseMask, TestFeatures Features, bool UseAcc>
678684
int test_with_mask(queue q) {
679685
bool passed = true;
680686
#ifndef CMPXCHG_TEST
687+
passed &= test_int_types_and_sizes<ImplInc, UseMask, Features, UseAcc>(q);
688+
passed &= test_int_types_and_sizes<ImplDec, UseMask, Features, UseAcc>(q);
689+
690+
passed &= test_int_types_and_sizes<ImplIntAdd, UseMask, Features, UseAcc>(q);
691+
passed &= test_int_types_and_sizes<ImplIntSub, UseMask, Features, UseAcc>(q);
692+
681693
passed &=
682-
test_int_types_and_sizes<ImplInc, UseMask, UsePVCFeatures, UseAcc>(q);
694+
test_int_types_and_sizes<ImplSMax, UseMask, Features, UseAcc, Signed>(q);
683695
passed &=
684-
test_int_types_and_sizes<ImplDec, UseMask, UsePVCFeatures, UseAcc>(q);
696+
test_int_types_and_sizes<ImplSMin, UseMask, Features, UseAcc, Signed>(q);
685697

686698
passed &=
687-
test_int_types_and_sizes<ImplIntAdd, UseMask, UsePVCFeatures, UseAcc>(q);
699+
test_int_types_and_sizes<ImplUMax, UseMask, Features, UseAcc, Unsigned>(
700+
q);
688701
passed &=
689-
test_int_types_and_sizes<ImplIntSub, UseMask, UsePVCFeatures, UseAcc>(q);
690-
691-
passed &= test_int_types_and_sizes<ImplSMax, UseMask, UsePVCFeatures, UseAcc,
692-
Signed>(q);
693-
passed &= test_int_types_and_sizes<ImplSMin, UseMask, UsePVCFeatures, UseAcc,
694-
Signed>(q);
695-
696-
passed &= test_int_types_and_sizes<ImplUMax, UseMask, UsePVCFeatures, UseAcc,
697-
Unsigned>(q);
698-
passed &= test_int_types_and_sizes<ImplUMin, UseMask, UsePVCFeatures, UseAcc,
699-
Unsigned>(q);
702+
test_int_types_and_sizes<ImplUMin, UseMask, Features, UseAcc, Unsigned>(
703+
q);
700704

701-
if constexpr (UsePVCFeatures) {
705+
if constexpr (Features == TestFeatures::DG2 ||
706+
Features == TestFeatures::PVC) {
702707
passed &=
703-
test_fp_types_and_sizes<ImplLSCFmax, UseMask, UsePVCFeatures, UseAcc>(
704-
q);
708+
test_fp_types_and_sizes<ImplLSCFmax, UseMask, Features, UseAcc>(q);
705709
passed &=
706-
test_fp_types_and_sizes<ImplLSCFmin, UseMask, UsePVCFeatures, UseAcc>(
707-
q);
710+
test_fp_types_and_sizes<ImplLSCFmin, UseMask, Features, UseAcc>(q);
708711

709712
// TODO: fadd/fsub are emulated in the newer driver, but do not pass
710713
// validation.
711714
#if 0
712-
passed &= test_fp_types_and_sizes<ImplFadd, UseMask, UsePVCFeatures, UseAcc>(q);
713-
passed &= test_fp_types_and_sizes<ImplFsub, UseMask, UsePVCFeatures, UseAcc>(q);
715+
passed &= test_fp_types_and_sizes<ImplFadd, UseMask, Features, UseAcc>(q);
716+
passed &= test_fp_types_and_sizes<ImplFsub, UseMask, Features, UseAcc>(q);
714717
#endif
715718

716719
// Check load/store operations.
717-
passed &=
718-
test_int_types_and_sizes<ImplLoad, UseMask, UsePVCFeatures, UseAcc>(q);
719-
passed &=
720-
test_int_types_and_sizes<ImplStore, UseMask, UsePVCFeatures, UseAcc>(q);
721-
passed &=
722-
test_fp_types_and_sizes<ImplStore, UseMask, UsePVCFeatures, UseAcc>(q);
720+
passed &= test_int_types_and_sizes<ImplLoad, UseMask, Features, UseAcc>(q);
721+
passed &= test_int_types_and_sizes<ImplStore, UseMask, Features, UseAcc>(q);
722+
passed &= test_fp_types_and_sizes<ImplStore, UseMask, Features, UseAcc>(q);
723723
}
724724
#else
725+
passed &= test_int_types_and_sizes<ImplCmpxchg, UseMask, Features, UseAcc>(q);
725726
passed &=
726-
test_int_types_and_sizes<ImplCmpxchg, UseMask, UsePVCFeatures, UseAcc>(q);
727-
passed &=
728-
test_fp_types_and_sizes<ImplLSCFcmpwr, UseMask, UsePVCFeatures, UseAcc>(
729-
q);
727+
test_fp_types_and_sizes<ImplLSCFcmpwr, UseMask, Features, UseAcc>(q);
730728
#endif
731729
return passed;
732730
}
733731

734-
template <bool UsePVCFeatures> bool test_main(queue q) {
732+
template <TestFeatures Features> bool test_main(queue q) {
735733
bool passed = true;
736734

737735
constexpr const bool UseMask = true;
738736
constexpr const bool UseAcc = true;
739737

740-
passed &= test_with_mask<UseMask, UsePVCFeatures, !UseAcc>(q);
741-
passed &= test_with_mask<!UseMask, UsePVCFeatures, !UseAcc>(q);
738+
passed &= test_with_mask<UseMask, Features, !UseAcc>(q);
739+
passed &= test_with_mask<!UseMask, Features, !UseAcc>(q);
742740

743741
return passed;
744742
}
745743

746-
template <bool UsePVCFeatures> bool test_main_acc(queue q) {
744+
template <TestFeatures Features> bool test_main_acc(queue q) {
747745
bool passed = true;
748746

749747
constexpr const bool UseMask = true;
750748
constexpr const bool UseAcc = true;
751749

752-
passed &= test_with_mask<UseMask, UsePVCFeatures, UseAcc>(q);
753-
passed &= test_with_mask<!UseMask, UsePVCFeatures, UseAcc>(q);
750+
passed &= test_with_mask<UseMask, Features, UseAcc>(q);
751+
passed &= test_with_mask<!UseMask, Features, UseAcc>(q);
754752

755753
return passed;
756754
}

sycl/test-e2e/ESIMD/unified_memory_api/atomic_update_acc_pvc.cpp renamed to sycl/test-e2e/ESIMD/unified_memory_api/atomic_update_acc_dg2_pvc.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
//==------- atomic_update_acc_pvc.cpp - DPC++ ESIMD on-device test ---------==//
1+
//==----- atomic_update_acc_dg2_pvc.cpp - DPC++ ESIMD on-device test ----==//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
7-
//===----------------------------------------------------------------------===//
7+
//===-------------------------------------------------------------------===//
88

9-
// REQUIRES: gpu-intel-pvc
9+
// REQUIRES: gpu-intel-pvc || gpu-intel-dg2
1010

1111
// RUN: %{build} -o %t.out
1212
// RUN: %{run} %t.out
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
//==-- atomic_update_acc_pvc_64.cpp - DPC++ ESIMD on-device test----==//
1+
//==-- atomic_update_acc_dg2_pvc_64.cpp - DPC++ ESIMD on-device test----==//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===--------------------------------------------------------------===//
88

9-
// REQUIRES: gpu-intel-pvc
9+
// REQUIRES: gpu-intel-pvc || gpu-intel-dg2
1010

1111
// RUN: %{build} -fsycl-esimd-force-stateless-mem -o %t.out
1212
// RUN: %{run} %t.out
1313

1414
// 64-bit offset is supported for accessors only in stateless mode
1515
#define USE_64_BIT_OFFSET
1616

17-
#include "atomic_update_acc_pvc.cpp"
17+
#include "atomic_update_acc_dg2_pvc.cpp"
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
//==-- atomic_update_acc_pvc_stateless.cpp - DPC++ ESIMD on-device test --==//
1+
//==-- atomic_update_acc_dg2_pvc_cmpxchg.cpp- DPC++ ESIMD on-device test --==//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
7-
//===-------------------------------------------------------------------===//
7+
//===---------------------------------------------------------------------===//
88

9-
// REQUIRES: gpu-intel-pvc
9+
// REQUIRES: gpu-intel-pvc || gpu-intel-dg2
1010

11-
// RUN: %{build} -fsycl-esimd-force-stateless-mem -o %t.out
11+
// RUN: %{build} -o %t.out
1212
// RUN: %{run} %t.out
1313

14-
#include "atomic_update_acc_pvc.cpp"
14+
#define CMPXCHG_TEST
15+
16+
#include "atomic_update_acc_dg2_pvc.cpp"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//=- atomic_update_acc_dg2_pvc_stateless.cpp - DPC++ ESIMD on-device test -=//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//=-----------------------------------------------------------------------=//
8+
9+
// REQUIRES: gpu-intel-pvc || gpu-intel-dg2
10+
11+
// RUN: %{build} -fsycl-esimd-force-stateless-mem -o %t.out
12+
// RUN: %{run} %t.out
13+
14+
#include "atomic_update_acc_dg2_pvc.cpp"

sycl/test-e2e/ESIMD/unified_memory_api/atomic_update_slm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ int main(void) {
1515

1616
esimd_test::printTestLabel(q);
1717

18-
constexpr bool TestCacheHintProperties = true;
19-
bool passed = test_main<!TestCacheHintProperties>(q);
18+
constexpr auto Features = TestFeatures::Generic;
19+
bool passed = test_main<Features>(q);
2020

2121
std::cout << (passed ? "Passed\n" : "FAILED\n");
2222
return passed ? 0 : 1;

sycl/test-e2e/ESIMD/unified_memory_api/atomic_update_slm_acc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ int main(void) {
1616

1717
esimd_test::printTestLabel(q);
1818

19-
constexpr bool TestCacheHintProperties = true;
20-
bool passed = test_main_acc<!TestCacheHintProperties>(q);
19+
constexpr auto Features = TestFeatures::Generic;
20+
bool passed = test_main_acc<Features>(q);
2121

2222
std::cout << (passed ? "Passed\n" : "FAILED\n");
2323
return passed ? 0 : 1;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//==------- atomic_update_slm_acc_dg2.cpp - DPC++ ESIMD on-device test -----==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// REQUIRES: gpu-intel-dg2
10+
11+
// RUN: %{build} -o %t.out
12+
// RUN: %{run} %t.out
13+
14+
#include "Inputs/atomic_update_slm.hpp"
15+
16+
int main(void) {
17+
queue q(esimd_test::ESIMDSelector, esimd_test::createExceptionHandler());
18+
19+
esimd_test::printTestLabel(q);
20+
21+
constexpr auto Features = TestFeatures::DG2;
22+
bool passed = test_main_acc<Features>(q);
23+
24+
std::cout << (passed ? "Passed\n" : "FAILED\n");
25+
return passed ? 0 : 1;
26+
}

0 commit comments

Comments
 (0)