|
| 1 | +// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %level_zero_options %s -o %t.out |
| 2 | +// RUN: env ZEX_NUMBER_OF_CCS=0:4 env ZE_DEBUG=1 %GPU_RUN_PLACEHOLDER %t.out > %t.log 2>&1 |
| 3 | +// RUN: %GPU_RUN_PLACEHOLDER FileCheck %s --check-prefixes=CHECK-PVC < %t.log |
| 4 | +// |
| 5 | +// Same with Immediate CommandLists |
| 6 | +// RUN: env SYCL_PI_LEVEL_ZERO_EXPOSE_CSLICE_IN_AFFINITY_PARTITIONING=1 env ZEX_NUMBER_OF_CCS=0:4 env ZE_DEBUG=1 %GPU_RUN_PLACEHOLDER %t.out > %t.log 2>&1 |
| 7 | +// RUN: %GPU_RUN_PLACEHOLDER FileCheck %s --check-prefixes=CHECK-PVC < %t.log |
| 8 | + |
| 9 | +// Requires: level_zero |
| 10 | + |
| 11 | +#include <sycl/sycl.hpp> |
| 12 | + |
| 13 | +using namespace sycl; |
| 14 | + |
| 15 | +void test_pvc(device &d) { |
| 16 | + std::cout << "Test PVC Begin" << std::endl; |
| 17 | + // CHECK-PVC: Test PVC Begin |
| 18 | + bool IsPVC = [&]() { |
| 19 | + if (!d.has(aspect::ext_intel_device_id)) |
| 20 | + return false; |
| 21 | + return (d.get_info<ext::intel::info::device::device_id>() & 0xff0) == 0xbd0; |
| 22 | + }(); |
| 23 | + std::cout << "IsPVC: " << std::boolalpha << IsPVC << std::endl; |
| 24 | + if (IsPVC) { |
| 25 | + assert(d.get_info<ext::intel::info::device::max_compute_queue_indices>() == |
| 26 | + 1); |
| 27 | + |
| 28 | + auto sub_devices = d.create_sub_devices< |
| 29 | + info::partition_property::partition_by_affinity_domain>( |
| 30 | + info::partition_affinity_domain::next_partitionable); |
| 31 | + device &sub_device = sub_devices[1]; |
| 32 | + assert( |
| 33 | + sub_device |
| 34 | + .get_info<ext::intel::info::device::max_compute_queue_indices>() == |
| 35 | + 4); |
| 36 | + |
| 37 | + auto sub_sub_devices = sub_device.create_sub_devices< |
| 38 | + info::partition_property::ext_intel_partition_by_cslice>(); |
| 39 | + device &sub_sub_device = sub_sub_devices[1]; |
| 40 | + assert( |
| 41 | + sub_sub_device |
| 42 | + .get_info<ext::intel::info::device::max_compute_queue_indices>() == |
| 43 | + 1); |
| 44 | + |
| 45 | + { |
| 46 | + bool ExceptionThrown = false; |
| 47 | + try { |
| 48 | + std::ignore = queue{d, ext::intel::property::queue::compute_index{-1}}; |
| 49 | + |
| 50 | + } catch (...) { |
| 51 | + ExceptionThrown = true; |
| 52 | + } |
| 53 | + assert(ExceptionThrown); |
| 54 | + } |
| 55 | + { |
| 56 | + bool ExceptionThrown = false; |
| 57 | + try { |
| 58 | + std::ignore = queue{sub_sub_device, |
| 59 | + ext::intel::property::queue::compute_index{1}}; |
| 60 | + |
| 61 | + } catch (...) { |
| 62 | + ExceptionThrown = true; |
| 63 | + } |
| 64 | + assert(ExceptionThrown); |
| 65 | + } |
| 66 | + |
| 67 | + { |
| 68 | + queue q{sub_device}; |
| 69 | + // CHECK-PVC: [getZeQueue]: create queue ordinal = 0, index = 0 (round robin in [0, 0]) |
| 70 | + q.single_task([=]() {}).wait(); |
| 71 | + } |
| 72 | + { |
| 73 | + queue q{sub_device, ext::intel::property::queue::compute_index{2}}; |
| 74 | + // CHECK-PVC: [getZeQueue]: create queue ordinal = 0, index = 2 (round robin in [2, 2]) |
| 75 | + q.single_task([=]() {}).wait(); |
| 76 | + } |
| 77 | + { |
| 78 | + queue q{sub_device, ext::intel::property::queue::compute_index{2}}; |
| 79 | + // CHECK-PVC: [getZeQueue]: create queue ordinal = 0, index = 2 (round robin in [2, 2]) |
| 80 | + q.single_task([=]() {}).wait(); |
| 81 | + } |
| 82 | + { |
| 83 | + queue q{sub_sub_device}; |
| 84 | + // CHECK-PVC: [getZeQueue]: create queue ordinal = 0, index = 1 (round robin in [1, 1]) |
| 85 | + q.single_task([=]() {}).wait(); |
| 86 | + } |
| 87 | + } else { |
| 88 | + // Make FileCheck pass. |
| 89 | + std::cout << "Fake ZE_DEBUG output for FileCheck:" << std::endl; |
| 90 | + // clang-format off |
| 91 | + std::cout << "[getZeQueue]: create queue ordinal = 0, index = 0 (round robin in [0, 0])" << std::endl; |
| 92 | + std::cout << "[getZeQueue]: create queue ordinal = 0, index = 2 (round robin in [2, 2])" << std::endl; |
| 93 | + std::cout << "[getZeQueue]: create queue ordinal = 0, index = 2 (round robin in [2, 2])" << std::endl; |
| 94 | + std::cout << "[getZeQueue]: create queue ordinal = 0, index = 1 (round robin in [1, 1])" << std::endl; |
| 95 | + // clang-format on |
| 96 | + } |
| 97 | + std::cout << "Test PVC End" << std::endl; |
| 98 | + // CHECK-PVC: Test PVC End |
| 99 | +} |
| 100 | + |
| 101 | +int main() { |
| 102 | + device d; |
| 103 | + |
| 104 | + test_pvc(d); |
| 105 | + |
| 106 | + return 0; |
| 107 | +} |
0 commit comments