Lines Matching refs:ctx

18 		struct hl_ctx *ctx, u64 timeout_us, u64 seq);
152 parser.ctx_id = job->cs->ctx->asid;
245 static void cs_counters_aggregate(struct hl_device *hdev, struct hl_ctx *ctx)
248 ctx->cs_counters.device_in_reset_drop_cnt;
250 ctx->cs_counters.out_of_mem_drop_cnt;
252 ctx->cs_counters.parsing_drop_cnt;
254 ctx->cs_counters.queue_full_drop_cnt;
256 ctx->cs_counters.max_cs_in_flight_drop_cnt;
263 struct hl_device *hdev = cs->ctx->hdev;
341 * Must be called before hl_ctx_put because inside we use ctx to get
346 hl_ctx_put(cs->ctx);
361 cs_counters_aggregate(hdev, cs->ctx);
385 hdev = cs->ctx->hdev;
397 static int allocate_cs(struct hl_device *hdev, struct hl_ctx *ctx,
409 cs->ctx = ctx;
429 spin_lock(&ctx->cs_lock);
431 cs_cmpl->cs_seq = ctx->cs_sequence;
432 other = ctx->cs_pending[cs_cmpl->cs_seq &
438 ctx->cs_counters.max_cs_in_flight_drop_cnt++;
455 ctx->cs_pending[cs_cmpl->cs_seq &
458 ctx->cs_sequence++;
464 spin_unlock(&ctx->cs_lock);
471 spin_unlock(&ctx->cs_lock);
501 cs->ctx->asid, cs->sequence);
512 struct hl_device *hdev = cs->ctx->hdev;
645 hl_ctx_get(hdev, hpriv->ctx);
647 rc = allocate_cs(hdev, hpriv->ctx, CS_TYPE_DEFAULT, &cs);
649 hl_ctx_put(hpriv->ctx);
666 hpriv->ctx->cs_counters.parsing_drop_cnt++;
673 hpriv->ctx->cs_counters.parsing_drop_cnt++;
687 hpriv->ctx->cs_counters.out_of_mem_drop_cnt++;
720 hpriv->ctx->cs_counters.parsing_drop_cnt++;
723 cs->ctx->asid, cs->sequence, job->id, rc);
729 hpriv->ctx->cs_counters.parsing_drop_cnt++;
732 cs->ctx->asid, cs->sequence);
742 cs->ctx->asid, cs->sequence, rc);
772 struct hl_ctx *ctx = hpriv->ctx;
863 sig_fence = hl_ctx_get_fence(ctx, signal_seq);
899 hl_ctx_get(hdev, ctx);
901 rc = allocate_cs(hdev, ctx, cs_type, &cs);
905 hl_ctx_put(ctx);
922 ctx->cs_counters.out_of_mem_drop_cnt++;
936 ctx->cs_counters.out_of_mem_drop_cnt++;
973 ctx->asid, cs->sequence, rc);
1000 struct hl_ctx *ctx = hpriv->ctx;
1021 ctx->asid);
1047 ctx->asid);
1054 ctx->asid);
1059 do_ctx_switch = atomic_cmpxchg(&ctx->thread_ctx_switch_token, 1, 0);
1071 rc = hdev->asic_funcs->context_switch(hdev, ctx->asid);
1075 ctx->asid, rc);
1108 ctx->asid, rc);
1114 ret = _hl_cs_wait_ioctl(hdev, ctx,
1120 ctx->asid, ret);
1126 ctx->thread_ctx_switch_wait_token = 1;
1127 } else if (!ctx->thread_ctx_switch_wait_token) {
1131 &ctx->thread_ctx_switch_wait_token, tmp, (tmp == 1),
1162 struct hl_ctx *ctx, u64 timeout_us, u64 seq)
1173 hl_ctx_get(hdev, ctx);
1175 fence = hl_ctx_get_fence(ctx, seq);
1181 seq, ctx->cs_sequence);
1198 seq, ctx->cs_sequence);
1202 hl_ctx_put(ctx);
1214 rc = _hl_cs_wait_ioctl(hdev, hpriv->ctx, args->in.timeout_us, seq);