Skip to content

task: agent ready prep - #280

Open
jharlow-intel wants to merge 11 commits into
mainfrom
task/agent-ready
Open

jharlow-intel wants to merge 11 commits into
mainfrom
task/agent-ready

Conversation

@jharlow-intel

@jharlow-intel jharlow-intel commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Very similar to IntelPython/mkl_fft#379: adds contributor and coding-agent guidance (CONTRIBUTING.md, AGENTS.md), PR and issue templates, and a README pointer, checked against this repo's build and CI. It also corrects the existing AGENTS.md files.

Comment thread CONTRIBUTING.md
Comment thread CONTRIBUTING.md Outdated
Comment thread conda-recipe-cf/AGENTS.md Outdated
Comment thread conda-recipe-cf/AGENTS.md Outdated
Comment thread AGENTS.md
Comment thread mkl_umath/src/AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread CONTRIBUTING.md Outdated
Comment thread .github/AGENTS.md
- CONTRIBUTING.md: use --override-channels, install pre-commit with the
  pylint and shellcheck its system hooks need, note Windows support and
  the meson.build GCC/MSVC branches, and match the CHANGELOG link format
- AGENTS.md: restore supported platforms, add the meson.build guardrail,
  and note that checkout tests need the editable install
- conda-recipe-cf/AGENTS.md: gnu_thread is Linux-only, llvm-openmp has no
  run pin, and each recipe has its own conda_build_config.yaml
- mkl_umath/src/AGENTS.md: scope the patch lock claim and note per-thread
  patch/restore balance
- .github/AGENTS.md: list the templates and repo config files

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I checked the docs at 3f8573f against the tree and by running them.

  • I ran the CONTRIBUTING.md setup verbatim in a clean condaforge/miniforge3 container. Creating the env, the editable install, pytest mkl_umath/tests (392 passed, 1 skipped) and pre-commit run --all-files all pass. A control build without -Dmkl_threading=gnu_thread fails at import with libmkl_intel_thread.so.3: undefined symbol: __atomic_compare_exchange, so the gnu_thread note is right.
  • I also ran a static check of the paths, commands and identifiers the guidance names. At head it finds no broken references. At base it found the stale mkl_random mentions and the src/__umath_generated.c path, which this PR fixes.
  • I checked loading with Claude Code 2.1.296. The root AGENTS.md loads from every directory, and each nested one loads once the agent works in its subtree. .github/copilot-instructions.md is never loaded; more on that inline.

A few remaining points are inline. None of them block the PR.

Comment thread CONTRIBUTING.md
Comment thread conda-recipe/AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread .github/copilot-instructions.md
Comment thread .github/AGENTS.md Outdated
Comment thread .github/ISSUE_TEMPLATE/bug_report.yml
Comment thread .github/ISSUE_TEMPLATE/bug_report.yml
Comment thread CONTRIBUTING.md Outdated
Comment thread CONTRIBUTING.md Outdated
Comment thread conda-recipe-cf/AGENTS.md
Comment thread benchmarks/AGENTS.md Outdated
Comment thread .gitignore
Comment thread _vendored/AGENTS.md Outdated
Comment thread mkl_umath/tests/AGENTS.md
@antonwolfy antonwolfy added this to the 0.7.0 release milestone Oct 15, 2026
Comment thread benchmarks/AGENTS.md
Comment thread mkl_umath/AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread CONTRIBUTING.md
@jharlow-intel jharlow-intel self-assigned this Oct 28, 2026
Comment thread mkl_umath/AGENTS.md Outdated
Comment on lines +14 to +15
- `generate_umath_doc.py`, `ufunc_docstrings_numpy2.py` — docstring sources
adapted from NumPy; the build does not run them

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since #282 the build does run them: meson.build:144-150 generates _umath_doc_generated.h from generate_umath_doc.py, with ufunc_docstrings_numpy2.py in depend_files, and _ufuncs compiles that header (meson.build:201). Suggest something like: "ufunc_docstrings_numpy2.py — the ufunc docstrings, adapted from NumPy; edit them here. generate_umath_doc.py turns them into _umath_doc_generated.h at build time."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 3f6872c: ufunc_docstrings_numpy2.py is now the place to edit docstrings, and generate_umath_doc.py turns it into _umath_doc_generated.h at build time.

Comment thread AGENTS.md Outdated

## Development guardrails
- Preserve NumPy ufunc behavior; patched loops stand in for NumPy's own.
- Edit the `*.src` templates and `generate_umath.py`, not generated C.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

With #282 docstrings are a third edit point: ufunc_docstrings_numpy2.py, which the build turns into _umath_doc_generated.h. The old root file pointed to it and this one doesn't, and "Ufunc extension" at lines 12-13 lists only __umath_generated.c. Suggest "Edit the *.src templates, generate_umath.py and ufunc_docstrings_numpy2.py, not generated C or headers." The same rule is at CONTRIBUTING.md:51.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 3f6872c, in both AGENTS.md and CONTRIBUTING.md; "Ufunc extension" now lists the docstring header too.

