Repository navigation
Add AGENTS.md and issue templates #2402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ndgrigorian
wants to merge
2
commits into
master
Choose a base branch
from
agentify-dpctl
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+212
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: Bug report | ||
| description: Report incorrect behavior, a crash, or a build failure | ||
| labels: ["bug"] | ||
| body: | ||
| - type: textarea | ||
| id: description | ||
| attributes: | ||
| label: Description | ||
| description: What happened, and what did you expect? | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: reproducer | ||
| attributes: | ||
| label: Reproducer | ||
| description: Minimal code or commands that trigger the problem. | ||
| render: python | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: output | ||
| attributes: | ||
| label: Output | ||
| description: Full traceback or error output. Run with `DPCTL_VERBOSITY=warning` for C API diagnostics. | ||
| render: shell | ||
| - type: input | ||
| id: version | ||
| attributes: | ||
| label: dpctl version | ||
| description: Output of `python -c "import dpctl; print(dpctl.__version__)"` | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: devices | ||
| attributes: | ||
| label: Devices | ||
| description: Output of `python -m dpctl -f` | ||
| render: shell | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: environment | ||
| attributes: | ||
| label: Environment | ||
| description: OS, Python version (and whether free-threaded), how dpctl was installed (conda/pip/source), DPC++ compiler version if built from source. | ||
| validations: | ||
| required: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| blank_issues_enabled: true | ||
| contact_links: | ||
| - name: Questions and discussions | ||
| url: https://github.com/IntelPython/dpctl/discussions | ||
| about: Ask usage questions here. | ||
| - name: Security vulnerabilities | ||
| url: https://github.com/IntelPython/dpctl/blob/master/SECURITY.md | ||
| about: Report security issues privately, not as public issues. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| name: Feature request | ||
| description: Propose new SYCL functionality or an API change | ||
| labels: ["enhancement"] | ||
| body: | ||
| - type: textarea | ||
| id: motivation | ||
| attributes: | ||
| label: Motivation | ||
| description: What do you need to do that dpctl does not support today? | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: proposal | ||
| attributes: | ||
| label: Proposed API | ||
| description: Python, Cython, or C API you would like, and the SYCL feature it maps to. | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: alternatives | ||
| attributes: | ||
| label: Alternatives considered |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| # AGENTS.md | ||
|
|
||
| dpctl is a Python/Cython wrapper over a subset of SYCL, built on a C API | ||
| library (`libsyclinterface`). It is compiled with Intel oneAPI DPC++ (`icx`/`icpx`). | ||
|
|
||
| ## Environment | ||
|
|
||
| - Activate the compiler before building or testing: `source /opt/intel/oneapi/setvars.sh` | ||
| (or use a conda env with `dpcpp_linux-64`). The environment does not persist | ||
| between shell invocations; source it in the same command: | ||
| `source /opt/intel/oneapi/setvars.sh && python -m pytest dpctl/tests/...`. | ||
| - Check visible devices: `sycl-ls`. Tests skip on missing devices/aspects; a CPU | ||
| OpenCL device is enough for most of the suite. | ||
| - Python build deps: `pip install numpy cython scikit-build cmake ninja pytest "versioneer[toml]==0.29"`. | ||
|
|
||
| ## Commands | ||
|
|
||
| - Build in place + editable install: `python scripts/build_locally.py --verbose` | ||
| - defaults to `icx`/`icpx` on `PATH`; other compilers need `--compiler-root` | ||
| - `--debug`, `--clean`, `--target-cuda[=sm_XX]`, `--target-hip=<arch>`, | ||
| `--cmake-opts="-D..."` | ||
| - Python tests: `python -m pytest dpctl/tests` | ||
| - one file: `python -m pytest dpctl/tests/test_sycl_queue.py` | ||
| - one test: `python -m pytest dpctl/tests/test_sycl_queue_memset.py::test_memset_partial_count` | ||
| - without a C compiler/Cython: add `-k "not test_cython_api and not test_c_headers"` | ||
| - C API tests (GoogleTest, needs `GTEST_ROOT`): `(cd libsyclinterface && bash dbg_build.sh)` | ||
| - Coverage (C + Python, rebuilds with `-DDPCTL_BUILD_CAPI_TESTS=ON`): | ||
| `python scripts/gen_coverage.py --oneapi` | ||
| - Docs (needs doxyrest): `python scripts/gen_docs.py --doxyrest-root=<path>` | ||
| - Lint/format one file (no build needed): `pre-commit run --files <path>` | ||
| - Lint/format everything: `pre-commit run --all-files` | ||
| (black, isort, flake8, cython-lint, clang-format, codespell, bandit, shellcheck, | ||
| gitleaks, actionlint). Config: `pyproject.toml`, `.flake8`, `.clang-format`. | ||
|
|
||
| ## Structure | ||
|
|
||
| - `libsyclinterface/` — C API over SYCL (C++ implementation) | ||
| - `include/syclinterface/*.h` — public C headers, `DPCTL<Type>_<Op>` functions | ||
| - `source/*.cpp` — implementations | ||
| - `tests/*.cpp` — GoogleTest suite; `*.spv` are prebuilt kernel fixtures | ||
| - `dpctl/` — Python package | ||
| - `_backend.pxd` — Cython `extern` declarations of the C API | ||
| - `_sycl_*.pyx/.pxd` — `SyclDevice`, `SyclQueue`, `SyclContext`, `SyclEvent`, ... | ||
| - `memory/` — USM memory objects (`MemoryUSMDevice`, ...), IPC memory | ||
| - `compiler/` — `SyclKernelBundle` creation (SPIR-V, SYCL source) | ||
| - `program/` — deprecated alias of `dpctl.compiler` | ||
| - `utils/` — order manager, device queries, Intel device info | ||
| - `apis/include/` — Python C-API headers for extensions (`dpctl_capi.h`, `dpctl4pybind11.hpp`) | ||
| - `tests/` — pytest suite; `tests/helper/` has `get_queue_or_skip` and friends | ||
| - `examples/` — python, cython, pybind11, c extension examples (each with README) | ||
| - `docs/doc_sources/` — Sphinx sources | ||
| - `conda-recipe/`, `conda-recipe-cf/` — conda packaging used by CI | ||
| - `scripts/` — build, coverage, docs drivers | ||
|
|
||
| ## Adding a SYCL feature (typical PR shape) | ||
|
|
||
| 1. Declare in `libsyclinterface/include/syclinterface/dpctl_sycl_<x>_interface.h` | ||
| with a Doxygen comment and ownership attributes. | ||
| 2. Implement in `libsyclinterface/source/dpctl_sycl_<x>_interface.cpp`. | ||
| 3. Add GoogleTest cases in `libsyclinterface/tests/test_sycl_<x>_interface.cpp`. | ||
| 4. Declare in `dpctl/_backend.pxd`; wrap in `dpctl/_sycl_<x>.pyx` (and `.pxd` if | ||
| the method is `cdef`). | ||
| 5. Add pytest coverage in `dpctl/tests/`. | ||
| 6. Add a `CHANGELOG.md` entry with the PR link. | ||
|
|
||
| Reference PRs to copy from: | ||
| - New queue operation: gh-2361 (`DPCTLQueue_Memset` → `SyclQueue.memset`, | ||
| `dpctl/tests/test_sycl_queue_memset.py`). | ||
| - New device info query: gh-2324 (`dpctl_sycl_device_interface.h` → | ||
| `dpctl/_sycl_device.pyx`; register the check in | ||
| `dpctl/tests/_device_attributes_checks.py`). New enums go through | ||
| `dpctl_sycl_enum_types.h`, `libsyclinterface/helper/`, and `dpctl/enum_types.py`. | ||
|
|
||
| ## Conventions | ||
|
|
||
| ### C API | ||
| - Opaque refs (`DPCTLSyclQueueRef`, ...) via `wrap<T>`/`unwrap<T>` | ||
| (`dpctl_sycl_type_casters.hpp`). | ||
| - Annotate ownership: `__dpctl_give` (caller must delete), `__dpctl_take` | ||
| (callee consumes), `__dpctl_keep` (borrowed). See `Support/MemOwnershipAttrs.h`. | ||
| - Never let a C++ exception cross the C boundary: catch, call | ||
| `error_handler(e, __FILE__, __func__, __LINE__)`, return `nullptr`/error value. | ||
| - Null-check every incoming ref and report via `error_handler`. | ||
| - Errors are silent unless `DPCTL_VERBOSITY=warning` (or `error`) is set; set it | ||
| when debugging a `nullptr` return. | ||
|
|
||
| ### Cython / Python | ||
| - Release the GIL (`with nogil:`) around calls that may block on the device. | ||
| - Python-visible errors: raise specific exceptions (`TypeError`, `ValueError`, | ||
| `SyclQueueCreationError`, ...) when the C API returns `NULL`. | ||
| - Free-threaded CPython (3.14t) is supported; do not rely on the GIL for | ||
| thread safety of shared state. | ||
| - Line length 80 (black, isort, cython-lint, clang-format). | ||
|
|
||
| ### Tests | ||
| - Get devices with `get_queue_or_skip()` / skip on missing aspects; never assume | ||
| a GPU or fp64 support. | ||
| - Test both sync and `*_async` variants when adding queue operations. | ||
|
|
||
| ### Files | ||
| - New files need the Apache-2.0 license header from `CONTRIBUTING.md` | ||
| (C/C++ headers also need the `\file` Doxygen block). | ||
| - Comments and docstrings: short, describe what the code does. | ||
|
|
||
| ## Git | ||
|
|
||
| - Branch off `master`; pre-commit blocks commits directly to `master` and | ||
| `maintenance/*`. | ||
| - One concern per PR; fill in `.github/pull_request_template.md`. | ||
| - Update `CHANGELOG.md` (Keep a Changelog sections: Added, Changed, Deprecated, | ||
| Removed, Fixed, Maintenance) for user-visible changes, citing `gh-NNNN`. | ||
|
|
||
| ## Boundaries | ||
|
|
||
| - Generated, do not edit: `dpctl/*.cxx`, `dpctl/**/*.cxx`, `dpctl/include/` | ||
| (headers copied/generated at build time), `dpctl/_version.py` (versioneer), | ||
| `_skbuild/`, `build/`. | ||
| - Edit C headers in `libsyclinterface/include/`, not their copies under `dpctl/include/`. | ||
| - In-place `.so` files survive branch switches; rebuild (`--clean`) before | ||
| trusting test results after checking out another branch. | ||
| - Changing an existing C API signature or enum value is a breaking change: | ||
| call it out in the PR and the CHANGELOG `NOTE` list. | ||
| - `.github/workflows/` actions are pinned to commit SHAs (checked by zizmor); | ||
| keep that when adding steps. | ||
| - `conda-recipe*/`, release versions, and doc version lists need maintainer review. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.