You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8315bc9
Browse filesBrowse the repository at this point in the historyBrowse files
Add in-development MLIR/NRT backend section to the UDF string memory guide
The shim-based backend documented here is still the one in place, so leave it
unchanged. Append a clearly-marked 'in development' section that uses the
existing legacy explanation as a lens and describes only the deltas for the
pure-MLIR backend: the flat mlir_string {meminfo, data, nbytes} representation
(no cudf::udf_string), creation via allocate_mlir_string / NRT_MemInfo_new_varsize
instead of C++ shims, teardown via free_mlir_string_array /
_mlir_string_array_to_column, plus borrowed-vs-owned, enabling NRT, and nullable
(Masked) strings. The NRT model and the str1 + str2 lifecycle are unchanged.
Copy file name to clipboardExpand all lines: docs/cudf/source/cudf/developer_guide/udf_memory_management.md
+121Lines changed: 121 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -400,3 +400,124 @@ the effect of freeing the entire `mi_str_allocation`.
400
400
- **Stack**: Original `ManagedUDFString` becomes invalid/out-of-scope
401
401
- **Reference Count**: N/A (object destroyed)
402
402
- **cuDF** A `cudf::column` of string type containing the result of the UDF
403
+
404
+
405
+
## The MLIR backend (in development): what changes
406
+
407
+
```{note}
408
+
Everything above describes the **current, shipping** string UDF backend: C++
409
+
shim functions plus an owning ``cudf::udf_string`` class. A reimplementation is
410
+
in progress that lowers string operations **entirely in MLIR** and removes the
411
+
C++ shim layer. This section does **not** supersede the material above --- it
412
+
uses it as a lens. The NRT model itself is unchanged; only the representation of
413
+
a device string and the mechanism that creates and frees it change. When the
414
+
MLIR backend becomes the default, this section and the sections above will be
415
+
reconciled into one.
416
+
```
417
+
418
+
### What stays exactly the same
419
+
420
+
Re-read ["Numba memory management and the Numba Runtime (NRT)"](#numba-memory-management-and-the-numba-runtime-nrt), the ``MemInfo`` struct, ``NRT_decref``, the three [NRT Requirements](#nrt-requirements), and the five-phase
421
+
``str1 + str2``[lifecycle](#string-lifecycle-details). **All of it carries over
422
+
verbatim.** NRT is still the memory manager; a reference-counted type still
423
+
declares `has_nrt_meminfo` and exposes `get_nrt_meminfo`; operators that produce
424
+
a string still initialize a `MemInfo` and place it where numba expects; the
425
+
destructor still runs when `refct` hits zero. If you understand the model above,
426
+
you understand the MLIR backend --- what follows is only the delta.
427
+
428
+
### What changes (1): the string representation
429
+
430
+
The owning C++ container goes away. Instead of ``ManagedUDFString`` wrapping a
431
+
``cudf::udf_string``, the MLIR backend uses a flat value called ``mlir_string``:
432
+
433
+
```text
434
+
legacy: ManagedUDFString { void* meminfo, cudf::udf_string } # owns a C++ class
0 commit comments