Comment thread mkl_umath/src/AGENTS.md Outdated
- **Vectorization:** `-fveclib=SVML -fvectorize` for SIMD (Intel compiler only)
- **Optimization reports:** `-Dopt_report=true` meson option for `-qopt-report=3`
## Guardrails
- Edit the `.src` templates, not the generated `.c`/`.h`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two of the generated files don't come from .src templates: __umath_generated.c is from generate_umath.py and _umath_doc_generated.h from generate_umath_doc.py. This also differs from the root rule (AGENTS.md:36), which names generate_umath.py. Maybe point to the root rule instead of restating it, so the copies can't drift.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 3f6872c: it now says "edit sources, not generated files" and points to the root AGENTS.md for the edit points.

Comment thread AGENTS.md Outdated
- Build system: `pyproject.toml` + `meson.build`, with options in `meson.options`
- Build deps: `mkl-devel`, `numpy`, `meson-python`, `cmake`, `ninja`, `cython`,
and a C compiler (CI uses `icx` and `clang`)
- Runtime deps: `numpy`; the conda recipes add the MKL and compiler runtimes

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since #289 it's NumPy 2 only: numpy >=2 in pyproject.toml, and the NumPy 1 code paths are gone. Worth saying, so an agent doesn't add a NumPy 1 fallback: "Runtime deps: numpy, NumPy 2 only (see pyproject.toml); ..."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added in 3f6872c: "Runtime deps: numpy, NumPy 2 only (see pyproject.toml)".

Comment thread AGENTS.md Outdated
- Setup, checks, and style: `CONTRIBUTING.md`
- Single test: `pytest mkl_umath/tests/<file>.py::<test>`, from a checkout with the
editable install in `CONTRIBUTING.md`
- Single-file lint: `pre-commit run --files <path>`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This fails on main too: no-commit-to-branch has always_run: true and pass_filenames: false, so it runs no matter which files you pass. Suggest adding "(from a branch, see CONTRIBUTING.md)".

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added in 3f6872c: "…, from a branch (see CONTRIBUTING.md)".

Comment thread mkl_umath/AGENTS.md Outdated
functions from `_patch_numpy`
- `_init_helper.py` — imported first by `__init__.py`; in a Windows venv, adds
`Library/bin` to the DLL search path so the extensions can load
- `generate_umath.py` — generates `__umath_generated.c` in the build directory

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

An "adding a ufunc" note would help, since these hand-kept lists must change together: the defdict entry in generate_umath.py, the loop and its declaration in src/mkl_umath_loops.{c,h}.src, the docstring in ufunc_docstrings_numpy2.py, and the import and __all__ in __init__.py.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added in 3f6872c: an "adding a ufunc" guardrail listing the defdict entry, the loop and its declaration in the .src templates, the docstring, and the __init__.py import and __all__.

Comment thread benchmarks/AGENTS.md
so the suite itself is under `benchmarks/benchmarks/`.

## Scope
- `asv.conf.json` — ASV configuration, channels, and regression thresholds

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Worth saying where to run asv: asv.conf.json is here, so from the repo root asv doesn't find a config, and README.md doesn't say to cd benchmarks. Also, environment_type is conda, so without --python=same (as in the README commands) asv builds conda envs. requirements.txt is missing from this list too.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added in 3f6872c: run asv from benchmarks/ with --python=same, and requirements.txt is now in the Scope list.

Comment thread CONTRIBUTING.md
Comment on lines +15 to +17
CC=icx pip install -e . --no-build-isolation --no-deps \
-Csetup-args=-Dmkl_threading=gnu_thread
```

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Worth noting that the editable install rebuilds on import after a change to .c, .src or .pyx sources, so pytest and python need mkl_umath-dev active, with icx and ninja on PATH.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added in 3f6872c.

Comment thread .github/AGENTS.md
- `openssf-scorecard.yml` — security scanning
- `coverity.yml` — Coverity static analysis (see `coverity/README.md`)
- `openssf-scorecard.yml` — OpenSSF Scorecard
- `zizmor.yml` — GitHub Actions security lint

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The Policy section could list the conventions for editing workflows, which every workflow here already follows and zizmor checks: pin each action to a full commit SHA with a # vX.Y.Z comment, set least-privilege permissions, and use persist-credentials: false on checkouts.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added in 3f6872c.

Comment thread AGENTS.md
- Public API: `mkl_umath/__init__.py`, `mkl_umath/src/_patch_numpy.pyx`
- Tests: `mkl_umath/tests/`

For behavior policy, see `.github/copilot-instructions.md`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Following up on the earlier thread on copilot-instructions.md:22: four rules are still only in copilot-instructions.md, which Claude Code doesn't load. They are: never invent versions, compilers or CI values (:30), no hardcoded ISA assumptions (:33), no secrets in code or docs (:34), and performance must not compromise correctness (:47). That file also calls itself canonical (:8), while most guardrails now live here. Suggest moving those four into the guardrails above, so this file is the one list.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 3f6872c: all four are now in the root AGENTS.md guardrails.

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.

3 participants