quic-sanirudh commented on code in PR #13256: URL: https://github.com/apache/tvm/pull/13256#discussion_r1035023792
########## src/runtime/hexagon/ops/conv2d.h: ########## @@ -75,15 +77,31 @@ inline void* to_ptr(uintptr_t v) { return reinterpret_cast<void*>(v); } inline uintptr_t to_uint(void* ptr) { return reinterpret_cast<uintptr_t>(ptr); } -constexpr int xyc_to_sm_16b(int y, int x, int c) { +inline constexpr int yxc_to_sm_16b(int y, int x, int c) { // Map y,x,c coordinates within a block to the offset (in 16-bit elements) // from the beginning of the block in spatial-major layout. // 10-bit spatial mask: yyyxcccccx assert(y >= 0 && x >= 0 && c >= 0); return y << 7 | (x & 2) << 5 | c << 1 | (x & 1); } -constexpr int hwio_to_sm_16b(int width, int y, int x, int i, int o) { +inline constexpr int yxc_to_sm_8b(int y, int x, int c) { + // Map y,x,c coordinates within a block to the offset (in 8-bit elements) + // from the beginning of the block in spatial-major layout. + // 10-bit spatial mask: yyyxxxccccc Review Comment: I've added the asserts directly inside the index functions that would be disabled with Release builds. I thought about adding it in the outer loops as you suggested, but that anyways is guaranteed with the current code as `block_height/block_width/block_depth` is expected to be the size of the blocks and for other uses of the index functions, it is the responsibility of the caller anyway. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@tvm.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org