Code Generation Options#

The following table lists command line options to customize how your code is migrated.

Option

Description

--always-use-async-handler

Use async exception handler when creating new sycl::queue with dpct::create_queue in addition to default dpct::get_default_queue. Default: off.

--assume-nd-range-dim=<value>

Provide a hint to the tool on the dimensionality of nd_range to use in generated code. The values are:

  • =1: Generate kernel code assuming 1D nd_range where possible, and 3D in other cases.

  • =3: Generate kernel code assuming 3D nd_range (default).

--change-cuda-files-extension-only

Limit extension change to .cu and .cuh files only. Default: off.

--check-unicode-security

Enable detection and warnings about Unicode constructs that can be exploited by using bi-directional formatting codes and homoglyphs in identifiers. Default: off.

--comments

Insert comments explaining the generated code. Default: off.

--enable-ctad

Use a C++17 class template argument deduction (CTAD) in your generated code.

--enable-profiling

Enable SYCL* queue profiling in helper functions. Default: auto (when set to auto, the enable-profiling option will only be used if the tool deduces that profiling is required during migration).

--gen-helper-function

Generate helper function files in the --out-root directory. Default: off.

--helper-function-preference=<value>

The preference of helper function usage in migration. Value:

  • =no-queue-device: Call SYCL API to get queue and device instead of calling helper function.

--keep-original-code

Keep the original code in the comments of generated SYCL files. Default: off.

--no-dry-pattern

Do not use a Don’t Repeat Yourself (DRY) pattern when functions from the dpct namespace are inserted. Default: off.

--optimize-migration

Generate SYCL code applying more aggressive assumptions that potentially may alter the semantics of your program. Default: off.

--sycl-named-lambda

Generate kernels with the kernel name. Default: off.

--use-explicit-namespace=<value>

Define the namespaces to use explicitly in generated code. The value is a comma-separated list. Default: dpct/syclcompat, sycl.

Possible values are:

  • =dpct: Generate code with dpct:: namespace.

  • =syclcompat: Generate code with syclcompat:: namespace.

  • =none: Generate code without any namespaces. Cannot be used with other values.

  • =sycl: Generate code with sycl:: namespace. Cannot be used with cl or sycl-math values.

  • =sycl-math: Generate code with sycl:: namespace, applied only for SYCL math functions. Cannot be used with cl or sycl values.

--usm-level=<value>

Set the Unified Shared Memory (USM) level to use in source code generation:

  • =none: Uses helper functions from SYCLomatic header files for memory management migration.

  • =restricted: Uses USM API for memory management migration. (default).

--enable-codepin

EXPERIMENTAL: Generate instrumented CUDA and SYCL code for debug and verification purposes in the directory <dir>_codepin_cuda and <dir>_codepin_sycl, where <dir> is specified by --out-root option.