review-cudf-polars-expressions

Implements and reviews Polars expression support in the cudf-polars GPU engine.

9.7k|1.1k|Updated May 7, 2017
One-click install
npx skills add https://github.com/rapidsai/cudf --skill review-cudf-polars-expressions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: review-cudf-polars-expressions
Source: https://github.com/rapidsai/cudf/tree/main/.agents/skills/review-cudf-polars-expressions
Command: npx skills add https://github.com/rapidsai/cudf --skill review-cudf-polars-expressions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Adding support for Polars expressions in cudf-polars requires understanding Polars internals, GPU execution paths, and strict testing requirements. This Skill provides a structured workflow for implementing or reviewing Polars expression support so expressions run entirely on the GPU without silent CPU fallback.

Core Features & Use Cases

  • Behavior Analysis: Guides review of the Polars Python and Rust source to understand expression semantics, edge cases, and exception behavior before implementation.
  • GPU Implementation Patterns: Directs implementation in the cudf-polars DSL expression layer using pylibcudf, covering single-partition and multi-partition streaming execution paths.
  • Testing Discipline: Enforces unit tests with 100% coverage of new code, engine fixtures for all execution modes, and version-gated tests via pytest.mark.skipif.
  • Use Case: When a user reports that a Polars expression like a string or datetime operation falls back to CPU in cudf-polars, follow this workflow to diagnose the gap, implement GPU support, and add validated tests.

Quick Start

Implement GPU support for the Polars expression I specify in cudf-polars, following the review workflow and adding tests that pass all pre-commit checks.

Frequently Asked Questions about review-cudf-polars-expressions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a Polars expression in cudf-polars?

First study the Polars implementation in py-polars and the Rust expr_nodes.rs visitor, then implement the expression in the cudf_polars dsl/expressions directory using pylibcudf functions. Add a multi-partition implementation for non-pointwise expressions and unit tests covering all new code.

How do I test if a Polars expression runs on GPU with cudf-polars?

Pass pl.GPUEngine(executor="streaming", raise_on_fail=True) to the collect engine argument so failures do not fall back to CPU Polars. Also test with max_rows_per_partition set to 2 to exercise the multiple partition path.

Why does a Polars expression fall back to CPU in cudf-polars?

Fallback happens when the expression is not exposed through the Polars Rust visitor, is not yet implemented in cudf-polars, or lacks a multiple partition implementation. Unsupported expressions should raise an error during IR translation rather than at runtime.

Does cudf-polars support all Polars versions?

Implementations must support every Polars version listed in python/cudf_polars/pyproject.toml. Tests for expressions or arguments that only exist in newer versions should use pytest.mark.skipif with flags from the versions utility module.

What are the testing requirements for cudf-polars expression contributions?

New tests must achieve 100 percent coverage of added lines, use the engine fixture from conftest.py to cover single and multiple partition execution, and be validated by stashing the implementation to confirm the tests fail without it.