Skip to content

Commit

Permalink
checkpoint. work not yet finished.
Browse files Browse the repository at this point in the history
  • Loading branch information
cperkinsintel committed Feb 14, 2024
1 parent e5da67b commit a231ca5
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 8 deletions.
15 changes: 12 additions & 3 deletions sycl/test-e2e/Plugin/level_zero_ext_intel_cslice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
{
Expand Down Expand Up @@ -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
Expand Down
35 changes: 30 additions & 5 deletions sycl/test-e2e/Plugin/level_zero_ext_intel_queue_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,39 @@

using namespace sycl;

template <typename RangeTy, typename ElemTy>
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<info::device::partition_properties>(), 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<ext::intel::info::device::device_id>() & 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<ext::intel::info::device::device_id>() & 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<ext::intel::info::device::max_compute_queue_indices>() ==
Expand Down
33 changes: 33 additions & 0 deletions sycl/test-e2e/Plugin/level_zero_sub_sub_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,35 @@
using namespace sycl;
using namespace std::chrono;

template <typename RangeTy, typename ElemTy>
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<info::device::partition_properties>(), 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<ext::intel::info::device::device_id>() & 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)
Expand Down Expand Up @@ -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>(
Expand Down

0 comments on commit a231ca5

Please sign in to comment.