Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL] Modify test for changing namespace for intel device info extensions #1178

Merged
merged 8 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 56 additions & 11 deletions SYCL/Basic/intel-ext-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// UNSUPPORTED: cuda
// UNSUPPORTED: hip
// Temporarily disable on L0 due to fails in CI
// UNSUPPORTED: level_zero

//==--------- intel-ext-device.cpp - SYCL device test ------------==//
//
Expand All @@ -21,6 +20,7 @@

#include <sycl/sycl.hpp>

#include <cassert>
#include <iostream>

using namespace sycl;
Expand Down Expand Up @@ -66,43 +66,45 @@ int main(int argc, char **argv) {

if (dev.has(aspect::ext_intel_pci_address)) {
std::cout << "PCI address = "
<< dev.get_info<info::device::ext_intel_pci_address>()
<< dev.get_info<ext::intel::info::device::pci_address>()
<< std::endl;
}
if (dev.has(aspect::ext_intel_gpu_eu_count)) {
totalEUs = dev.get_info<info::device::ext_intel_gpu_eu_count>();
totalEUs = dev.get_info<ext::intel::info::device::gpu_eu_count>();
std::cout << "Number of EUs = " << totalEUs << std::endl;
}
if (dev.has(aspect::ext_intel_gpu_eu_simd_width)) {
int w = dev.get_info<info::device::ext_intel_gpu_eu_simd_width>();
int w =
dev.get_info<ext::intel::info::device::gpu_eu_simd_width>();
std::cout << "EU SIMD width = " << w << std::endl;
}
if (dev.has(aspect::ext_intel_gpu_slices)) {
numSlices = dev.get_info<info::device::ext_intel_gpu_slices>();
numSlices = dev.get_info<ext::intel::info::device::gpu_slices>();
std::cout << "Number of slices = " << numSlices << std::endl;
}
if (dev.has(aspect::ext_intel_gpu_subslices_per_slice)) {
numSubslices = dev.get_info<
info::device::ext_intel_gpu_subslices_per_slice>();
ext::intel::info::device::gpu_subslices_per_slice>();
std::cout << "Number of subslices per slice = " << numSubslices
<< std::endl;
}
if (dev.has(aspect::ext_intel_gpu_eu_count_per_subslice)) {
numEUsPerSubslice = dev.get_info<
info::device::ext_intel_gpu_eu_count_per_subslice>();
ext::intel::info::device::gpu_eu_count_per_subslice>();
std::cout << "Number of EUs per subslice = " << numEUsPerSubslice
<< std::endl;
}
if (dev.has(aspect::ext_intel_gpu_hw_threads_per_eu)) {
numHWThreadsPerEU =
dev.get_info<info::device::ext_intel_gpu_hw_threads_per_eu>();
if (SYCL_EXT_INTEL_DEVICE_INFO >= 3 &&
dev.has(aspect::ext_intel_gpu_hw_threads_per_eu)) {
numHWThreadsPerEU = dev.get_info<
ext::intel::info::device::gpu_hw_threads_per_eu>();
std::cout << "Number of HW threads per EU = " << numHWThreadsPerEU
<< std::endl;
}
if (dev.has(aspect::ext_intel_max_mem_bandwidth)) {
// not supported yet
long m =
dev.get_info<info::device::ext_intel_max_mem_bandwidth>();
dev.get_info<ext::intel::info::device::max_mem_bandwidth>();
std::cout << "Maximum memory bandwidth = " << m << std::endl;
}
// This is the only data we can verify.
Expand All @@ -111,8 +113,51 @@ int main(int argc, char **argv) {
std::cout << "Failed!" << std::endl;
return 1;
}
if (SYCL_EXT_INTEL_DEVICE_INFO >= 2 &&
dev.has(aspect::ext_intel_device_info_uuid)) {
auto UUID = dev.get_info<ext::intel::info::device::uuid>();
std::cout << "Device UUID = ";
for (int i = 0; i < 16; i++) {
std::cout << std::to_string(UUID[i]);
}
std::cout << "\n";
}
} // SYCL_EXT_INTEL_DEVICE_INFO
}

// Check if this experimental feature is supported
#ifdef SYCL_EXT_ONEAPI_MAX_WORK_GROUP_QUERY
sycl::id<1> groupD =
dev.get_info<sycl::ext::oneapi::experimental::info::device::
max_work_groups<1>>();
std::cout << "Max work group size in 1D \n";
std::cout << "Dimension 1:" << groupD[0] << std::endl;

sycl::id<2> group2D =
dev.get_info<sycl::ext::oneapi::experimental::info::device::
max_work_groups<2>>();
std::cout << "Max work group size in 2D \n";
std::cout << "Dimension 1:" << group2D[0] << "\n"
<< "Dimension 2:" << group2D[1] << std::endl;

sycl::id<3> group3D =
dev.get_info<sycl::ext::oneapi::experimental::info::device::
max_work_groups<3>>();
std::cout << "Max work group size in 3D \n";
std::cout << "Dimension 1:" << group3D[0] << "\n"
<< "Dimension 2:" << group3D[1] << "\n"
<< "Dimension 3:" << group3D[2] << std::endl;

