[CINN]optimize global memory read insert pointer #68667
Merged
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
CINN
PR Types
Improvements
Description
pcard-76996
优化对于global memory 读取的处理逻辑
当前多输出的融合,会插入一些if op减少重复的写操作,这个if op 是在schedule block的内部,如下所示
if xxx // split schedule 产生的
scheduleBlock(var_0)
if xxx // 多输出产生的
out[i] = f( in [i])
该pr前
if xxx // split schedule 产生的
scheduleBlock(var_0)
if xxx // 多输出产生的
local_var = in[i]
out[i] = f( local_var )
该pr后
if xxx // split schedule 产生的
scheduleBlock(var_0)
local_var = in[i]
if xxx // 多输出产生的
out[i] = f( local_var )
本pr 对insert逻辑进行调整,把插入的语句,放到scheduleBlock的最上层Block中,(假如scheduleBlock内部没有if op,行为和之前一致) 该修复是一个临时修复,合理的方案是在EliminateCommonGlobalMemoryRead 中对所有的输入, 并分析输入if条件,并且期望load的操作和计算逻辑分析,但是工作量较大,会在后续的优化中完成