Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# GitHub Copilot Instructions — mkl_fft

## Identity
You are an expert Python/C developer working on `mkl_fft` at Intel.
Apply Intel engineering standards: correctness first, minimal diffs, no assumptions.

## Source of truth
This file is canonical for Copilot/agent behavior.
`AGENTS.md` provides project context.

## Precedence
copilot-instructions > nearest AGENTS > root AGENTS
Higher-precedence file overrides; lower must not restate overridden guidance.

## Mandatory flow
1. Read root `AGENTS.md`. If absent, stop and report.
2. For edited files, use root AGENTS (no local AGENTS files exist here).
3. If future local `AGENTS.md` files appear, find nearest per file.

## Contribution expectations
- Keep diffs minimal; prefer atomic single-purpose commits.
- Preserve NumPy/SciPy FFT API compatibility by default.
- For API changes: update tests + docstrings when user-visible.
- For bug fixes: add regression tests in `mkl_fft/tests/`.
- Do not generate code without a corresponding test update in the same step.
- Run `pre-commit run --all-files` before proposing code changes.

## Authoring rules
- Use source-of-truth files for all mutable details.
- Never invent/hardcode versions, flags, or matrix values.
- Use stable entry points: `pip install -e .` (dev), `pytest mkl_fft/tests` (test).
- Never include sensitive data in any file.
- **C templates:** Edit only `src/*.c.src`; do not manually edit generated `.c` files.
- **Cython/MKL calls:** Release GIL with `with nogil:` blocks for performance-critical MKL functions.
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instruction to release GIL with with nogil: blocks is not reflected in the current codebase, which does not use nogil blocks. Since MKL internally manages threading, verify whether this guidance is appropriate. If this is intended as prescriptive guidance for future contributions, consider clarifying that context or verifying with domain experts that GIL release is beneficial for MKL FFT operations.

Suggested change
- **Cython/MKL calls:** Release GIL with `with nogil:` blocks for performance-critical MKL functions.
- **Cython/MKL calls:** For new or refactored performance-critical MKL calls, consider releasing the GIL with `with nogil:` around long-running sections, but only after verifying (with benchmarks or domain experts) that this is safe and beneficial given MKL's internal threading.

Copilot uses AI. Check for mistakes.
- **Memory:** Ensure proper alignment for FFT buffers; respect MKL object lifecycle.
- **Compiler flags:** Do not hardcode ISA flags (AVX-512, etc.) outside `setup.py`.

## Source-of-truth files
- Build/config: `pyproject.toml`, `setup.py`
- Dependencies: `pyproject.toml` (dependencies, optional-dependencies), `conda-recipe/meta.yaml`, `conda-recipe-cf/meta.yaml`
- CI: `.github/workflows/*.{yml,yaml}`
- Style/lint: `.pre-commit-config.yaml`, `.flake8`, `pyproject.toml` (tool.black, tool.isort, tool.cython-lint)
- API contracts: `mkl_fft/__init__.py`, `mkl_fft/interfaces/*.py`, NumPy FFT docs (https://numpy.org/doc/stable/reference/routines.fft.html), SciPy FFT docs (https://docs.scipy.org/doc/scipy/reference/fft.html)
- Test data: `mkl_fft/tests/`

## Intel-specific constraints
- Package channels: Intel PyPI (https://software.repos.intel.com/python/pypi), Intel conda (https://software.repos.intel.com/python/conda), conda-forge
- MKL backend: requires `mkl-devel` at build time, `mkl-service` at runtime
- Performance: for claims, reference https://github.com/intelpython/fft_benchmark
- Do not hardcode MKL version assumptions; respect `pyproject.toml` `requires-python` range
35 changes: 35 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# AGENTS.md — mkl_fft

## What this project is
NumPy-based Python interface to Intel® oneMKL FFT functions. Provides MKL-accelerated FFT for real/complex transforms. Part of Intel® Distribution for Python. Archetype: **python** (Cython + C extensions).

Layers: Python interfaces, Cython bindings (`_pydfti.pyx`), C backend (`src/*.c.src`).

## How it's structured
- `mkl_fft/interfaces/` — drop-in replacements for `numpy.fft`, `scipy.fft`
- `mkl_fft/src/` — C templates (`.c.src`)
- `mkl_fft/tests/` — pytest suite
- `conda-recipe/`, `conda-recipe-cf/` — Intel/conda-forge builds

Build: `pyproject.toml` + `setup.py`. Runtime: `mkl-service`, `numpy>=1.26.4`.

## How to work in it
- Keep changes atomic and single-purpose.
- Preserve NumPy/SciPy FFT API; document divergence in commit message.
- Pair changes with tests and docstrings.
- Never assume MKL or NumPy versions; use source-of-truth files.
- **C templates:** Edit only `*.c.src` files; generated `.c` is ephemeral (via `_vendored/conv_template.py`).
- **Local dev:** `conda create -n dev python numpy cython mkl-devel pytest && pip install -e .`

For agent policy: `.github/copilot-instructions.md`

## Where truth lives
- Build/config: `pyproject.toml`, `setup.py`
- Dependencies: `pyproject.toml` (`dependencies`, `optional-dependencies`), `conda-recipe/meta.yaml`, `conda-recipe-cf/meta.yaml`
- CI: `.github/workflows/`
- Style/lint: `.pre-commit-config.yaml`, `.flake8`, `pyproject.toml` (black/isort/cython-lint)
- API/contracts: `mkl_fft/__init__.py`, `mkl_fft/interfaces/`, NumPy/SciPy FFT docs
- Stable entry points: `python -m pip install .`, `pytest mkl_fft/tests`

## Directory map
No local AGENTS files — project is small enough for root-level guidance only.
Loading