Skip to content

Commit ef4c150

Browse files
committed
fix(hash): include tensor data pointer in InfiniOP cache keys
Narrowed views can share shape/strides; hashing the resolved base address avoids plan-cache collisions across different storage offsets. Made-with: Cursor
1 parent c89b00f commit ef4c150

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

include/infinicore/common/hash.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "../tensor.hpp"
44

5+
#include <cstdint>
56
#include <optional>
67
#include <type_traits>
78

@@ -28,6 +29,9 @@ inline void hash_combine(size_t &seed, Tensor tensor) {
2829
for (Stride stride : tensor->strides()) {
2930
hash_combine(seed, static_cast<size_t>(stride));
3031
}
32+
// Storage offset is not part of shape/strides but must differ across `narrow` views that share
33+
// the same meta; include the resolved base pointer for InfiniOP / graph plan cache keys.
34+
hash_combine(seed, static_cast<size_t>(reinterpret_cast<uintptr_t>(tensor->data())));
3135
}
3236

3337
// Specialization for optional

0 commit comments

Comments
 (0)