首页 > 解决方案 > sycl::info::event_profiling 中的 command_submit 提交整个代码还是仅提交并行?

问题描述

我尝试分析我的功能在设备上的执行时间。我读了这个链接: https : //docs.oneapi.com/versions/latest/dpcpp/iface/event.html 但我没有在文档中找到任何关于 sycl::info::event_profiling 的信息,这让我理解它们完全对应的是什么。我的意思是,command_start、command_end、command_submit。例如:这是我的代码的一部分,内核,

auto event = gpuQueue.submit([&](sycl::handler &h) {
                //local copy of fun
                auto f = fun;
                sycl::accessor in_accessor(in_buffer, h, sycl::read_only);
                sycl::accessor out_accessor(out_buffer, h, sycl::write_only);
                h.parallel_for(n_item, [=](sycl::id<1> index) {
                    out_accessor[index] = f(in_accessor[index]);
                });
            });
            event.wait();
            auto end_overall = std::chrono::system_clock::now();
            cl_ulong submit_time = event.template get_profiling_info<
                    cl::sycl::info::event_profiling::command_submit>();
            cl_ulong start_time = event.template get_profiling_info<
                    cl::sycl::info::event_profiling::command_start>();
            cl_ulong end_time = event.template get_profiling_info<
                    cl::sycl::info::event_profiling::command_end>();

我想了解 cl::sycl::info::event_profiling::command_submit,提交整个代码还是只提交并行?

标签: profilingsyclintel-oneapidpc++

解决方案


SYCL 2020 规范更清楚一点:

  • command_submit是命令组提交到 SYCL 运行时的时间戳。
  • command_start是实际并行开始的时间戳
  • command_end是完成并行的时间戳

因此,您在设备中的内核执行时间是command_start- command_end,而命令组的总处理时间(即潜在的副本、运行时开销等)是command_submit- command_end


推荐阅读