From a231ca581f62e24d13a98a13e399123a332a9db2 Mon Sep 17 00:00:00 2001 From: Chris Perkins Date: Tue, 13 Feb 2024 17:31:49 -0800 Subject: [PATCH] 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>(