         }
 
         ctx.baq.bandwidth[read_index] = bandWidth;
+    }
+};
+
+template <target_system system>
+struct hmm_window_valid : public lambda<system>
+{
+    LAMBDA_INHERIT;
+
+    CUDA_HOST_DEVICE bool operator() (const uint32 read_index)
+    {
+        if (ctx.baq.hmm_reference_windows[read_index].x == short(-1) &&
+            ctx.baq.hmm_reference_windows[read_index].y == short(-1))
+        {
+            return false;
+        } else {
+            return true;
+        }
     }
 };
 

    struct baq_context<system>& baq = context.baq;
    vector<system, uint32>& active_baq_read_list = context.temp_u32;
    vector<system, uint32>& baq_state = context.temp_u32_2;

    // check if we can use the lmem kernel
#if ENABLE_LMEM_PATH


    CUDA_HOST_DEVICE void operator() (const uint32 read_index)
    {
        // read_needs_baq is used to avoid disabling reads that don't actually need BAQ if we determine that BAQ can't otherwise be computed
        // (we still compute HMM windows even for reads that do not need BAQ)
        const bool read_needs_baq = (ctx.cigar.num_errors[read_index] != 0);

        const CRQ_index idx = batch.crq_index(read_index);

        const ushort2& read_window_clipped = ctx.cigar.read_window_clipped[read_index];
