当前 const manager 中对于重复常量的判断需要做一次d2h(如果在非 cpu 设备上),当 tensor shape 较大时开销较大。@LeoLau94 提议只按 tensor 的 meta hash 进行分桶,桶内通过tensor.equal进行判断去重避免 D2H 拷贝,且 memcmp 性能也更好。 _Originally posted by @LeoLau94 in https://github.com/BD-Seed-HHW/xpu_graph/pull/342#discussion_r2287523929_
当前 const manager 中对于重复常量的判断需要做一次d2h(如果在非 cpu 设备上),当 tensor shape 较大时开销较大。@LeoLau94 提议只按 tensor 的 meta hash 进行分桶,桶内通过tensor.equal进行判断去重避免 D2H 拷贝,且 memcmp 性能也更好。
Originally posted by @LeoLau94 in #342 (comment)