PXL
Repository layout

PXL 3 (libpxl.so, pxl::pxl) and PXL 4 (libpxl4.so, pxl4::pxl) build from one CMake project. The code, tests and build files both clients use sit in the top-level directories (src/, tests/, cmake/, tool/, bindings/python/src/); each client's own files sit in a v3/ or v4/ subdirectory of the directory they belong to (src/v3, include/v3/pxl, tests/v3, bindings/python/v3, tool/v3, cmake/v3, packaging/v3, docs/v3, and the same under v4/). A path is either shared or a client's, never both; the rules are in `src/README.md`. PXL 4's own documentation is in `docs/v4/`.

A plain build is PXL 3's, with the builds, packages and SDK paths it always had, except that its public headers are now include/v3/pxl/ in the tree. -DPXL_BUILD_V4=ON adds PXL 4 to the same build, and -DPXL_BUILD_V3=OFF -DPXL_BUILD_V4=ON (or the debug-v4 and release-v4 presets) builds PXL 4 alone. PXL 4's targets carry a pxl4 name (pxl4, pxl4_test, pxl4_cli); what either client installs is unchanged.

Most of src/v3/ still has a counterpart in src/v4/, and the two copies drift apart unless a fix to one is checked against the other: a pull request says whether the counterpart has the fix, does not need it, or is left to a follow-up. Commits that change PXL 4 name the area in their scope, as in fix(v4/resource): .... In the history imported with PXL 4, a (#NN) at the end of a commit subject is a pull request of the former pxl-v4 repository, not of this one.

./install.sh installs PXL 3; ./install.sh -v 4 installs PXL 4 as libpxl4, built in build-v4/, and -v all installs both, which share no files. libpxl4 carries no daemon: the host's pxl_resourced comes with PXL 3 and serves PXL 3 (protocol 3) and PXL 4 (protocol 5) applications alike. On a host with a pre-rename PXL 4 libpxl 4.x, whose libpxl.so the PXL 4 applications built before the rename link, -v all stops without changing anything; -v 3 replaces that package. PXL 3's own 4.0.0 builds, told apart by the pxl/context.hpp they install, are upgraded as usual.

Where the Python bindings install is decided when CMake configures, from CMAKE_INSTALL_PREFIX. Configured with a prefix of your own, cmake --install puts them under that prefix, in lib/python3.X/site-packages (lib64/... on some distributions), for PYTHONPATH to name. /usr, /usr/local and the packages install.sh builds keep the interpreter's own site-packages. So choose the prefix at configure time: cmake --install --prefix <dir> on a build configured for /usr or /usr/local moves the libraries but still writes the bindings to the interpreter's site-packages. -DPXL_PYTHON_SYSTEM_SITE=AUTO|ON|OFF (AUTO, the default, follows the prefix on every configure) or -DPXL_PYTHON_INSTALL_DIR=<dir> (absolute, or relative to the prefix) choose otherwise.

The libraries themselves follow their install: moved after cmake --install, or installed with cmake --install --prefix somewhere other than the prefix they were configured for, libpxl and libpxl4 take the builtin kernels (lib/pxl/, lib/pxl4/) and compatibility.json (share/pxl/, share/pxl4/) beside the library they were loaded from, and those at the configured prefix only when these are missing.

Overview

Parallel Xceleration Library (PXL) is a key component of XCENA SDK designed to facilitate optimized communication between host system and XCENA computational memory devices.
By leveraging PXL, developers can unlock the full potential of in-memory computing technology through a robust and efficient API.

PXL exposes a unified public API under the pxl:: namespace, organized into the following functional areas:

  • Execution: Context, Stream, Job, Map, NDArray — manages execution sessions, async task scheduling, and host-device memory mapping.
  • Kernel: Module, Function, KernelTraits — loads compiled kernel binaries and binds callable functions.
  • Memory: allocateMemory, reallocateMemory, releaseMemory, pinMemory, prefetchMemory, etc. — manages device memory with optional flags.
  • Launch: Launcher, LaunchBuilder, LaunchResult — high-level kernel launch API with automatic device detection.
  • Configuration: enableLog, registerSignalHandler — logging and crash reporting.
  • Host cache: three calls that move data across the host/device boundary by hand. Full contracts, including which one a signal handler may call and on which platform, are in pxl/config.hpp.
    • flushHostCache — publish host writes to the device, and record the range as a transfer-size hint for a later Map::execute.
    • flushHostCacheUntracked — publish without the record.
    • invalidateHostCache — read back what the device wrote.

Resource history across restarts

This policy applies to legacy (non-coordinator) resource-manager mode. On a coordinator host, pxl_resourced is conditioned off and pxltop reads coordinator status instead of this history.

/tmp/pxl/history.log describes one resource-manager run, not an archive across restarts. Only a root daemon that has bound the resource-manager socket, with a usable /tmp/pxl, publishes a fresh file, once the bind succeeds. Its inode changes and previous records are not carried over; no .prev backup is created. A second daemon that fails to bind leaves the running daemon's history in place. A root in-process fallback manager writes no history, so pxltop does not show its activity. Non-root operation, an unusable directory, or a publication/write failure can disable history logging without stopping the service, so a running service alone does not guarantee a new history. The one exception: if the daemon can neither replace nor remove the previous daemon's authority, or publication is interrupted by an exception, it exits with a failure before serving any request, so the previous history is never left certified for the new run. A non-file entry such as a directory in place of the authority cannot carry a proof, so it only disables history logging.

pxltop reads resource events and notices inode replacement. Current XPTI history readers additionally validate a root-owned authority sidecar with mode 0600. This validation requires permission to read that sidecar (normally root); reading the public history alone is not enough to establish authoritative scope. Publishing new paths does not fence another manager or revoke its already-open writer lock.

For a root daemon configured to publish history, a restart check should verify successful restart and a fresh readable history with a new inode. This checks log reset only; it does not prove that a writer is still active or that XPTI considers its scope authoritative. Those are separate profiling checks. Do not require an unchanged inode, a nondecreasing size, or previous-run preservation. Inspect journalctl -u pxl_resourced for service restart diagnostics and archive required incident evidence before a manual restart. The packaged service uses Restart=on-failure, so an automatic restart can replace history before an operator can collect it. Use an external collector if records must survive an unattended restart. Formats vary by SDK version.

Generate API Docs

  1. Prerequisite
    Doxygen >= 1.9.1
    Graphviz >= 2.43.0
  2. Run DoxyGen
    cd docs/v3
    doxygen Doxyfile

Language Support

Currently, PXL is provided as a C++ API. In the future, support for additional programming languages will be introduced to accommodate a broader range of development environments and preferences.

Migrating from PXL 2.x

PXL 3.0 flattened the public API into a single pxl:: namespace. The pxl/compat.hpp header forwards the old names to the new ones with [[deprecated]] warnings. Scheduled for removal in a future release.

Updating to PXL 3.0.1

PXL 3.0.1 requires XPTI 1.6.0 or later within the 1.6 ABI series. Update both SDK libraries together, then rebuild applications against the updated SDK. The PXL patch version does not imply binary compatibility with PXL 3.0.0: profiling containers and stage builders use the XPTI v1_6 ABI tags. Binaries built against the 1.5 ABI must be rebuilt; they cannot use the new stage builders. The original PXL SONAME remains libpxl.so; XPTI uses libxpti.so.1.6.

The XPTI 1.6 build uses package release 2: libpxl is 3.0.1-2 in DEB and version 3.0.1, release 2 in RPM. This sorts after the earlier 3.0.1 / 3.0.1-1 packages built for XPTI 1.5, so package upgrades replace the library. PXL_VERSION_SUFFIX is still preserved before the package release. This packaging revision keeps the PXL API version and SONAME unchanged; upgrade libpxl and libxpti together and rebuild their application consumers.

XPTI 1.6 also changes profiling exports. Automatic CSV output and Map::exportProfiling(path, xpti::ExportFormat::Csv) / exportProfilingCsv() now write named catalog results, such as profile.host_event_count_dev0_*.csv, instead of the former HostEvents_*.csv raw tables; a catalog with no data writes no file. Update scripts that consume those files. For the advanced xpti::Profile API, replace whole-session exportCsv(path) with exportCsv(path, catalog_id, params). MetricsRaw* queries report raw_metric_history_not_collected; MetricsStats* queries remain available. These export changes do not remove the PXL profiling controls.

The internal PXL 4.0.0 build is replaced by 3.0.1. Use the SDK's install.sh to replace the library pair; it explicitly installs the generated packages. An APT deployment must explicitly select the 3.0.1-2 package version and permit the downgrade when using -y (--allow-downgrades). Applications linked to the internal libpxl.so.4 must also be rebuilt; do not alias that SONAME to libpxl.so.

If 4.0.0 was installed without packages (cmake --install or an install preset), stop applications using that SDK and remove the leftover libpxl.so.4 and libpxl.so.4.0.0 from that installation's lib directory before installing 3.0.1. Check file ownership first; do not manually remove package-owned libraries. Otherwise an old application may still load 4.0.0 and report Unknown PXL version (4.0.0) or Firmware version mismatch against the new compatibility table, even when the firmware is unchanged.

pxl_resourced resets every Sub at startup

When pxl_resourced takes on a single-host device, at startup or when the device appears later, it resets every Sub of that device before it hands any out. A Sub the firmware still holds in a reset, for example after the previous daemon stopped mid-reset, otherwise drops every admin request (Sub: Admin task timeout) while it looks free.

  • Subs whose reset completes return to the pool. The rest are quarantined, and return once the device finishes their reset.
  • If no Sub prepares, starts, or takes over a reset within the phase limit, the Subs return to the pool without a reset and the daemon logs an error. This includes a silent reset channel and immediate errors for every PrepareReset. A takeover awaiting its original prepare remains protected. A Sub whose prepare completes later is taken back and reset before it is handed out again; a client that already got it fails its first job.
  • A second pxl_resourced started while one is serving does not touch the device: the reset starts only after the daemon owns its socket.
  • AllocSub and AllocSubForce requests that arrive meanwhile wait for the reset instead of failing. A device takes well under a second; one whose Subs do not answer takes up to two 10 s phase limits. Devices reset in parallel.
  • Restarting or upgrading pxl_resourced resets the Subs of applications that are still running, since the new daemon does not know them. Stop those applications first.
  • A device several hosts share runs in coordinator mode (pxl-coordinator-setup), where pxl_resourced does not run. The legacy PXL_MULTIHOST_MODE is no longer supported. When it is set to anything but empty or local, including auto and misspelled values that used to fall back to single-host use, pxl_resourced refuses to serve: it logs why (journalctl -u pxl_resourced), then keeps its socket and closes every connection, so applications fail to start rather than open the device themselves. An application whose own environment sets the variable fails the same way when no daemon is reachable.
  • Before upgrading, remove the variable from the daemon and from applications. The retired setup guide put it, with PXL_MULTIHOST_SLOT (no longer read either), in /etc/systemd/system/pxl_resourced.service.d/multihost.conf: delete that file, run systemctl daemon-reload, and restart pxl_resourced. If other hosts share the device, move it to coordinator mode first: a host that drops the variable while a peer still runs a legacy multi-host daemon hands out the same Subs and CXL as that peer.

Deploy this daemon update before firmware that starts replying immediately with ResetError to unsupported PrepareReset requests. No new error detail is required: the startup decision checks reset progress, rather than interpreting every ResetError as unsupported.

The shared daemon provides this reset behavior to both PXL 3 and PXL 4 apps. PXL 4's separate in-process fallback still uses its own reset implementation; porting takeover recovery to that fallback is left to a follow-up. Run the shared daemon when that recovery is needed.

To skip the reset, for example on emulation where a reset takes longer than the phase limit, set PXL_RESET_SUBS_AT_START=0 in the daemon's environment. The systemd unit does not read your shell environment, so use a drop-in:

sudo systemctl edit pxl_resourced # add: [Service]
# Environment=PXL_RESET_SUBS_AT_START=0
sudo systemctl restart pxl_resourced

When the daemon runs as a container's entrypoint, pass the variable to the container instead.

Selecting the client API major

PXL_SELECTED_API_MAJOR is a compile-time contract between a consumer and the PXL headers. Linking the CMake target pxl::pxl supplies the integer value 3. Every installed PXL 3 header rejects a defined value other than 3; leaving the macro undefined preserves existing builds. A build that links a library file directly, or uses another build system, can opt in with -DPXL_SELECTED_API_MAJOR=3 on each translation unit using PXL headers.

The separate PXL 4 client must export the same macro with value 4 from its pxl4::pxl target and reject other selected majors in its own headers. Its include root is include/pxl4, so both clients use <pxl/...> and pxl::Job in application code while selecting one API major per target. That PXL 4 packaging change is separate from this PXL 3 guard.

CMake also refuses a target that links pxl::pxl and another API major's target. Both targets take part: each sets INTERFACE_PXL_API_MAJOR to its major (pxl4::pxl sets 4) and appends PXL_API_MAJOR to COMPATIBLE_INTERFACE_STRING. A target without that property is not compared, so a PXL 3 install made before the property existed (an earlier 3.0.1 among them) is not refused beside PXL 4, and nothing of this reaches a build that does not use these CMake targets (a raw -lpxl, pkg-config or another build system): there the macro above is the only guard.

Keep the guard filenames specific to their major, such as pxl/v3_api_guard.hpp: when both include roots are present, a common pxl/api_guard.hpp could resolve to the other client's guard and accept the wrong header. This check requires updated headers and an explicitly selected major; it does not check prebuilt binaries or the libraries loaded at runtime.