[MLIR] Scaffold MLIR based UDF backend - #22766
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR adds Changesnumba-cuda-mlir dependency and MLIR backend package
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
bdice
left a comment
There was a problem hiding this comment.
Can we start work on a conda recipe? I'd like to land that before merging.
| """`cudf.utils._numba` should default `CUDA_ENABLE_NRT` to False on import.""" | ||
| import cudf.utils._numba # noqa: F401 -- import for its side effect | ||
|
|
||
| assert numba_config.CUDA_ENABLE_NRT is False, ( |
There was a problem hiding this comment.
| assert numba_config.CUDA_ENABLE_NRT is False, ( | |
| assert not numba_config.CUDA_ENABLE_NRT, ( |
| assert numba_config.CUDA_ENABLE_NRT is False | ||
| with nrt_enabled(): | ||
| assert numba_config.CUDA_ENABLE_NRT is True | ||
| assert numba_config.CUDA_ENABLE_NRT is False |
There was a problem hiding this comment.
Please apply in various places below, too. (This assumes numba_config.CUDA_ENABLE_NRT is boolean and does not take on states like None.)
| assert numba_config.CUDA_ENABLE_NRT is False | |
| with nrt_enabled(): | |
| assert numba_config.CUDA_ENABLE_NRT is True | |
| assert numba_config.CUDA_ENABLE_NRT is False | |
| assert not numba_config.CUDA_ENABLE_NRT | |
| with nrt_enabled(): | |
| assert numba_config.CUDA_ENABLE_NRT | |
| assert not numba_config.CUDA_ENABLE_NRT |
| # per-kernel for UDFs whose data model declares an NRT meminfo (e.g. string | ||
| # returns), and restores it afterwards. Setting the global default to False | ||
| # avoids linking NRT into kernels that don't need it. | ||
| numba_config.CUDA_ENABLE_NRT = False |
There was a problem hiding this comment.
I think importing cudf should not change the state of this global config. Instead, we should use a context manager to enable it as needed and restore to the prior global state (regardless of whether it was True or False) when outside of cuDF usage of NRT.
|
Failing cuda 12.2 jobs require NVIDIA/numba-cuda-mlir#102 to be released. We can skip cuda 12.2 for now or wait. |
vyasr
left a comment
There was a problem hiding this comment.
OK this is super minimal now, so just adding the MLIR dep. That's fine for the moment, we can add things as they become available. If we're going to get a CUDA 12.2 supporting release from numba-cuda-mlir then let's wait on that to resolve the currently failing test.
|
/merge |
Add a basic MLIR based `MaskedType` and the ability to express the creation of one inside a `numba-cuda-mlir` kernel. Part of the MLIR UDF backend stack. Depends on #22766 (plumbing). Adds the MaskedType extension type: parameterized value type, the Masked(value, valid) constructor, the .value / .valid accessors, and the LLVM struct data model. Numeric/boolean value types only. Stacked on: #22766. Tests under tests/private_objects/mlir_backend/. Authors: - https://github.com/brandon-b-miller Approvers: - Matthew Roeschke (https://github.com/mroeschke) - Vyas Ramasubramani (https://github.com/vyasr) URL: #22884
Part of the MLIR UDF backend stack. Depends on #22766 (plumbing). Adds NA handling for MaskedType: NAType + cudf.NA typeof, MaskedType / NAType unify, `m is NA` / `m is not NA`, and the NA / scalar / Masked->Masked casts used for branch unification. Unification covers expressions in the target code like the following where `x` is `MaskedType`. ``` if x is cudf.NA: return x else: return 42 ``` 42 is a scalar here so the unification code kicks in and types the overall expression as returning MaskedType, and upcasts the 42 to Masked(42, True)
This PR adds initial scaffolding for a rewrite of the UDF numba-cuda extension backend using
numba-cuda-mlir.There's no conda packages yet, so this PR leaves updating the dep on the conda side as a todo. Xref NVIDIA/numba-cuda-mlir#97