Clarify clEnqueueSVMMemcpy src_ptr and dst_ptr non-blocking lifetime requirements

Aperta
#1,650 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
57/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
markdown
Ambito
documentation

Direzione di ricerca

Start by locating the source documentation for clEnqueueSVMMemcpy and compare its blocking and non-blocking text with the cited clEnqueueMemcpyINTEL description. Determine how the specification should state pointer lifetime and access requirements for both src_ptr and dst_ptr, including whether src_ptr may be read before completion. Done means the relevant wording clearly and consistently describes these requirements.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

cl_khr_unified_svm

The current description of clEnqueueSVMMemcpy does not clearly describe the lifetime requirements for the src_ptr and dst_ptr arguments, especially when the SVM memcpy is non-blocking (blocking is CL_FALSE).

I think it should be undefined behavior if either src_ptr or dst_ptr is freed before the SVM memcpy completes, or if the memory regions specified by src_ptr, dst_ptr, and size are modified before the SVM mempcy completes. Is this correct?

Assuming the memory region pointed to by src_ptr is accessible from the host, is it valid and defined behavior to read it before the SVM memcpy completes?

For easier reference, the current spec text kind of describes this scenario in two places (we should fix this) and only for dst_ptr (we should fix this, too):

First:

blocking_copy indicates if the copy operation is blocking or non-blocking.

If blocking_copy is CL_TRUE i.e. the copy command is blocking, clEnqueueSVMMemcpy does not return until the buffer data has been copied into memory pointed to by dst_ptr.

Then:

If blocking_copy is CL_FALSE i.e. the copy command is non-blocking, clEnqueueSVMMemcpy queues a non-blocking copy command and returns. The contents of the buffer that dst_ptr points to cannot be used until the copy command has completed. The event argument returns an event object which can be used to query the execution status of the read command. When the copy command has completed, the contents of the buffer that dst_ptr points to can be used by the application.

I think the definition is improved in the description of clEnqueueMemcpyINTEL in cl_intel_unified_shared_memory, but we could probably do better still, since this only talks about modification and does not say anything about the memory being freed:

blocking indicates if the copy operation is blocking or non-blocking. If blocking is CL_TRUE, the copy command is blocking, and the function will not return until the copy command is complete. Otherwise, if blocking is CL_FALSE, the copy command is non-blocking, and the contents of the dst_ptr cannot be used nor can the contents of the src_ptr be overwritten until the copy command is complete.

Lingua principale
Python
Stelle
427
Fork
137
Merge medio
3g 21h
PR unite (30g)
4

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di KhronosGroup/OpenCL-Docs

Tutte le issue di KhronosGroup/OpenCL-Docs

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.