|
1 | 1 | # AGENTS.md - AI Agent Guide for DPCTL |
2 | 2 |
|
3 | | -## Overview |
| 3 | +## Purpose |
4 | 4 |
|
5 | | -**DPCTL** (Data Parallel Control) is a Python SYCL binding library for heterogeneous computing. It provides Python wrappers for SYCL runtime objects and implements the Python Array API standard for tensor operations. |
| 5 | +This file is the top-level entry point for AI agents working in `IntelPython/dpctl`. |
| 6 | +Use it to orient quickly, then follow directory-level `AGENTS.md` files for implementation details and local conventions. |
6 | 7 |
|
7 | | -- **License:** Apache 2.0 (see `LICENSE`) |
8 | | -- **Copyright:** Intel Corporation |
| 8 | +## Repository Scope |
9 | 9 |
|
10 | | -## Architecture |
| 10 | +DPCTL provides Python bindings for SYCL runtime objects and supporting infrastructure. |
11 | 11 |
|
12 | | -``` |
13 | | -Python API → Cython Bindings → C API → SYCL Runtime |
14 | | - dpctl/ _sycl_*.pyx libsyclinterface/ |
| 12 | +High-level stack: |
15 | 13 |
|
16 | | -dpctl.tensor → pybind11 → C++ Kernels (libtensor/) → SYCL Runtime |
| 14 | +``` |
| 15 | +Python API -> Cython Bindings -> C API (libsyclinterface) -> SYCL Runtime |
17 | 16 | ``` |
18 | 17 |
|
19 | | -## Directory Guide |
20 | | - |
21 | | -| Directory | AGENTS.md | Purpose | |
22 | | -|-----------|-----------|---------| |
23 | | -| `dpctl/` | [dpctl/AGENTS.md](dpctl/AGENTS.md) | Core SYCL bindings (Device, Queue, Context) | |
24 | | -| `dpctl/tensor/` | [dpctl/tensor/AGENTS.md](dpctl/tensor/AGENTS.md) | Array API tensor operations | |
25 | | -| `dpctl/tensor/libtensor/` | [dpctl/tensor/libtensor/AGENTS.md](dpctl/tensor/libtensor/AGENTS.md) | C++ SYCL kernels | |
26 | | -| `dpctl/memory/` | [dpctl/memory/AGENTS.md](dpctl/memory/AGENTS.md) | USM memory management | |
27 | | -| `dpctl/program/` | [dpctl/program/AGENTS.md](dpctl/program/AGENTS.md) | SYCL kernel compilation | |
28 | | -| `dpctl/utils/` | [dpctl/utils/AGENTS.md](dpctl/utils/AGENTS.md) | Utility functions | |
29 | | -| `dpctl/tests/` | [dpctl/tests/AGENTS.md](dpctl/tests/AGENTS.md) | Test suite | |
30 | | -| `libsyclinterface/` | [libsyclinterface/AGENTS.md](libsyclinterface/AGENTS.md) | C API layer | |
31 | | - |
32 | | -## Code Style |
33 | | - |
34 | | -Configuration files (do not hardcode versions - check these files): |
35 | | -- **Python/Cython:** `.pre-commit-config.yaml` |
36 | | -- **C/C++:** `.clang-format` |
37 | | -- **Linting:** `.flake8` |
| 18 | +## How to Work in This Repo |
38 | 19 |
|
39 | | -## License Header |
| 20 | +1. Identify the directory you are changing. |
| 21 | +2. Read the nearest `AGENTS.md` for that directory. |
| 22 | +3. Keep changes local and minimal; avoid unrelated refactors. |
| 23 | +4. Validate behavior with targeted tests before broad test runs. |
40 | 24 |
|
41 | | -All source files require Apache 2.0 header with Intel copyright. Reference existing files for exact format. |
| 25 | +## Directory Guide |
42 | 26 |
|
43 | | -## Quick Reference |
| 27 | +| Directory | Guide | Notes | |
| 28 | +|-----------|-------|-------| |
| 29 | +| `dpctl/` | `dpctl/AGENTS.md` | Core SYCL Python bindings and Cython patterns | |
| 30 | +| `dpctl/memory/` | `dpctl/memory/AGENTS.md` | USM memory model and ownership rules | |
| 31 | +| `dpctl/program/` | `dpctl/program/AGENTS.md` | Program/kernel compilation APIs | |
| 32 | +| `dpctl/utils/` | `dpctl/utils/AGENTS.md` | Queue and utility validation helpers | |
| 33 | +| `dpctl/tests/` | `dpctl/tests/AGENTS.md` | Test conventions and coverage expectations | |
| 34 | +| `libsyclinterface/` | `libsyclinterface/AGENTS.md` | C API contracts and ABI-safe patterns | |
44 | 35 |
|
45 | | -```python |
46 | | -import dpctl |
47 | | -import dpctl.tensor as dpt |
| 36 | +## Global Constraints |
48 | 37 |
|
49 | | -q = dpctl.SyclQueue("gpu") # Create queue |
50 | | -x = dpt.ones((100, 100), dtype="f4", sycl_queue=q) # Create array |
51 | | -np_array = dpt.asnumpy(x) # Transfer to host |
52 | | -``` |
| 38 | +- Match existing Apache 2.0 + Intel header style for source files. |
| 39 | +- Respect style tooling from `.pre-commit-config.yaml`, `.clang-format`, and `.flake8`. |
| 40 | +- Do not assume all devices support fp64/fp16. |
| 41 | +- Preserve queue/device compatibility checks and explicit error paths. |
| 42 | +- Keep memory/resource cleanup explicit and safe. |
53 | 43 |
|
54 | | -## Key Concepts |
| 44 | +## Notes on GitHub Copilot Instructions |
55 | 45 |
|
56 | | -- **Queue:** Execution context binding device + context |
57 | | -- **USM:** Unified Shared Memory (device/shared/host types) |
58 | | -- **Filter string:** Device selector syntax `"backend:device_type:num"` |
59 | | -- **Array API:** Python standard for array operations (https://data-apis.org/array-api/) |
| 46 | +Files under `.github/instructions/*.instructions.md` are entry points for Copilot behavior. |
| 47 | +They should stay concise and reference authoritative `AGENTS.md` files rather than duplicating full guidance. |
0 commit comments