Skip to content

C host kernels: a strided array runs the next implementation - #145

Merged
max-models merged 2 commits into
develfrom
claude/picnic-profiling-benchmark-c1qlvi
Nov 25, 2026
Merged

max-models merged 2 commits into
develfrom
claude/picnic-profiling-benchmark-c1qlvi

Conversation

@max-models

@max-models max-models commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

The generated wrapper of a C host kernel takes C-contiguous arrays only, so a kernel with a <name>_c.c raised TypeError for every caller that passes a strided view (a column slice of marker storage, positions[:, :n] rows of a larger array, x[:, ::2]). picnic and mpifield worked around it with separate row kernels and a dispatch in Python.

Now HostImplementations.__call__ checks the NumPy arguments: when one is not C-contiguous and the selected implementation is "c", the call runs the next available one (Pyccel, then Numba, then NumPy). The selection does not change, and calling the C implementation itself (kernel.host_kernel.kernel.get("c")) still raises for such an array, another element type or another number of dimensions.

Docs (kernels/c-kernel.md) and changelog updated.

Tests: test_a_strided_array_runs_the_next_implementation (a strided output runs Pyccel and gets the same values, the rest of its storage untouched; a contiguous call afterwards runs C). The unit suite passes locally (963 passed).

@max-models
max-models merged commit ca2d08b into devel Nov 25, 2026
23 checks passed
@max-models
max-models deleted the claude/picnic-profiling-benchmark-c1qlvi branch November 25, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant