Skip to content

Commit c225169

Browse files
authored
[SYCLomatic][DOC] 2025.1 Options & Warnings (#2697)
1 parent c221043 commit c225169

7 files changed

Lines changed: 297 additions & 56 deletions

File tree

docs/_include_files/options_def.rst

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ to be migrated. Default: the value of ``--in-root``.
2727

2828

2929

30-
31-
3230
.. _opt-assume-nd-range-dim:
3331

3432
``--assume-nd-range-dim=<value>``
@@ -587,7 +585,8 @@ Specify the type of migration report. Values are:
587585

588586
.. _desc-rule-file:
589587

590-
Specify the rule file path that contains rules used for migration.
588+
Specify the rule file for migration. Also, reference the predefined rules in the
589+
``extensions`` directory in the root folder of the tool.
591590

592591
.. _end-rule-file:
593592

@@ -612,7 +611,7 @@ Stop migration and generation of reports if parsing errors happened. Default: ``
612611
.. _desc-suppress-warnings:
613612

614613
A comma-separated list of migration warnings to suppress. Valid warning IDs
615-
range from 1000 to 1132. Hyphen-separated ranges are also allowed. For
614+
range from 1000 to 1136. Hyphen-separated ranges are also allowed. For
616615
example: ``-suppress-warnings=1000-1010,1011``.
617616

618617
.. _end-suppress-warnings:
@@ -676,8 +675,10 @@ By default, experimental features will not be used in migrated code.
676675

677676
The values are:
678677

679-
- ``=bfloat16_math_functions``: Experimental extension that allows use of bfloat16 math functions. `See more details <https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_oneapi_bfloat16_math_functions.asciidoc>`__.
680-
- ``=bindless_images``: Experimental extension that allows use of bindless images APIs. `See more details <https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_oneapi_bindless_images.asciidoc>`__.
678+
- ``=bfloat16_math_functions``: Experimental extension that allows use of bfloat16 math
679+
functions. `See more details <https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_oneapi_bfloat16_math_functions.asciidoc>`__.
680+
- ``=bindless_images``: Experimental extension that allows use of bindless images APIs.
681+
`See more details <https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_oneapi_bindless_images.asciidoc>`__.
681682
- ``=dpl-experimental-api``: Experimental extension that allows use of experimental
682683
oneDPL APIs. `See more details <https://github.com/oneapi-src/oneDPL/tree/main/include/oneapi/dpl/pstl/experimental>`__.
683684
- ``=free-function-queries``: Experimental extension that allows getting
@@ -689,16 +690,29 @@ The values are:
689690
group work-items. See more details in ``dpct::experimental::logical_group`` in header file ``util.hpp``.
690691
- ``=masked-sub-group-operation``: Experimental helper function used to execute
691692
sub-group operation with mask. See more details in ``dpct::experimental::select_from_sub_group``, ``dpct::experimental::shift_sub_group_left``, ``dpct::experimental::shift_sub_group_right`` and ``dpct::experimental::shift_sub_group_right`` in header file ``util.hpp``.
692-
- ``=matrix``: Experimental extension that allows use of matrix extension like class ``joint_matrix``. `See more details <https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_matrix/sycl_ext_oneapi_matrix.asciidoc>`__.
693-
- ``=nd_range_barrier``: DEPRECATED. Experimental helper function used to help cross-group synchronization during migration. Please use the following option instead: ``--use-experimental-features=root-group``
693+
- ``=matrix``: Experimental extension that allows use of matrix extension like class
694+
``joint_matrix``. `See more details <https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_matrix/sycl_ext_oneapi_matrix.asciidoc>`__.
695+
- ``=nd_range_barrier``: DEPRECATED. Experimental helper function used to help cross-group
696+
synchronization during migration. Please use the following option instead: ``--use-experimental-features=root-group``
694697
- ``=root-group``: Experimental extension that allows use of root group class and relative API.
695698
- ``=graph``: Experimental extension that allows use of SYCL Graph APIs.
696-
- ``=occupancy-calculation``: Experimental helper function used to calculate occupancy. See more details in ``dpct::experimental::calculate_max_active_wg_per_xecore`` and ``dpct::experimental::calculate_max_potential_wg`` in header file ``util.hpp``.
699+
- ``=occupancy-calculation``: Experimental helper function used to calculate occupancy. See more
700+
details in ``dpct::experimental::calculate_max_active_wg_per_xecore`` and ``dpct::experimental::calculate_max_potential_wg`` in header file ``util.hpp``.
697701
- ``=user-defined-reductions``: Experimental extension that allows user-defined
698702
reductions. `See more details <https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_oneapi_user_defined_reductions.asciidoc>`__.
699-
- ``=non-uniform-groups``: Experimental extension that allows use of non-uniform groups. `See more details <https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_oneapi_non_uniform_groups.asciidoc>`__.
700-
- ``=device_global``: Experimental extension that allows device scoped memory allocations into SYCL that can
703+
- ``=non-uniform-groups``: Experimental extension that allows use of non-uniform groups.
704+
`See more details <https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_oneapi_non_uniform_groups.asciidoc>`__.
705+
- ``=device_global``: Experimental extension that allows device scoped memory allocations into
706+
SYCL that can
701707
be accessed within a kernel using syntax similar to C++ global variables. `See more details <https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_oneapi_device_global.asciidoc>`__.
708+
- ``=virtual_mem``: Experimental extension that allows for mapping of an address range
709+
onto multiple allocations of physical memory.
710+
- ``=in_order_queue_events``: Experimental extension that allows getting the event from
711+
the last command submission into the queue and setting an external event as an implicit
712+
dependence on the next command submitted to the queue.
713+
- ``=non-standard-sycl-builtins``: Experimental extension that allows use of non standard
714+
SYCL builtin functions.
715+
- ``=prefetch``: Experimental extension that allows use of SYCL prefetch APIs.
702716
- ``=all``: Enable all experimental extensions listed in this option.
703717

704718
.. _end-use-experimental-features:
@@ -882,6 +896,7 @@ Intercept build tool to generate a compilation database.
882896
EXPERIMENTAL: Migrate build script(s).
883897

884898
- ``=CMake``: Migrate the CMake file(s).
899+
- ``=Python``: Migrate the Python build script file(s) of PyTorch based project.
885900

886901
.. _end-migrate-build-script:
887902

docs/dev_guide/reference/diagnostic_ref/dpct1009.rst

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ Message
88

99
.. _msg-1009-start:
1010

11-
SYCL uses exceptions to report errors and does not use the error codes. The
12-
original code was commented out and a warning string was inserted. You need to
13-
rewrite this code.
11+
SYCL reports errors using exceptions and does not use error codes. Please replace the
12+
\"get_error_string_dummy(...)\" with a real error-handling function.
1413

1514
.. _msg-1009-end:
1615

@@ -46,29 +45,34 @@ results in the following migrated SYCL code:
4645
.. code-block:: cpp
4746
:linenos:
4847
49-
void foo() {
48+
void foo() try {
5049
float *f;
51-
int err = (f = (float *)sycl::malloc_device(4, dpct::get_default_queue()), 0);
50+
dpct::err0 err = DPCT_CHECK_ERROR(
51+
f = (float *)sycl::malloc_device(4, dpct::get_in_order_queue()));
5252
/*
5353
DPCT1009:1: SYCL uses exceptions to report errors and does not use the error
5454
codes. The original code was commented out and a warning string was inserted.
5555
You need to rewrite this code.
5656
*/
57-
printf("%s\n",
58-
"cudaGetErrorString is not supported" /*cudaGetErrorString(err)*/);
57+
printf("%s\n", dpct::get_error_string_dummy(err));
58+
}
59+
catch (sycl::exception const &exc) {
60+
std::cerr <<exc.what() << "Exception caught at file." << __FILE__
61+
<< ", line:" << __LINE__ << std:endl;
62+
std::exit(1);
5963
}
6064
6165
.. _example_dpct_end:
6266

63-
which is rewritten to:
67+
which needs to be rewritten to:
6468

6569
.. code-block:: cpp
6670
:linenos:
6771
6872
void foo() {
6973
float *f;
7074
try {
71-
f = (float *)sycl::malloc_device(4, dpct::get_default_queue())
75+
f = (float *)sycl::malloc_device(4, dpct::get_in_order_queue())
7276
} catch (sycl::exception const &e) {
7377
std::cerr << e.what() << std::endl;
7478
}

docs/dev_guide/reference/diagnostic_ref/dpct1010.rst

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ Message
88

99
.. _msg-1010-start:
1010

11-
SYCL uses exceptions to report errors and does not use the error codes. The call
12-
was replaced with 0. You need to rewrite this code.
11+
SYCL uses exceptions to report errors and does not
12+
use the error codes. The <function name> function
13+
call was replaced with 0. You need to rewrite this
14+
code.
1315

1416
.. _msg-1010-end:
1517

1618
Detailed Help
1719
-------------
1820

19-
SYCL\* uses exceptions to report errors and does not use error codes. The original
20-
code tries to get an error code, while SYCL does not require such functionality.
21-
The call was replaced with 0.
21+
SYCL\* does not support launching kernel in device
22+
code. The user needs to merge the parent kernel and
23+
child kernel together.
2224

2325
Suggestions to Fix
2426
------------------
2527

26-
You may need to rewrite this code.
27-
2828
For example, this original CUDA\* code:
2929

3030
.. code-block:: cpp
@@ -51,21 +51,23 @@ results in the following migrated SYCL code:
5151
}
5252
5353
void foo() {
54-
dpct::get_default_queue().parallel_for(
54+
dpct::get_in_order_queue().parallel_for(
5555
sycl::nd_range<3>(sycl::range<3>(1, 1, 1), sycl::range<3>(1, 1, 1)),
5656
[=](sycl::nd_item<3> item_ct1) {
5757
kernel();
5858
});
5959
dpct::get_current_device().queues_wait_and_throw();
6060
/*
61-
DPCT1010:0: SYCL uses exceptions to report errors and does not use the error
62-
codes. The call was replaced with 0. You need to rewrite this code.
61+
DPCT1010:0: SYCL uses exceptions to report
62+
errors and does not use the error
63+
codes. The cudaGetLastError function call was
64+
replaced with 0. You need to rewrite this code.
6365
*/
64-
int err = 0;
66+
dpct::err0 err = 0;
6567
printf("%d\n", err);
6668
}
6769
68-
which is rewritten to:
70+
which needs to be rewritten to:
6971

7072
.. code-block:: cpp
7173
:linenos:
@@ -76,7 +78,7 @@ which is rewritten to:
7678
7779
void foo() {
7880
try {
79-
dpct::get_default_queue().parallel_for(
81+
dpct::get_in_order_queue().parallel_for(
8082
sycl::nd_range<3>(sycl::range<3>(1, 1, 1), sycl::range<3>(1, 1, 1)),
8183
[=](sycl::nd_item<3> item_ct1) {
8284
kernel();
@@ -86,3 +88,4 @@ which is rewritten to:
8688
std::cerr << e.what() << std::endl;
8789
}
8890
}
91+

docs/dev_guide/reference/diagnostic_ref/dpct1014.rst

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,28 @@ Message
88

99
.. _msg-1014-start:
1010

11-
The flag and priority options are not supported for SYCL queues. The output
11+
The flag and priority options are not supported
12+
for SYCL queues. The output
1213
parameter(s) are set to 0.
1314

15+
Or
16+
17+
The <CUDA event property name> is not supported
18+
for SYCL event. The output parameter(s) is set to
19+
0.
20+
1421
.. _msg-1014-end:
1522

1623
Detailed Help
1724
-------------
1825

19-
The flag and priority options are not supported in the SYCL\* queue. You may need
26+
The flag, priority options, or CUDA event property
27+
is not supported in the SYCL* queue. You may need
2028
to rewrite the generated code.
2129

22-
2330
Suggestions to Fix
2431
------------------
2532

26-
Review the logic and adjust it.
27-
2833
For example, this original CUDA\* code:
2934

3035
.. code-block:: cpp
@@ -35,13 +40,19 @@ For example, this original CUDA\* code:
3540
cudaStreamGetFlags(old_stream, &flag);
3641
cudaStreamCreateWithFlags(new_stream, flag);
3742
}
43+
unsigned bar(bool f) {
44+
unsigned flags = CU_EVENT_DISABLE_TIMING;
45+
if (f)
46+
flags |= CU_EVENT_BLOCKING_SYNC;
47+
return flags;
48+
}
3849
3950
results in the following migrated SYCL code:
4051

4152
.. code-block:: cpp
4253
:linenos:
4354
44-
void foo(sycl::queue *old_stream, sycl::queue **new_stream) {
55+
void foo(dpct::queue_ptr old_stream, dpct::queue_ptr *new_stream) {
4556
unsigned int flag;
4657
/*
4758
DPCT1014:0: The flag and priority options are not supported for SYCL queues.
@@ -53,13 +64,32 @@ results in the following migrated SYCL code:
5364
*/
5465
*(new_stream) = dpct::get_current_device().create_queue();
5566
}
56-
57-
which is rewritten to:
67+
unsigned bar(bool f) {
68+
/*
69+
DPCT1014:2: The CU_EVENT_DISABLE_TIMING is
70+
not supported for SYCL event. The
71+
output parameter(s) is set to 0.
72+
*/
73+
unsigned flags = 0;
74+
if (f)
75+
/*
76+
DPCT1014:3: The CU_EVENT_BLOCKING_SYNC is
77+
not supported for SYCL event. The
78+
output parameter(s) is set to 0.
79+
*/
80+
flags |= 0;
81+
} return flags;
82+
83+
which needs to be rewritten to:
5884

5985
.. code-block:: cpp
6086
:linenos:
6187
62-
void foo(sycl::queue *old_stream, sycl::queue **new_stream) {
88+
void foo(dpct::queue_ptr old_stream, dpct::queue_ptr *new_stream) {
6389
*(new_stream) = dpct::get_current_device().create_queue();
6490
}
6591
92+
unsigned bar(bool f){
93+
return 0;
94+
}
95+

docs/dev_guide/reference/diagnostic_ref/dpct1083.rst

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,24 @@ Message
88

99
.. _msg-1083-start:
1010

11-
The size of *<placeholder>* in the migrated code may be different
11+
The size of local memory in the migrated code may be different
1212
from the original code. Check that the allocated memory size in the migrated code
1313
is correct.
1414

15+
Or
16+
17+
The size of <type name> in the migrated code may be different from the original code. You may need to adjust the code.
18+
1519
.. _msg-1083-end:
1620

1721
Detailed Help
1822
-------------
1923

2024
Some types have a different size in the migrated code than in the original code,
21-
for example ``sycl::float3`` compared to ``float3``. Check if the allocated size
22-
of memory is correct in the migrated code.
25+
for example ``sycl::float3`` compared to ``float3``. Check if the memory size is correct in the migrated code.
2326

24-
In the example below, ``3*sizeof(float)`` is used to represent the size of
25-
``float3`` in the original code. In the migrated code the size of ``sycl::float3``
26-
is different, so the allocated size needs adjustment.
27+
Suggestions to Fix
28+
------------------
2729

2830
For example, this original CUDA\* code:
2931

@@ -40,6 +42,13 @@ For example, this original CUDA\* code:
4042
kernel<<<1, 1, shared_size>>>();
4143
}
4244
45+
void bar(char *data_handle, int width, int height) {
46+
std::vector<uchar3> data;
47+
data.assign(reinterpret_cast<uchar3 *>(data_handle),
48+
reinterpret_cast<uchar3 *>(data_handle) + width * height);
49+
...
50+
}
51+
4352
results in the following migrated SYCL\* code:
4453

4554
.. code-block:: cpp
@@ -64,12 +73,23 @@ results in the following migrated SYCL\* code:
6473
cgh.parallel_for(
6574
sycl::nd_range<3>(sycl::range<3>(1, 1, 1), sycl::range<3>(1, 1, 1)),
6675
[=](sycl::nd_item<3> item_ct1) {
67-
kernel(dpct_local_acc_ct1.get_pointer());
76+
kernel(dpct_local_acc_ct1.get__multi_ptr<sycl::access::decorated::no>()
77+
.get());
6878
});
6979
});
7080
}
7181
72-
which is manually adjusted to:
82+
void bar(char *data_handle, int width, int height) {
83+
std::vector<sycl::uchar3> data;
84+
/*
85+
DPCT1083:1: The size of uchar3 in the migrated code may be different from the original code. You may need to adjust the code.
86+
*/
87+
data.assign (reinterpret_cast<sycl::uchar3 *>(data_handle),
88+
reinterpret_cast<sycl::uchar3 *>(data_handle) + width * height);
89+
...
90+
}
91+
92+
which needs to be rewritten to:
7393

7494
.. code-block:: cpp
7595
:linenos:
@@ -88,13 +108,18 @@ which is manually adjusted to:
88108
cgh.parallel_for(
89109
sycl::nd_range<3>(sycl::range<3>(1, 1, 1), sycl::range<3>(1, 1, 1)),
90110
[=](sycl::nd_item<3> item_ct1) {
91-
kernel(dpct_local_acc_ct1.get_pointer());
111+
kernel(dpct_local_acc_ct1.get_multi_ptr<sycl::access::decorated::no>()
112+
.get());
92113
});
93114
});
94115
}
95-
96-
Suggestions to Fix
97-
------------------
98116
99-
Check the allocated size of memory and replace it with the correct size if
100-
necessary.
117+
void bar(char *data_handle, int width, int height) {
118+
std::vector<sycl::uchar3> data;
119+
for (int Index = 0; Index < width * height; Index++) {
120+
data.emplace_back(data_handle[Index * 3], data_handle[Index * 3 = 1],
121+
data_handle[Index * 3+2]);
122+
}
123+
...
124+
}
125+

0 commit comments

Comments
 (0)