Skip to content

Commit 9c1fa19

Browse files
committed
Update (base update)
[ghstack-poisoned]
1 parent c389a53 commit 9c1fa19

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

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

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,13 @@ 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 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-
}
104+
const ValueRef out_tuple_ref = args[arg_idx];
105+
106+
// Read loss/dlogits via short-lived get_value_list() temporaries: no get_*()
107+
// pointer may be alive when loss_partial is added below, else adding Values
108+
// can reallocate values_ and check_no_active_value_ptrs() throws.
109+
const ValueRef loss = graph.get_value_list(out_tuple_ref)->at(0);
110+
const ValueRef dlogits = graph.get_value_list(out_tuple_ref)->at(1);
116111

117112
VK_CHECK_COND(
118113
graph.is_buffer_storage(logits) && graph.is_buffer_storage(dlogits),

0 commit comments

Comments
 (0)