From a231ca581f62e24d13a98a13e399123a332a9db2 Mon Sep 17 00:00:00 2001 From: Chris Perkins Date: Tue, 13 Feb 2024 17:31:49 -0800 Subject: [PATCH 1/2] checkpoint. work not yet finished. --- .../Plugin/level_zero_ext_intel_cslice.cpp | 15 ++++++-- .../level_zero_ext_intel_queue_index.cpp | 35 ++++++++++++++++--- .../Plugin/level_zero_sub_sub_device.cpp | 33 +++++++++++++++++ 3 files changed, 75 insertions(+), 8 deletions(-) diff --git a/sycl/test-e2e/Plugin/level_zero_ext_intel_cslice.cpp b/sycl/test-e2e/Plugin/level_zero_ext_intel_cslice.cpp index 25a97c4e26238..c14d0d027250a 100644 --- a/sycl/test-e2e/Plugin/level_zero_ext_intel_cslice.cpp +++ b/sycl/test-e2e/Plugin/level_zero_ext_intel_cslice.cpp @@ -53,11 +53,20 @@ bool IsPVC(device &d) { return masked_device_id == 0xbd0 || masked_device_id == 0xb60; } +bool IsPVC_2T(device &d) { + // PVC-1T does not support partitioning by affinity domain, + // while PVC-2T does. + if (!isPartitionableByAffinityDomain(d)) + return false; + + return IsPVC(d); +} + void test_pvc(device &d) { std::cout << "Test PVC Begin" << std::endl; // CHECK-PVC: Test PVC Begin - std::cout << "IsPVC: " << IsPVC(d) << std::endl; - if (IsPVC(d)) { + std::cout << "IsPVC: " << IsPVC_2T(d) << std::endl; + if (IsPVC_2T(d)) { assert(isPartitionableByAffinityDomain(d)); assert(!isPartitionableByCSlice(d)); { @@ -146,7 +155,7 @@ void test_pvc(device &d) { } void test_non_pvc(device &d) { - if (IsPVC(d)) + if (IsPVC_2T(d)) return; // Non-PVC devices are not partitionable by CSlice at any level of diff --git a/sycl/test-e2e/Plugin/level_zero_ext_intel_queue_index.cpp b/sycl/test-e2e/Plugin/level_zero_ext_intel_queue_index.cpp index e04f280a8e986..671ca04257f9e 100644 --- a/sycl/test-e2e/Plugin/level_zero_ext_intel_queue_index.cpp +++ b/sycl/test-e2e/Plugin/level_zero_ext_intel_queue_index.cpp @@ -10,14 +10,39 @@ using namespace sycl; +template +bool contains(RangeTy &&Range, const ElemTy &Elem) { + return std::find(Range.begin(), Range.end(), Elem) != Range.end(); +} + +bool isPartitionableBy(device &Dev, info::partition_property Prop) { + return contains(Dev.get_info(), Prop); +} + +bool isPartitionableByAffinityDomain(device &Dev) { + return isPartitionableBy( + Dev, info::partition_property::partition_by_affinity_domain); +} + +bool IsPVC(device &d) { + uint32_t masked_device_id = + d.get_info() & 0xff0; + return masked_device_id == 0xbd0 || masked_device_id == 0xb60; +} + +bool IsPVC_2T(device &d) { + // PVC-1T does not support partitioning by affinity domain, + // while PVC-2T does. + if (!isPartitionableByAffinityDomain(d)) + return false; + + return IsPVC(d); +} + void test_pvc(device &d) { std::cout << "Test PVC Begin" << std::endl; // CHECK-PVC: Test PVC Begin - bool IsPVC = [&]() { - uint32_t masked_device_id = - d.get_info() & 0xff0; - return masked_device_id == 0xbd0 || masked_device_id == 0xb60; - }(); + bool IsPVC = IsPVC_2T(d); std::cout << "IsPVC: " << std::boolalpha << IsPVC << std::endl; if (IsPVC) { assert(d.get_info() == diff --git a/sycl/test-e2e/Plugin/level_zero_sub_sub_device.cpp b/sycl/test-e2e/Plugin/level_zero_sub_sub_device.cpp index 60287e71cee85..a47ff966576a2 100644 --- a/sycl/test-e2e/Plugin/level_zero_sub_sub_device.cpp +++ b/sycl/test-e2e/Plugin/level_zero_sub_sub_device.cpp @@ -21,6 +21,35 @@ using namespace sycl; using namespace std::chrono; +template +bool contains(RangeTy &&Range, const ElemTy &Elem) { + return std::find(Range.begin(), Range.end(), Elem) != Range.end(); +} + +bool isPartitionableBy(device &Dev, info::partition_property Prop) { + return contains(Dev.get_info(), Prop); +} + +bool isPartitionableByAffinityDomain(device &Dev) { + return isPartitionableBy( + Dev, info::partition_property::partition_by_affinity_domain); +} + +bool IsPVC(device &d) { + uint32_t masked_device_id = + d.get_info() & 0xff0; + return masked_device_id == 0xbd0 || masked_device_id == 0xb60; +} + +bool IsPVC_2T(device &d) { + // PVC-1T does not support partitioning by affinity domain, + // while PVC-2T does. + if (!isPartitionableByAffinityDomain(d)) + return false; + + return IsPVC(d); +} + #define random_float() (rand() / double(RAND_MAX)) #define INTER_NUM (150) #define KERNEL_NUM (2000) @@ -91,6 +120,10 @@ int main(void) { device d; + // PVC-1T does not support partition by affinity domain + if (!IsPVC_2T(d)) + return 0; + // watch out device here auto subdevices = d.create_sub_devices< info::partition_property::partition_by_affinity_domain>( From ba058de70a8d747256d055d0c08f82d1fb0ebc67 Mon Sep 17 00:00:00 2001 From: Chris Perkins Date: Wed, 14 Feb 2024 11:23:00 -0800 Subject: [PATCH 2/2] Some of our PVC tests were assuming multiple tiles, but that is not the case in all installations. --- .../test-e2e/Plugin/level_zero_ext_intel_cslice.cpp | 12 ++++++------ .../Plugin/level_zero_ext_intel_queue_index.cpp | 8 ++++---- sycl/test-e2e/Plugin/level_zero_sub_sub_device.cpp | 13 +++++++++---- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/sycl/test-e2e/Plugin/level_zero_ext_intel_cslice.cpp b/sycl/test-e2e/Plugin/level_zero_ext_intel_cslice.cpp index c14d0d027250a..baba839e34797 100644 --- a/sycl/test-e2e/Plugin/level_zero_ext_intel_cslice.cpp +++ b/sycl/test-e2e/Plugin/level_zero_ext_intel_cslice.cpp @@ -53,9 +53,9 @@ bool IsPVC(device &d) { return masked_device_id == 0xbd0 || masked_device_id == 0xb60; } -bool IsPVC_2T(device &d) { - // PVC-1T does not support partitioning by affinity domain, - // while PVC-2T does. +bool IsPVC_MultiTiles(device &d) { + // PVC-1T (one tile) does not support partitioning by affinity domain, + // which this test requires if (!isPartitionableByAffinityDomain(d)) return false; @@ -65,8 +65,8 @@ bool IsPVC_2T(device &d) { void test_pvc(device &d) { std::cout << "Test PVC Begin" << std::endl; // CHECK-PVC: Test PVC Begin - std::cout << "IsPVC: " << IsPVC_2T(d) << std::endl; - if (IsPVC_2T(d)) { + std::cout << "IsPVC: " << IsPVC_MultiTiles(d) << std::endl; + if (IsPVC_MultiTiles(d)) { assert(isPartitionableByAffinityDomain(d)); assert(!isPartitionableByCSlice(d)); { @@ -155,7 +155,7 @@ void test_pvc(device &d) { } void test_non_pvc(device &d) { - if (IsPVC_2T(d)) + if (IsPVC_MultiTiles(d)) return; // Non-PVC devices are not partitionable by CSlice at any level of diff --git a/sycl/test-e2e/Plugin/level_zero_ext_intel_queue_index.cpp b/sycl/test-e2e/Plugin/level_zero_ext_intel_queue_index.cpp index 671ca04257f9e..e506dfd3b247a 100644 --- a/sycl/test-e2e/Plugin/level_zero_ext_intel_queue_index.cpp +++ b/sycl/test-e2e/Plugin/level_zero_ext_intel_queue_index.cpp @@ -30,9 +30,9 @@ bool IsPVC(device &d) { return masked_device_id == 0xbd0 || masked_device_id == 0xb60; } -bool IsPVC_2T(device &d) { - // PVC-1T does not support partitioning by affinity domain, - // while PVC-2T does. +bool IsPVC_MultiTiles(device &d) { + // PVC-1T (one tile) does not support partitioning by affinity domain, + // which this test requires if (!isPartitionableByAffinityDomain(d)) return false; @@ -42,7 +42,7 @@ bool IsPVC_2T(device &d) { void test_pvc(device &d) { std::cout << "Test PVC Begin" << std::endl; // CHECK-PVC: Test PVC Begin - bool IsPVC = IsPVC_2T(d); + bool IsPVC = IsPVC_MultiTiles(d); std::cout << "IsPVC: " << std::boolalpha << IsPVC << std::endl; if (IsPVC) { assert(d.get_info() == diff --git a/sycl/test-e2e/Plugin/level_zero_sub_sub_device.cpp b/sycl/test-e2e/Plugin/level_zero_sub_sub_device.cpp index a47ff966576a2..5a814b064439c 100644 --- a/sycl/test-e2e/Plugin/level_zero_sub_sub_device.cpp +++ b/sycl/test-e2e/Plugin/level_zero_sub_sub_device.cpp @@ -1,4 +1,5 @@ // REQUIRES: gpu-intel-pvc, level_zero +// REQUIRES: aspect-ext_intel_device_id // RUN: %{build} %level_zero_options -o %t.out // RUN: env UR_L0_DEBUG=1 env ZEX_NUMBER_OF_CCS=0:4 %{run} %t.out 2>&1 | FileCheck %s @@ -6,10 +7,12 @@ // Check that queues created on sub-sub-devices are going to specific compute // engines: +auto constexpr expected_output = R"===( // CHECK: [getZeQueue]: create queue ordinal = 0, index = 0 (round robin in [0, 0]) // CHECK: [getZeQueue]: create queue ordinal = 0, index = 1 (round robin in [1, 1]) // CHECK: [getZeQueue]: create queue ordinal = 0, index = 2 (round robin in [2, 2]) // CHECK: [getZeQueue]: create queue ordinal = 0, index = 3 (round robin in [3, 3]) +)==="; #include #include @@ -41,9 +44,9 @@ bool IsPVC(device &d) { return masked_device_id == 0xbd0 || masked_device_id == 0xb60; } -bool IsPVC_2T(device &d) { - // PVC-1T does not support partitioning by affinity domain, - // while PVC-2T does. +bool IsPVC_MultiTiles(device &d) { + // PVC-1T (one tile) does not support partitioning by affinity domain, + // which this test requires if (!isPartitionableByAffinityDomain(d)) return false; @@ -121,8 +124,10 @@ int main(void) { device d; // PVC-1T does not support partition by affinity domain - if (!IsPVC_2T(d)) + if (!IsPVC_MultiTiles(d)) { + std::cout << expected_output << std::endl; // trick FileCheck return 0; + } // watch out device here auto subdevices = d.create_sub_devices<