在用Clang++编译一个非常简单的程序时,我会收到在用dpcpp编译器编译时不会出现的警告。我很担心,因为我无法知道这些警告是否意味着我的代码在运行时会以某种方式出现故障。
这个最小的代码会生成一些关于interop_handler被弃用的警告:
#include <CL/sycl.hpp>
int main(){}发出的命令如下所示,其中INCLUDEDIR用于指示SYCL标头的位置:
clang++ -std=c++17 -I$INCLUDEDIR -c t.cpp警告如下:
In file included from t.cpp:1:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl.hpp:16:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/backend.hpp:18:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/backend_traits_opencl.hpp:26:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/queue.hpp:20:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/handler.hpp:14:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/cg.hpp:27:
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/cg_types.hpp:234:32: warning: 'interop_handler' is deprecated: interop_handler class is deprecated, use interop_handle instead with host-task [-Wdeprecated-declarations]
std::function<void(cl::sycl::interop_handler)> MFunc;
^
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/interop_handler.hpp:18:7: note: 'interop_handler' has been explicitly marked deprecated here
class __SYCL_DEPRECATED("interop_handler class is deprecated, use"
^
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/defines_elementary.hpp:45:38: note: expanded from macro '__SYCL_DEPRECATED'
#define __SYCL_DEPRECATED(message) [[deprecated(message)]]
^
In file included from t.cpp:1:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl.hpp:16:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/backend.hpp:18:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/backend_traits_opencl.hpp:26:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/queue.hpp:20:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/handler.hpp:14:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/cg.hpp:27:
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/cg_types.hpp:237:44: warning: 'interop_handler' is deprecated: interop_handler class is deprecated, use interop_handle instead with host-task [-Wdeprecated-declarations]
InteropTask(std::function<void(cl::sycl::interop_handler)> Func)
^
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/interop_handler.hpp:18:7: note: 'interop_handler' has been explicitly marked deprecated here
class __SYCL_DEPRECATED("interop_handler class is deprecated, use"
^
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/defines_elementary.hpp:45:38: note: expanded from macro '__SYCL_DEPRECATED'
#define __SYCL_DEPRECATED(message) [[deprecated(message)]]
^
In file included from t.cpp:1:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl.hpp:16:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/backend.hpp:18:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/backend_traits_opencl.hpp:26:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/queue.hpp:20:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/handler.hpp:14:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/cg.hpp:27:
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/cg_types.hpp:239:23: warning: 'interop_handler' is deprecated: interop_handler class is deprecated, use interop_handle instead with host-task [-Wdeprecated-declarations]
void call(cl::sycl::interop_handler &h) { MFunc(h); }
^
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/interop_handler.hpp:18:7: note: 'interop_handler' has been explicitly marked deprecated here
class __SYCL_DEPRECATED("interop_handler class is deprecated, use"
^
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/defines_elementary.hpp:45:38: note: expanded from macro '__SYCL_DEPRECATED'
#define __SYCL_DEPRECATED(message) [[deprecated(message)]]
^
3 warnings generated.如前所述,这发生在一个最小的例子中;如果使用更复杂的SYCL代码,则会有更多的警告。我想知道我是否应该担心,是否有办法解决这些警告。
发布于 2022-11-28 09:59:22
当您将/ONE_API_2022.3/compiler/2022.2.0/linux/include/复制到本地目录并调用dpcpp时,其中包括复制的
dpcpp -Iinclude/sycl/ -Iinclude -c t.cpp然后,您还会看到许多反对意见的警告。
dpcpp发挥了一些神奇的作用,因此在调用dpcpp时不必手动指定-I。我猜来自这些自动包含的文件的同样的魔法沉默,反对警告。
https://stackoverflow.com/questions/74548572
复制相似问题