From 8c036486b0864399d1b59144d03f390cd7972920 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Fri, 9 Apr 2021 17:26:46 +0300 Subject: [PATCH 1/3] [SYCL] Add OpenCL extension for assert error code Signed-off-by: Sergey Kanaev --- .../cl_intel_assert_return_code.asciidoc | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sycl/doc/extensions/Assert/cl_intel_assert_return_code.asciidoc diff --git a/sycl/doc/extensions/Assert/cl_intel_assert_return_code.asciidoc b/sycl/doc/extensions/Assert/cl_intel_assert_return_code.asciidoc new file mode 100644 index 0000000000000..b7eec45d0a26f --- /dev/null +++ b/sycl/doc/extensions/Assert/cl_intel_assert_return_code.asciidoc @@ -0,0 +1,99 @@ +cl_intel_assert_return_code +====================================== + +// This section needs to be after the document title. +:doctype: book +:toc2: +:toc: left +:encoding: utf-8 +:lang: en + +:blank: pass:[ +] + +// Set the default source code type in this document to C++, +// for syntax highlighting purposes. This is needed because +// docbook uses c++ and html5 uses cpp. +:language: {basebackend@docbook:c++:cpp} + +== Name Strings + ++cl_intel_assert_return_code+ + +== Notice + +Copyright (c) 2021 Intel Corporation. All rights reserved. + +== Status + +Working Draft + +This is a preview extension specification, intended to provide early access to +a feature for review and community feedback. When the feature matures, this +specification may be released as a formal extension. + +Because the interfaces defined by this specification are not final and are +subject to change they are not intended to be used by shipping software +products. + +== Version + +Built On: {docdate} + +Revision: 1 + +== Dependencies + +This extension is written against the OpenCL Specification Version 1.0, Revision 48. + +This extension requires OpenCL 1.0 or later. + +== Overview + +This extension allows OpenCL 1.x and 2.x devices to notify host that assert had +happened. + +== New error code + +[source] +---- +CL_ASSERT_FAILURE +---- + +Negative value of this error code should be set into `param_value` of +`clGetEventInfo` as described in table 5.15 "clGetEventInfo prameter queries" if +assert failure took place in device-code during kernel execution. + +An example: +[source] +---- +cl_event Event; // describes an event of kernel been submitted previously +cl_int Result; +size_t ResultSize; + +clGetEventInfo(Event, CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(Result), &Result, &ResultSize); +---- + +If kernel failed an assertion `clGetEventInfo` should put `CL_ASSERT_FAILURE` in +`Result`. + +== Issues + +None. + +== Revision History + +[cols="5,15,15,70"] +[grid="rows"] +[options="header"] +|======================================== +|Rev|Date|Author|Changes +|1|2021-04-09|Sergey Kanaev|*Initial public working draft* +|======================================== + +//************************************************************************ +//Other formatting suggestions: +// +//* Use *bold* text for host APIs, or [source] syntax highlighting. +//* Use +mono+ text for device APIs, or [source] syntax highlighting. +//* Use +mono+ text for extension names, types, or enum values. +//* Use _italics_ for parameters. +//************************************************************************ From 121c945bbbe2cff52d4766127de3bbddb9df4d68 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Fri, 9 Apr 2021 17:50:17 +0300 Subject: [PATCH 2/3] [SYCL] Add Level-Zero extension for assert error code Signed-off-by: Sergey Kanaev --- .../ze_intel_assert_return_code.asciidoc | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 sycl/doc/extensions/Assert/ze_intel_assert_return_code.asciidoc diff --git a/sycl/doc/extensions/Assert/ze_intel_assert_return_code.asciidoc b/sycl/doc/extensions/Assert/ze_intel_assert_return_code.asciidoc new file mode 100644 index 0000000000000..b56937f9ba0d3 --- /dev/null +++ b/sycl/doc/extensions/Assert/ze_intel_assert_return_code.asciidoc @@ -0,0 +1,124 @@ +ze_intel_assert_return_code +====================================== + +// This section needs to be after the document title. +:doctype: book +:toc2: +:toc: left +:encoding: utf-8 +:lang: en + +:blank: pass:[ +] + +// Set the default source code type in this document to C++, +// for syntax highlighting purposes. This is needed because +// docbook uses c++ and html5 uses cpp. +:language: {basebackend@docbook:c++:cpp} + +== Name Strings + ++ze_intel_assert_return_code+ + +== Notice + +Copyright (c) 2021 Intel Corporation. All rights reserved. + +== Status + +Working Draft + +This is a preview extension specification, intended to provide early access to +a feature for review and community feedback. When the feature matures, this +specification may be released as a formal extension. + +Because the interfaces defined by this specification are not final and are +subject to change they are not intended to be used by shipping software +products. + +== Version + +Built On: {docdate} + +Revision: 1 + +== Dependencies + +This extension is written against the Level-Zero Specification Version 1.1.2. + +== Overview + +This extension allows Level-Zero devices to notify host that assert had +happened. + +== New enumeration value + +`ze_result_t`: + +[source] +---- +ZE_RESULT_ASSERT_FAILED +---- + +This value should be returned by `zeEventQueryStatus` if assert failure took +place in device-code during kernel execution. + +An example: +[source] +---- +ze_event_handle_t Event; // describes an event of kernel been submitted previously +ze_result Result = zeEventQueryStatus(Event); +---- + +If kernel failed an assertion `zeEventQueryStatus` should return +`ZE_RESULT_ASSERT_FAILED`. + + +== Modifications to Level-Zero API + +(Add to Section API Documentation / Core API / Common / Common Enums / `ze_result_t`) :: ++ +-- +`ZE_RESULT_ASSERT_FAILED = 0x70000006` + +[Core] Assert failure took place in device-code during kernel execution. +-- + +(Add to section API Documentation / Core API / Event / Event Functions / `zeEventQueryStatus`) :: ++ +-- +Return: + +`ZE_RESULT_ASSERT_FAILED` +-- + +An example: +[source] +---- +cl_event Event; // describes an event of kernel been submitted previously +cl_int Result; +size_t ResultSize; + +clGetEventInfo(Event, CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(Result), &Result, &ResultSize); +---- + +If kernel failed an assertion `clGetEventInfo` should put `CL_ASSERT_FAILURE` in +`Result`. + +== Issues + +None. + +== Revision History + +[cols="5,15,15,70"] +[grid="rows"] +[options="header"] +|======================================== +|Rev|Date|Author|Changes +|1|2021-04-09|Sergey Kanaev|*Initial public working draft* +|======================================== + +//************************************************************************ +//Other formatting suggestions: +// +//* Use *bold* text for host APIs, or [source] syntax highlighting. +//* Use +mono+ text for device APIs, or [source] syntax highlighting. +//* Use +mono+ text for extension names, types, or enum values. +//* Use _italics_ for parameters. +//************************************************************************ From c06db5f013f337c5ef76d56d5ade53e7287d273e Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Fri, 9 Apr 2021 17:55:16 +0300 Subject: [PATCH 3/3] Remove unwanted part Signed-off-by: Sergey Kanaev --- .../Assert/ze_intel_assert_return_code.asciidoc | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/sycl/doc/extensions/Assert/ze_intel_assert_return_code.asciidoc b/sycl/doc/extensions/Assert/ze_intel_assert_return_code.asciidoc index b56937f9ba0d3..85db891ad5bcf 100644 --- a/sycl/doc/extensions/Assert/ze_intel_assert_return_code.asciidoc +++ b/sycl/doc/extensions/Assert/ze_intel_assert_return_code.asciidoc @@ -87,19 +87,6 @@ Return: + `ZE_RESULT_ASSERT_FAILED` -- -An example: -[source] ----- -cl_event Event; // describes an event of kernel been submitted previously -cl_int Result; -size_t ResultSize; - -clGetEventInfo(Event, CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(Result), &Result, &ResultSize); ----- - -If kernel failed an assertion `clGetEventInfo` should put `CL_ASSERT_FAILURE` in -`Result`. - == Issues None.