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
8 changes: 4 additions & 4 deletions .claude/skills/multi-repo-qwen-setup/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ makespan** = the "kernel run time" layer.
For layers ②③④ — the host↔device and bind/validate spans — parse the
`[STRACE]` host-trace markers with `strace_timing.py` (landed in
[simpler #1177](https://github.com/hw-native-sys/simpler/pull/1177)). The
markers are emitted at `LOG_INFO_V9` under `SIMPLER_DFX` (no new flag),
markers are emitted at `LOG_TIMING` under `SIMPLER_DFX` (no new flag),
so the same log captured above carries them:

```bash
Expand Down Expand Up @@ -364,9 +364,9 @@ strings "$BD/$SO" | grep -m1 '<your-new-log-string>' # confirm it baked in

(`.venv/lib64` is a symlink to `lib`, so the `find` covers both.) AICPU device
logs land in `ASCEND_PROCESS_LOG_PATH/.../device-*/device-*.log` — set that var
per run (see `running-onboard`) and note AICPU `LOG_INFO_V*` uses **inverted**
verbosity: `v=9` is must-see (default threshold 5), `v=0` is filtered — use
`LOG_INFO_V9` for a diagnostic you need to read back.
per run (see `running-onboard`). Use `--log-level info` to capture `LOG_INFO`
diagnostics, or `--log-level debug` when the more detailed `LOG_DEBUG` stream is
also needed.

## Anti-patterns

Expand Down
9 changes: 4 additions & 5 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@
import time
import typing

# Make simpler's V0..V9 and NUL acceptable to pytest's `--log-level` validator.
# Make simpler's TIMING and NUL levels acceptable to pytest's `--log-level` validator.
# pytest does `int(getattr(logging, level.upper(), level))`, so the value must
# exist as a module attribute on `logging` (not just registered via
# `addLevelName`). Set both — the addLevelName side gives nice formatter output
# (`%(levelname)s` shows `V3` instead of `Level 18`); the setattr side is what
# (`%(levelname)s` shows `TIMING` instead of `Level 25`); the setattr side is what
# pytest's CLI parser actually consumes.
for _v in range(10):
logging.addLevelName(15 + _v, f"V{_v}")
setattr(logging, f"V{_v}", 15 + _v)
logging.addLevelName(25, "TIMING")
setattr(logging, "TIMING", 25)
logging.addLevelName(60, "NUL")
setattr(logging, "NUL", 60)
# `pytest --log-level null` upcases to "NULL" before the getattr lookup, so
Expand Down
6 changes: 3 additions & 3 deletions docs/chip-level-arch.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ runner.finalize();

```c
// libsimpler_log.so (RTLD_GLOBAL, loaded first by the Python wrapper):
simpler_log_init(log_level, log_info_v); // seed HostLogger once
simpler_log_init(log_level); // seed HostLogger once

// host_runtime.so (RTLD_LOCAL, loaded after):
DeviceContextHandle ctx = create_device_context();
Expand Down Expand Up @@ -181,13 +181,13 @@ Python test_*.py (SceneTestCase)
└─→ ChipWorker()
└─→ init(device_id, bins) # Python wrapper
├─→ ctypes.CDLL(libsimpler_log.so, RTLD_GLOBAL) # once per process
├─→ simpler_log_init(log_level, log_info_v) → HostLogger seeded
├─→ simpler_log_init(log_level) → HostLogger seeded
├─→ ctypes.CDLL(libcpu_sim_context.so, RTLD_GLOBAL) # sim only, once
└─→ _ChipWorker.init(host_path, aicpu_path, aicore_path, device_id) # C++
├─→ dlopen(host.so, RTLD_LOCAL) → resolve C API symbols via dlsym
├─→ create_device_context() → DeviceContextHandle
└─→ simpler_init(ctx, device_id, aicpu*, aicpu_size, aicore*, aicore_size)
├─→ (onboard) dlog_setlevel(HostLogger.level()) # before context open
├─→ (onboard) dlog_setlevel(HostLogger.cann_level()) # before context open
├─→ DeviceRunner::attach_current_thread(device_id)
│ ├─→ rtSetDevice(device_id) on onboard
│ └─→ pto_cpu_sim_bind+acquire on sim
Expand Down
2 changes: 1 addition & 1 deletion docs/dfx/device-phases.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ deployment can profile the two domains separately:
stores) — only whether the host re-emits the readback as markers.
* **Host** (`simpler_run` / `bind` / `runner_run` / `validate` spans): no new
knob — they ride the compile-time `SIMPLER_HOST_STRACE` macro and the log level
(`LOG_INFO_V9`), so raising the log threshold drops them.
(`LOG_TIMING`), so raising the log threshold drops them.

`RunWall` is the whole on-NPU wall (the former `RunTiming.device_wall`); it is
emitted as the `simpler_run.runner_run.device_wall` marker, not returned.
Expand Down
2 changes: 1 addition & 1 deletion docs/dfx/host-trace.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ children share.
`[STRACE]` rides on the compile-time `SIMPLER_HOST_STRACE` macro (default on, in
`src/common/task_interface/profiling_config.h` — separate from the
`SIMPLER_DFX` gate on the device Orch/Sched markers) and is emitted at
`LOG_INFO_V9` (the must-see INFO tier) — **no new env var or flag**. In a
`LOG_TIMING` (the default threshold) — **no new env var or flag**. In a
`SIMPLER_HOST_STRACE`-off build the RAII macros compile to nothing.

## Marker grammar
Expand Down
2 changes: 1 addition & 1 deletion docs/dfx/l2-swimlane-profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ in #942, a5 still uses the legacy unified shape:
output JSON for both. On a2a3 the orch stream replaces the per-sub-step
records folded into ORCH_SUBMIT; there is no separate shared-memory
aggregate. The run-window envelope is emitted to device log via
`LOG_INFO_V9 "orch_start=… orch_end=… orch_cost=…"`.
`LOG_INFO "orch_start=… orch_end=… orch_cost=…"`.

**Producer/consumer protocol on AICore (AICore-as-producer with rotation).**
AICore writes a slim `L2SwimlaneAicoreTaskRecord` into its currently-active per-core
Expand Down
12 changes: 9 additions & 3 deletions docs/dynamic-linking.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ because not all symbols may be referenced. Communicates with the runtime
through a function pointer table (`PTO2RuntimeOps`), not direct symbol
linkage.

`PTO2RuntimeOps` is a binary ABI without size or version negotiation.
Orchestration SOs and their runtime must therefore be built from the same
simpler revision. Changing the table's field count, order, or signatures
invalidates previously built orchestration SOs; cached or prebuilt artifacts
must be rebuilt before they are loaded by the updated runtime.

**File path collision**: all runtimes write the orch SO to
`/var/tmp/libdevice_orch_<PID>.so`. Safe in serial execution (each task
dlcloses before the next writes), but would conflict in parallel in-process
Expand Down Expand Up @@ -281,7 +287,7 @@ AICore receives only a device copy of that same `KernelArgs` payload.
```text
ChipWorker.init(device_id, bins) # Python wrapper
ctypes.CDLL(libsimpler_log.so, RTLD_GLOBAL) # once per process
simpler_log_init(log_level, log_info_v) seeds HostLogger before host_runtime
simpler_log_init(log_level) seeds HostLogger before host_runtime
ctypes.CDLL(libcpu_sim_context.so, RTLD_GLOBAL) # sim only, once per process
_ChipWorker.init(host_path, aicpu_path, aicore_path, device_id) # C++
dlopen(host_runtime.so, RTLD_LOCAL)
Expand Down Expand Up @@ -321,15 +327,15 @@ device_worker_main(device_id)
for each runtime_group:
ChipWorker.init(device_id, bins) # Python wrapper
ctypes.CDLL(libsimpler_log.so, RTLD_GLOBAL) # once per process
simpler_log_init(log_level, log_info_v)
simpler_log_init(log_level)
_ChipWorker.init(host_path, aicpu_path, aicore_path,
dispatcher_path, device_id) # C++
dlopen(host_runtime.so, RTLD_LOCAL)
create_device_context()
simpler_init(ctx, device_id,
aicpu*, aicpu_size, aicore*, aicore_size,
dispatcher*, dispatcher_size)
dlog_setlevel(HostLogger.level()) sync CANN dlog before context open
dlog_setlevel(HostLogger.cann_level()) sync CANN dlog before context open
DeviceRunner::attach_current_thread(device_id) rtSetDevice()
DeviceRunner::set_executors(aicpu, aicore)
DeviceRunner::set_dispatcher_binary(dispatcher)
Expand Down
6 changes: 3 additions & 3 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ Device logs written to `~/ascend/log/debug/device-<id>/`
Both host and AICPU kernel code use the unified `LOG_*` macros from
`common/unified_log.h`:

- `LOG_INFO_V0` .. `LOG_INFO_V9`: INFO with verbosity tier (V0 most verbose,
V9 most must-see, V5 default)
- `LOG_DEBUG`: Debug messages
- `LOG_INFO`: Lifecycle and summary messages
- `LOG_TIMING`: Stable timing markers such as `[STRACE]`
- `LOG_WARN`: Warnings
- `LOG_ERROR`: Error messages

Threshold is configured from Python via the `simpler` logger:
`logging.getLogger("simpler").setLevel(simpler.V3)`.
`logging.getLogger("simpler").setLevel(simpler.TIMING)`.
Loading
Loading