Skip to content

Commit f1d2070

Browse files
committed
Update (base update)
[ghstack-poisoned]
1 parent 49bb10a commit f1d2070

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

backends/vulkan/runtime/graph/ops/impl/FusedCe.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,18 @@ void fused_ce(ComputeGraph& graph, const std::vector<ValueRef>& args) {
101101
const ValueRef logits = args[arg_idx++];
102102
const ValueRef labels = args[arg_idx++];
103103
const ValueRef n_valid_ref = args[arg_idx++];
104-
const ValueListPtr out_tuple = graph.get_value_list(args[arg_idx++]);
105-
const ValueRef loss = out_tuple->at(0);
106-
const ValueRef dlogits = out_tuple->at(1);
104+
const ValueRef out_tuple_ref = args[arg_idx++];
105+
106+
// Release the ValueListPtr before allocating loss_partial: add_tensor (via
107+
// TmpTensor) asserts no live get_*() pointer exists, because adding Values
108+
// may reallocate values_ and invalidate it (check_no_active_value_ptrs).
109+
ValueRef loss = kDummyValueRef;
110+
ValueRef dlogits = kDummyValueRef;
111+
{
112+
const ValueListPtr out_tuple = graph.get_value_list(out_tuple_ref);
113+
loss = out_tuple->at(0);
114+
dlogits = out_tuple->at(1);
115+
}
107116

108117
VK_CHECK_COND(
109118
graph.is_buffer_storage(logits) && graph.is_buffer_storage(dlogits),

0 commit comments

Comments
 (0)