meta_kernel::compile is very slow, even for cached source
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- cpp
- 领域
- performance
调研方向
首先对 meta_kernel::compile 及其报告的对 clCreateKernel、sha1 和 program::build_with_source 的调用进行性能分析;该 issue 没有指明源文件或测试。确定已缓存的程序为何仍会重复创建 kernel 和进行哈希,然后对这条缓存路径进行基准测试,以确认开销显著降低,同时不丢失现有的构建缓存。
由索引模型根据 Issue 内容生成。
描述
Hi,
I am currently benchmarking the overhead of boost::compute. My test-program is computing nothing big and the equivalent cpu program finishes in no measurable runtime. The OpenCL version takes several seconds, so i decided to check with valgrind-callgrind where this time is lost. My program utilizes 11 different kernels and the runtime is the Intel OpenCL cpu implementation. I am using callgrind with O1 optimizations.
71% of total run-time is spent in 8149 calls to meta_kernel::compile.
Inside, we have over all 8149 calls:
total-runtime% function
43.21% clCreateKernel
14.5% compute::detail::sha1::sha1
8.7% program::build_with_source
As a sanity check:
1.6% meta_kernel::source
1.2% clEnqueueNDRangeKernel
so, roughly 58% of total running time is spent on figuring out whether the program is already build and creating the kernel afterwards. Compiling and caching works fine, we have exactly 11 calls to build_with_source.
The problem is that compute assumes that kernels are throw-away objects. This is unfortunately not the case. e.g. on NVIDIA, clCreateKernel is reported to have an overhead of roughly 1ms. My runtime seems to be in the same order. The programs built with meta_kernel have only one kernel function, so one easy workaround would be to cache the kernel together with the program.
Also, sha1 is terribly slow. The hash function should not take an order of magnitude longer than creating the source in the first place.
- 主要语言
- C++
- 星标
- 1.7k
- 派生
- 340
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
boostorg/compute 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 65/100
-
constant_iterator and counting_iterator dereference attempts to bind a const object to a reference未关闭
难度 3/5 1-2 天 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 2/5 1-3 小时 新手友好度 45/100
-
难度 4/5 3-5 天 新手友好度 20/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
uxlfoundation/oneDNN#6604 · 1 条评论 ·
维护者通常 2 天内回复
-
[Bug]: RoundToNearest truncates in plugins compiled with spcomp 1.13可能已有人在做 @fmu1337 今天认领。 未关闭Bug
难度 2/5 1-3 小时 新手友好度 62/100
alliedmodders/sourcemod#2627 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
lballabio/QuantLib#3134 · 1 条评论 ·
维护者通常 3 天内回复
-
new issue
难度 2/5 1-3 小时 新手友好度 62/100
llvm/llvm-project#245835 ·
维护者通常 1 天内回复
-
documentation
难度 1/5 1 小时以内 新手友好度 72/100
EchoTools/nevr-runtime#2823 ·
维护者通常 1 天内回复