Skip to content

[SYCL][FE] Attributes from any function are propagated to the kernel contrary to the intent #1811

@kbobrovs

Description

@kbobrovs

// Allow the following kernel attributes only on lambda functions and
:

      // Allow the following kernel attributes only on lambda functions and
      // function objects that are called directly from a kernel (i.e. the one
      // passed to the parallel_for function). For all other cases,
      // emit a warning and ignore.

In fact attributes are propagated from any function called from within a kernel, and are other functions called in some cases.

To see the issue, compile this source
attr-prop.txt
clang++ -fsycl -fsycl-device-only -Xclang -emit-llvm -o - -c attr-prop.cpp
and note the line:
define dso_local spir_kernel void @_ZTSZ11invoke_foo2vE10KernelName() #0 !kernel_arg_addr_space !4 !kernel_arg_access_qual !4 !kernel_arg_type !4 !kernel_arg_base_type !4 !kernel_arg_type_qual !4 !no_global_work_offset !4 {

no_global_work_offset got propagated from unrelated function w/o warning.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions