@@ -29,11 +29,11 @@ concept SymComputerConcept = ComputerBaseConcept<Computer> && requires(Computer
2929
3030template <StorageConcept Storage>
3131struct Computer {
32- const Storage &tensor ;
32+ const Storage &storage ;
3333
34- explicit Computer (const Tensor &tensor ) : tensor(tensor ) {}
34+ explicit Computer (const Storage &storage ) : storage(storage ) {}
3535
36- void prefetch (int32_t u, int32_t lines) const { tensor .prefetch (u, lines); }
36+ void prefetch (int32_t u, int32_t lines) const { storage .prefetch (u, lines); }
3737};
3838
3939struct MemCpyTag {};
@@ -51,12 +51,12 @@ struct ComputerImpl : Computer<Storage> {
5151 mutable int64_t dist_cmps_{};
5252 mutable int64_t mem_read_bytes_{};
5353
54- ComputerImpl (const Storage &tensor , const S *query, const auto &encoder, Args &&...args)
55- : Computer<Storage>(tensor ), args(std::forward<Args>(args)...) {
54+ ComputerImpl (const Storage &storage , const S *query, const auto &encoder, Args &&...args)
55+ : Computer<Storage>(storage ), args(std::forward<Args>(args)...) {
5656 if constexpr (std::is_same_v<std::decay_t <decltype (encoder)>, MemCpyTag>) {
5757 static_assert (std::is_same_v<S, X>);
58- q = (X *)align_alloc (this ->tensor .dim_align () * sizeof (X));
59- memcpy (q, query, this ->tensor .dim () * sizeof (X));
58+ q = (X *)align_alloc (this ->storage .dim_align () * sizeof (X));
59+ memcpy (q, query, this ->storage .dim () * sizeof (X));
6060 } else {
6161 encoder ((const S *)query, q);
6262 }
@@ -66,11 +66,10 @@ struct ComputerImpl : Computer<Storage> {
6666
6767 GLASS_INLINE dist_type operator ()(const Y *p) const {
6868 dist_cmps_++;
69- mem_read_bytes_ += this ->tensor .code_size ();
70- return std::apply ([&](auto &&...args ) { return dist_func (q, p, this ->tensor .dim_align (), args...); }, args);
69+ return std::apply ([&](auto &&...args ) { return dist_func (q, p, this ->storage .dim_align (), args...); }, args);
7170 }
7271
73- GLASS_INLINE dist_type operator ()(int32_t u) const { return operator ()((const Y *)this ->tensor .get (u)); }
72+ GLASS_INLINE dist_type operator ()(int32_t u) const { return operator ()((const Y *)this ->storage .get (u)); }
7473
7574 GLASS_INLINE size_t dist_cmps () const { return dist_cmps_; }
7675
@@ -86,15 +85,15 @@ struct SymComputerImpl : Computer<Storage> {
8685
8786 std::tuple<Args...> args;
8887
89- SymComputerImpl (const Storage &tensor , Args &&...args)
90- : Computer<Storage>(tensor ), args(std::forward<Args>(args)...) {}
88+ SymComputerImpl (const Storage &storage , Args &&...args)
89+ : Computer<Storage>(storage ), args(std::forward<Args>(args)...) {}
9190
9291 GLASS_INLINE dist_type operator ()(const X *x, const X *y) const {
93- return std::apply ([&](auto &&...args ) { return dist_func (x, y, this ->tensor .dim_align (), args...); }, args);
92+ return std::apply ([&](auto &&...args ) { return dist_func (x, y, this ->storage .dim_align (), args...); }, args);
9493 }
9594
9695 GLASS_INLINE dist_type operator ()(int32_t u, int32_t v) const {
97- return operator ()((const X *)this ->tensor .get (u), (const X *)this ->tensor .get (v));
96+ return operator ()((const X *)this ->storage .get (u), (const X *)this ->storage .get (v));
9897 }
9998};
10099
0 commit comments