fix: Refactor IndexingBackwardKernel to accelerate#1
Closed
hushenwei2000 wants to merge 1 commit intodevelopfrom
Closed
fix: Refactor IndexingBackwardKernel to accelerate#1hushenwei2000 wants to merge 1 commit intodevelopfrom
hushenwei2000 wants to merge 1 commit intodevelopfrom
Conversation
Owner
Author
|
/re-run all-failed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Operator Mechanism
PR Types
Improvements
Description
perf(gpu): 优化索引反向核的累加逻辑以减少全局内存访问
accumulate参数从函数参数移至模板参数,允许编译器优化旧代码(N 个重复 index,对同一个 feature 元素):
新代码:
按类型分析:
结论:
旧代码每次迭代将中间和截断回 float16(10 bit 尾数),N 次累加产生 N 次舍入误差:
新代码全程在 float32(23 bit 尾数)中累加,只在最终写回时截断一次为 float16。
新代码的精度严格 >= 旧代码。对 float/double/int 类型结果完全一致;对 float16/bfloat16 类型精度更好(减少了中间舍入误差)。不存在精度下降的风险。
是否引起精度变化
是