Skip to content

Commit

Permalink
Merge branch 'INSTX-7139-conv-overflow' into 'master'
Browse files Browse the repository at this point in the history
[INSTX-7139] Use wider unsigned types for offsets

Closes INSTX-7139

See merge request machine-learning/dorado!1251
  • Loading branch information
blawrence-ont committed Oct 31, 2024
2 parents 64b2a72 + 6d099c1 commit 03e5eec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions dorado/basecall/metal/nn.metal
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,12 @@ kernel void conv(
*/

struct RowMajor {
static int inner(int /* r */, int c) { return c; }
static int outer(int r, int /* c */) { return r; }
static ulong inner(int /* r */, int c) { return c; }
static ulong outer(int r, int /* c */) { return r; }
};
struct ColMajor {
static int inner(int r, int /* c */) { return r; }
static int outer(int /* r */, int c) { return c; }
static ulong inner(int r, int /* c */) { return r; }
static ulong outer(int /* r */, int c) { return c; }
};
// 2D matrix layouts using 8x8 tiles. Note that RowMajor/ColMajor apply to the order of tiles, *NOT* within tiles
// RC == RowMajor: layout RrCc, where: R = row / 8; r = row % 8; C = col / 8; c = col % 8
Expand Down
6 changes: 2 additions & 4 deletions dorado/read_pipeline/BasecallerNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ void BasecallerNode::input_thread_fn() {

// Now that we have acquired a read, wait until we can push to chunks_in
// Chunk up the read and put the chunks into the pending chunk list.
size_t raw_size =
read_common_data.raw_data
.sizes()[read_common_data.raw_data.sizes().size() - 1]; // Time dimension.
size_t raw_size = read_common_data.raw_data.sizes().back(); // Time dimension.
size_t chunk_queue_idx = get_chunk_queue_idx(raw_size);
size_t chunk_size = m_chunk_sizes[chunk_queue_idx];

Expand All @@ -101,7 +99,7 @@ void BasecallerNode::input_thread_fn() {
read_chunks.emplace_back(std::make_unique<BasecallingChunk>(
working_read, offset, chunk_in_read_idx++, chunk_size));
size_t num_chunks = 1;
auto last_chunk_offset = raw_size - chunk_size;
auto last_chunk_offset = raw_size > chunk_size ? raw_size - chunk_size : 0;
auto misalignment = last_chunk_offset % m_model_stride;
if (misalignment != 0) {
// move last chunk start to the next stride boundary. we'll zero pad any excess samples required.
Expand Down

0 comments on commit 03e5eec

Please sign in to comment.