Skip to content

Fix cross-process EXEC_* execution over the M162 socket transport - #17

Merged
rickenator merged 2 commits into
masterfrom
copilot/fix-exec-hook-issue
Jul 5, 2026
Merged

Fix cross-process EXEC_* execution over the M162 socket transport#17
rickenator merged 2 commits into
masterfrom
copilot/fix-exec-hook-issue

Conversation

Copilot AI commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

M166's exec hook resolves tensor operands via raw host pointers valid only in the process that issued them. Forwarding those pointers to a socket-backed att1-aimu-endpoint daemon's separate address space and dereferencing them there was undefined behavior (reproducibly crashed the daemon), so test_two_tile_decode_socket only ever exercised fabric/barrier traffic, standing in precomputed cpu-f32 values for real tile compute.

Client: forward real bytes, not pointers

  • src/aimu_endpoint_client.c: client_cmd_submit() copies the actual operand bytes for LOAD_TENSOR_TILE (f32), EXEC_MATMUL, EXEC_RMSNORM, EXEC_ROPE, EXEC_FFN into the wire request's existing payload field instead of forwarding input_buf_addr verbatim.
  • A small pending-transfer table (keyed by command_id, since dispatch happens asynchronously relative to submit) remembers where each result belongs; client_cmd_poll_completion() copies the daemon's real result bytes back into the caller's output buffer.
  • q8/q4 LOAD_TENSOR_TILE is rejected client-side with ATT1_ERR_UNSUPPORTED: those weight tensors are referenced by a struct pointer with its own nested owned buffers (and, for q4, a group_size the frozen v1.0 packet has nowhere to carry), so safe reconstruction needs wire-protocol changes beyond this fix.

Daemon: own the memory, rewrite the command

  • tools/att1-aimu-endpoint.c: new dispatch_cmd_submit() copies the payload into daemon-owned buffers and rewrites cmd.input_buf_addr/output_buf_addr to point at them before submitting, so the exec hook only ever dereferences memory valid in the daemon's own process. Client-visible addresses are restored in the echoed response so no daemon pointer leaks back.
  • dispatch_cmd_poll_completion() looks up the daemon-owned output buffer by command_id and returns the real result bytes in the response payload, then frees the buffers.
  • Same-address/mismatched-byte-count commands and result-size mismatches are rejected explicitly (ATT1_ERR_INVALID_ARG/ATT1_ERR_IO) rather than silently truncated.

Tests

  • tests/test_aimu_cluster_decode.c: test_two_tile_decode_socket now binds a real att1_backend_pcie to each socket-backed endpoint, mirroring the in-process test, and asserts the combined logits still match the cpu-f32 reference exactly — proving genuine cross-process EXEC_* execution rather than just fabric/barrier traffic.

Docs

  • docs/PHASE2_PLAN.md (M167 entry) and docs/OPERATION_LOG.md updated to record the fix and note the backend-comparison report's pcie column is separate, not-yet-implemented follow-up work (no pcie wiring in att1-bench today).

@rickenator
rickenator marked this pull request as ready for review July 5, 2026 03:59
@rickenator
rickenator merged commit 7981eba into master Jul 5, 2026
2 checks passed
@rickenator
rickenator deleted the copilot/fix-exec-hook-issue branch July 5, 2026 03:59
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.

2 participants