size_t group_max = dev.get_info<sycl::ext::oneapi::experimental::info::
device::max_global_work_groups>();
std::cout << "Max global work group size:" << group_max << "\n";

assert((group3D[0] <= group_max && group3D[1] <= group_max &&
group3D[2] <= group_max) &&
"Max work-group size of each dimension must be smaller than "
"global work-group size");
#endif

std::cout << std::endl;
}
}
Expand Down
123 changes: 123 additions & 0 deletions SYCL/DeprecatedFeatures/deprecated_intel_ext_device.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: env SYCL_DEVICE_FILTER=level_zero:gpu %t.out
// RUN: env SYCL_DEVICE_FILTER=opencl:gpu %t.out
//
// REQUIRES: gpu
// UNSUPPORTED: cuda
// UNSUPPORTED: hip
// Temporarily disable on L0 due to fails in CI
// UNSUPPORTED: level_zero

//==--------- intel-ext-device.cpp - SYCL device test ------------==//
//
// Returns the low-level device details. These are Intel-specific extensions
// that are only supported on Level Zero.
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include <sycl/sycl.hpp>

#include <cassert>
#include <iostream>

using namespace sycl;

#ifdef _WIN32
#define setenv(name, value, overwrite) _putenv_s(name, value)
#endif

int main(int argc, char **argv) {
// Must be enabled at the beginning of the application
// to obtain the PCI address
setenv("SYCL_ENABLE_PCI", "1", 0);

int pltCount = 1;
for (const auto &plt : platform::get_platforms()) {
if (!plt.has(aspect::host)) {
int devCount = 1;
int totalEUs = 0;
int numSlices = 0;
int numSubslices = 0;
int numEUsPerSubslice = 0;
int numHWThreadsPerEU = 0;
for (const auto &dev : plt.get_devices()) {
std::cout << "Platform #" << pltCount++ << ":" << std::endl;
if (dev.has(aspect::gpu)) {
auto name = dev.get_info<info::device::name>();
std::cout << "Device #" << devCount++ << ": "
<< dev.get_info<info::device::name>() << ":" << std::endl;

std::cout << "Backend: ";
if (plt.get_backend() == backend::ext_oneapi_level_zero) {
std::cout << "Level Zero" << std::endl;
} else if (plt.get_backend() == backend::opencl) {
std::cout << "OpenCL" << std::endl;
} else if (plt.get_backend() == backend::ext_oneapi_cuda) {
std::cout << "CUDA" << std::endl;
} else {
std::cout << "Unknown" << std::endl;
}

// Use Feature Test macro to see if extensions are supported.
if (SYCL_EXT_INTEL_DEVICE_INFO >= 1) {

if (dev.has(aspect::ext_intel_pci_address)) {
std::cout << "PCI address = "
<< dev.get_info<info::device::ext_intel_pci_address>()
<< std::endl;
}
if (dev.has(aspect::ext_intel_gpu_eu_count)) {
totalEUs = dev.get_info<info::device::ext_intel_gpu_eu_count>();
std::cout << "Number of EUs = " << totalEUs << std::endl;
}
if (dev.has(aspect::ext_intel_gpu_eu_simd_width)) {
int w = dev.get_info<info::device::ext_intel_gpu_eu_simd_width>();
std::cout << "EU SIMD width = " << w << std::endl;
}
if (dev.has(aspect::ext_intel_gpu_slices)) {
numSlices = dev.get_info<info::device::ext_intel_gpu_slices>();
std::cout << "Number of slices = " << numSlices << std::endl;
}
if (dev.has(aspect::ext_intel_gpu_subslices_per_slice)) {
numSubslices = dev.get_info<
info::device::ext_intel_gpu_subslices_per_slice>();
std::cout << "Number of subslices per slice = " << numSubslices
<< std::endl;
}
if (dev.has(aspect::ext_intel_gpu_eu_count_per_subslice)) {
numEUsPerSubslice = dev.get_info<
info::device::ext_intel_gpu_eu_count_per_subslice>();
std::cout << "Number of EUs per subslice = " << numEUsPerSubslice
<< std::endl;
}
if (dev.has(aspect::ext_intel_gpu_hw_threads_per_eu)) {
numHWThreadsPerEU =
dev.get_info<info::device::ext_intel_gpu_hw_threads_per_eu>();
std::cout << "Number of HW threads per EU = " << numHWThreadsPerEU
<< std::endl;
}
if (dev.has(aspect::ext_intel_max_mem_bandwidth)) {
// not supported yet
long m =
dev.get_info<info::device::ext_intel_max_mem_bandwidth>();
std::cout << "Maximum memory bandwidth = " << m << std::endl;
}
// This is the only data we can verify.
if (totalEUs != numSlices * numSubslices * numEUsPerSubslice) {
std::cout << "Error: EU Count is incorrect!" << std::endl;
std::cout << "Failed!" << std::endl;
return 1;
}
} // SYCL_EXT_INTEL_DEVICE_INFO
}
std::cout << std::endl;
}
}
}
std::cout << "Passed!" << std::endl;
return 0;
}
3 changes: 2 additions & 1 deletion SYCL/ESIMD/PrefixSum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ int main(int argc, char *argv[]) {
property::queue::in_order());

auto dev = q.get_device();
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
<< "\n";
auto ctxt = q.get_context();

// allocate and initialized input
Expand Down
3 changes: 2 additions & 1 deletion SYCL/ESIMD/Prefix_Local_sum1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ int main(int argc, char *argv[]) {
property::queue::enable_profiling{});

auto dev = q.get_device();
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
<< "\n";

// allocate and initialized input
unsigned int *pInputs = static_cast<unsigned int *>(
Expand Down
3 changes: 2 additions & 1 deletion SYCL/ESIMD/Prefix_Local_sum2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ int main(int argc, char *argv[]) {
property::queue::enable_profiling{});

auto dev = q.get_device();
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
<< "\n";

// allocate and initialized input
unsigned int *pInputs = static_cast<unsigned int *>(
Expand Down
3 changes: 2 additions & 1 deletion SYCL/ESIMD/Prefix_Local_sum3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ int main(int argc, char *argv[]) {
property::queue::enable_profiling{});

auto dev = q.get_device();
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
<< "\n";

// allocate and initialized input data
unsigned int *pInputs = static_cast<unsigned int *>(
Expand Down
3 changes: 2 additions & 1 deletion SYCL/ESIMD/acc_gather_scatter_rgba.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ int main(void) {
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());

auto dev = q.get_device();
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
<< "\n";

bool passed = true;
passed &= test<int, 16, 1>(q);
Expand Down
3 changes: 2 additions & 1 deletion SYCL/ESIMD/api/ballot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ template <class T> bool test(queue &Q) {
int main(void) {
queue Q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
auto Dev = Q.get_device();
std::cout << "Running on " << Dev.get_info<info::device::name>() << "\n";
std::cout << "Running on " << Dev.get_info<sycl::info::device::name>()
<< "\n";

bool Pass = true;
Pass &= test<ushort>(Q);
Expand Down
3 changes: 2 additions & 1 deletion SYCL/ESIMD/api/bin_and_cmp_ops_heavy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ int main(void) {
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());

auto dev = q.get_device();
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
<< "\n";
bool passed = true;
using BinOp = esimd_test::BinaryOp;

Expand Down
3 changes: 2 additions & 1 deletion SYCL/ESIMD/api/esimd_bit_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ template <typename T, int N, int Op> bool test(queue q) {
int main(int argc, char **argv) {
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
auto dev = q.get_device();
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
<< "\n";

bool passed = true;
passed &= test<char, 32, bit_op::cbit>(q);
Expand Down
3 changes: 2 additions & 1 deletion SYCL/ESIMD/api/esimd_merge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ int main(void) {
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());

auto dev = q.get_device();
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
<< "\n";

int *A = malloc_shared<int>(Size, q);
int *B = malloc_shared<int>(Size, q);
Expand Down
3 changes: 2 additions & 1 deletion SYCL/ESIMD/api/esimd_pack_unpack_mask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ template <int N> bool test(queue q) {
int main(int argc, char **argv) {
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
auto dev = q.get_device();
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
<< "\n";

bool passed = true;
passed &= test<1>(q);
Expand Down
2 changes: 1 addition & 1 deletion SYCL/ESIMD/api/esimd_rgba_smoke.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ int main(void) {
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());

auto dev = q.get_device();
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
std::cout << "Running on " << dev.get_info<sycl::info::device::name>() << "\n";
bool passed = true;
// Only these four masks are supported for rgba write operations:
passed &= test<rgba_channel_mask::ABGR>(q);
Expand Down
3 changes: 2 additions & 1 deletion SYCL/ESIMD/api/replicate_smoke.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ template <class T> bool test(queue q) {
int main(int argc, char **argv) {
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
auto dev = q.get_device();
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
<< "\n";
bool passed = true;

passed &= test<half>(q);
Expand Down
3 changes: 2 additions & 1 deletion SYCL/ESIMD/api/saturation_smoke.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ template <class From, class To> struct FpToFp : public DataMgr<From, To, 5> {
int main(int argc, char **argv) {
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
auto dev = q.get_device();
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
<< "\n";

bool passed = true;
passed &= test<half, int, FpToInt>(q);
Expand Down
3 changes: 2 additions & 1 deletion SYCL/ESIMD/api/simd_any_all.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ template <class T1, class T2> bool test(queue q) {
int main(int argc, char **argv) {
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
auto dev = q.get_device();
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
<< "\n";

bool passed = true;
passed &= test<int8_t, uint8_t>(q);
Expand Down
3 changes: 2 additions & 1 deletion SYCL/ESIMD/api/simd_binop_integer_promotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ int main(int argc, char **argv) {
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());

auto dev = q.get_device();
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
<< "\n";

bool passed = true;
passed &= test<unsigned short>(q);
Expand Down
Loading