| 44 | template <uint32_t NumThreads, uint32_t FetchBytes = 64, |
| 45 | class GEngine, class GLayout> |
| 46 | CUTE_HOST_DEVICE |
| 47 | void |
| 48 | cooperative_prefetch(uint32_t const& tid, |
| 49 | Tensor<GEngine, GLayout> const& src) |
| 50 | { |
| 51 | static_assert(is_gmem<GEngine>::value, "Expected global tensor for prefetch"); |
| 52 | |
| 53 | constexpr int V = decltype(max_common_vector(src, src))::value; |
| 54 | |
| 55 | if constexpr (V > 1) { |
| 56 | // L2 sector is 32B, default fetch granularity is 64B |
| 57 | using VecType = conditional_t<(V * sizeof_bits_v<typename GEngine::value_type>) < (FetchBytes * 8), |
| 58 | ArrayEngine<typename GEngine::value_type, V>, |
| 59 | uint8_t[FetchBytes] >; |
| 60 | |
| 61 | Tensor src_v = recast<VecType const>(src); |
| 62 | CUTE_UNROLL |
| 63 | for (int i = tid; i < size(src_v); i += NumThreads) { |
| 64 | prefetch(raw_pointer_cast(&src_v(i))); |
| 65 | } |
| 66 | } else { |
| 67 | CUTE_UNROLL |
| 68 | for (int i = tid; i < size(src); i += NumThreads) { |
| 69 | prefetch(raw_pointer_cast(&src(i))); |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | template <class GEngine, class GLayout> |
| 75 | CUTE_HOST_DEVICE |
nothing calls this directly
no test coverage detected