Skip to content

Implement VECTOR/CUBE first-use task context after EXTCTX ABI is fixed #32

Open

Description

@zhoubot

Scope

Implement the Linux side of the unreleased LinxISA v0.58 VECTOR/CUBE first-use contract once the architectural cross-ACR context ABI is complete.

Evidence

Audited against:

  • root superproject PR #181 head 3c2ca6ef
  • Linux 1055a743f16eaebfc371e0aabec8c861ab44858f / tree e6f3593f698db1de6bff8f9a43dc9007c237f21b
  • LLVM b7c83f68bf84125e696a70bec4b665c70a3b584d
  • QEMU PR #74 evidence head bbe090a8956bf2dce443c907e5118212d7c8768d
  • r7 evidence /private/tmp/linx-pto-cube-system-181-r7/evidence

The r7 CUBE failure is not a first-use exception. QEMU observed ACR2 ECONFIG=0x7, CUBE kind 1, prepared=0, then delivered an ordinary illegal-instruction trap (trapno=0x8000000000000000, no ARGV/cause 4).

Current Linux gap

Linux 1055 defines the V/C bit constants but does not implement the contract:

  • arch/linx/kernel/head.S writes zero to SSR_ECONFIG during boot.
  • There are no TIF_VECTOR / TIF_CUBE used flags.
  • There is no independent LIVE/resident state for NEVER_USED, SAVED_NOT_RESTORED, and LIVE.
  • do_trap_insn_exception() treats E_INST/EC_PERM(4) as a page-fault-style permission exception; it does not recognize the full E=1,ARGV=1,TRAPNUM=0,CAUSE=4,TRAPARG0={0,1},BI=0 signature.
  • switch_to() has no extension save/restore or per-task ECONFIG rewrite.
  • fork, exec, exit, migration, and allocation-failure behavior are undefined.

V/C must remain disabled until a real handler and context ABI exist; merely enabling them would convert legal user VECTOR/CUBE headers into unserviceable traps.

Architectural prerequisites

Blocked on LinxISA issue (cross-link after creation) defining:

  1. exact VECTOR and CUBE context blob size, alignment, version, reset image, and field coverage;
  2. an ACR1 operation that saves/restores the managed ACR2 task context, not the currently executing ACR1 context;
  3. inclusion of all task-owned state, including queues/block progress and any CUBE accumulator or extension-owned state;
  4. save/restore failure, restart, migration, and forward-progress rules.

The current QEMU bring-up ESAVE/ERCOV implementation transfers a 64-byte LB/LC blob for the currently executing ACR. That is insufficient for an architecture-correct ACR1 Linux scheduler implementation.

Linux acceptance criteria

  • Allocate each context only on first use.
  • Track used and resident/loaded state independently for VECTOR and CUBE.
  • Recognize only the complete first-use trap signature.
  • Initialize or restore the selected context, clear only its V/C bit, and retry the original block header.
  • On switch-out, save only used+LIVE contexts; use a defined immediate or lazy restore policy on switch-in.
  • Rewrite V/C for the next task before every ACR2 return.
  • Correct fork/clone, exec, exit, CPU migration, and allocation failure semantics.
  • Add focused trap-envelope/state-machine tests plus a two-task QEMU runtime test proving isolation and retry.

Activity

  1. zhoubot commented on Aug 23, 2026

    @zhoubot
    CollaboratorAuthor

    Architectural prerequisite filed as LinxISA/linx-isa#182: LinxISA/linx-isa#182

  2. zhoubot commented on Aug 23, 2026

    @zhoubot
    CollaboratorAuthor

    r8 diagnostic rerun confirms this issue is not the current CUBE failure. At the exact failing header, QEMU logged LINX_FIRST_USE_TRACE with acr=2, kind=1, econfig=0x7, prepared=0; accepted the CUBE header; collected three mathematical sources and a 4 KiB FP32 output; then failed later in CUBE execution and delivered an ordinary illegal instruction. Evidence log SHA-256: a573eba8b130cced128528e41af0ec38d803ede495207974650da36ae43e26ab. Linux V/C remains safely disabled pending LinxISA/linx-isa#182.

  3. zhoubot commented on Aug 23, 2026

    @zhoubot
    CollaboratorAuthor

    Exact r13 sequential PTO CUBE context-switch diagnostic: children 1-2 PASS, child 3 starts but does not return within 1200s, with no user trap or explicit FAIL. Pins: pto-kernels 5f5cf061, TileOP bd1ecca9, LLVM b7c83f68, QEMU 2ba240fd, Linux 1055a74. Evidence is /private/tmp/linx-pto-cube-system-181-r13/evidence/{summary.json,qemu.log}.

    A cold-boot-per-case release matrix is being added to prove each workload independently; this issue should retain the sequential cross-process Tile context/state leakage as a separate Linux scheduling/context-management blocker.

  4. zhoubot commented on Aug 23, 2026

    @zhoubot
    CollaboratorAuthor

    Fresh-boot split confirms workload/QEMU CUBE semantics independently: exact cold-boot matrix PASS 6/6, consistent provenance and clean shutdown for every case. Aggregate /private/tmp/linx-pto-cube-system-181-r14-matrix/aggregate_summary.json, SHA-256 8270839ea5b8f804d6cc23a429e0cc11a6edea22fa4a611241986081e69738b7.

    This strengthens the classification of r13: the remaining failure is specifically sequential cross-process Tile context/state handling, not any individual CUBE workload semantic failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions