Skip to content

Commit

Permalink
[SYCL][Doc] Clarify error handling in sycl_ext_oneapi_device_architec…
Browse files Browse the repository at this point in the history
…ture extension (#14077)

This patch adds `unknown` field to `architecture` enum and removes error
handling based on throwing exception.
Instead, `architecture::unknown` will be returned.
  • Loading branch information
dm-vodopyanov authored Jun 15, 2024
1 parent 24a6b3b commit f83c969
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ which version of this extension first included each of these enumerators.
|Added in version
|Description

3+^|*Unknown architecture*

a|
[source]
----
unknown
----
|-
|Some architecture which is not one of those listed below.

3+^|*Intel CPU family*

a|
Expand Down Expand Up @@ -1019,7 +1029,8 @@ struct architecture;

_Return type:_ `sycl::ext::oneapi::experimental::architecture`

_Returns:_ The architecture of the device.
_Returns:_ The architecture of the device if architecture is supported, otherwise
`ext::oneapi::experimental::architecture::unknown`.
|====


Expand Down Expand Up @@ -1107,6 +1118,9 @@ They currently exist only for use with the
link:sycl_ext_matrix/sycl_ext_oneapi_matrix.asciidoc[sycl_ext_oneapi_matrix]
extension.

The architecture enumeration `unknown` is not currently supported with the
`if_architecture_is` function.


== Implementation notes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ enum class architecture : uint64_t {
// - DD is 2-digit number reserved for future unexpected modifications
// to keep uniqueness. It should be always 00 for now
//
x86_64 = 0x9900000000000000,
unknown = 0x9900000000000000,
//
// Intel CPU architectures
//
// AA is 03,
// CCCCCCCC is the architecture ID from the DEVICE_IP_VERSION extension of
// underlied backend
// Note: CCCCCCCC for x86_64 consists of all zeros
x86_64 = 0x0300000000000000,
intel_cpu_spr = 0x0300000000000800,
intel_cpu_gnr = 0x0300000000000900,
//
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// REQUIRES: accelerator

// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

// Test checks that device_architecture extension implementation correctly
// handles unsupported HW. The unsupported HW in this test is any FPGA device,
// as FPGA currently is not supported at all by the device_architecture
// extension.

#include <sycl/detail/core.hpp>

int main() {
sycl::queue q;
sycl::device dev = q.get_device();

sycl::ext::oneapi::experimental::architecture arch = dev.get_info<
sycl::ext::oneapi::experimental::info::device::architecture>();

assert(arch == sycl::ext::oneapi::experimental::architecture::unknown);
// device::ext_oneapi_architecture_is(syclex::architecture::unknown) should
// return true if the device does not have a known architecture.
assert(dev.ext_oneapi_architecture_is(arch));

// No exceptions are expected in this test.

return 0;
}

0 comments on commit f83c969

Please sign in to comment.