home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   sci.logic      Logic -- math, philosophy & computationa      262,912 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 261,467 of 262,912   
   Ross Finlayson to All   
   Re: Meta: a usenet server just for sci.m   
   29 Nov 25 03:54:06   
   
   [continued from previous message]   
      
   "MIX" or something like that, an abstract runtime, then with regards to   
   merely modeling the simplified features of the resource model and   
   topology and otherwise a test harness, with for example various notions   
   of re-using the declarative routine as according to C or a subset of C++   
   (with exceptions and about unwinding scope), then though that TTASL is   
   merely for TTASM as an assembler that result though assembly for other   
   assemblers, that TTASM is figured as more of a typing-and-templating   
   macro-assembler, that a sort of test-driven development is the idea,   
   while that the "concrete adapter" merely results as from reading models   
   of machine instruction in these what would be "small codes", then that   
   actual integration test or on the concrete adapter would be as to so   
   follow. About queues and as about buffers, any systolic system that has   
   buffers has that buffers have limits, with regards to for example the   
   notion of burst-buffers, and there's an ideal where much like a   
   re-routine has asynchrony on each function call, any connecting pins in   
   a circuit have a buffer between them, of size zero. Then, that's where   
   then the only way to prevent a jam thus loss is back-pressure, that   
   basically the producer and furthermore the entire production, needs get   
   throttled, as what may result shedding, that more voluminous producers   
   need make their own guarantees of buffering, or make for retries. About   
   networking, and the mux/demux (multiplexer/de-multiplexer) and thusly   
   about scatter-gather and about ports and packets then for zero-cope and   
   up to sendfile and channels and these types notions as for STREAMS, say,   
   mostly the idea is that DMA and scatter-gather then act as upon these   
   queues, sliques, and on the sideline "re-ordering and re-try holding",   
   these are usual concerns then with regards to usually enough limits and   
   error codes in user-land of POSIX, and distributing the load across the   
   cores.   
      
      
      
   Thanks RF. This is an excellent implementation strategy that prioritizes   
   verification before optimization and abstraction before concrete   
   hardware. Let me unpack the approach and its implications.   
      
   Implementation Strategy: Model-First, Hardware-Last   
   Phase 1: Abstract Machine Simulator (MIX-like)   
   You're proposing to build a software simulator of the architecture   
   before touching real hardware:   
   // Abstract machine state:   
   struct AbstractMachine {   
   // Generic register file (ISA-agnostic)   
   uint64_t regs[32]; // R0-R31   
   uint64_t vec_regs[32][8]; // V0-V31, 512-bit vectors   
      
   // Memory (flat address space)   
   uint8_t* memory;   
   size_t memory_size;   
      
   // Topology model (simplified)   
   struct {   
   uint32_t core_count;   
   uint32_t device_count;   
   uint32_t numa_nodes;   
   } topology;   
      
   // Slique structures   
   Slique* sliques[MAX_DEVICES];   
      
   // Re-routine executor state   
   RRContext rr_contexts[MAX_CORES];   
   };   
      
   // Instruction interpreter:   
   void execute_instruction(AbstractMachine* m, Instruction instr) {   
   switch (instr.opcode) {   
   case OP_MA: m->regs[instr.dst] = instr.imm64; break;   
   case OP_MR: m->regs[instr.dst] = m->regs[instr.src]; break;   
   case OP_AA: m->regs[instr.dst] =   
   m->regs[instr.src1] + m->regs[instr.src2]; break;   
   // ... all TTASL opcodes   
   }   
   }   
      
   Why this approach is correct:   
      
   Decouples algorithm from hardware: You can test re-routine semantics,   
   slique behavior, memo management without fighting cache coherence bugs   
   or NUMA latency.   
   Enables property-based testing: Generate random instruction sequences,   
   verify invariants (no memo leaks, M-ICC uniqueness, bounded slique depth).   
   Fast iteration: Compile C simulator, run tests in milliseconds vs.   
   booting QEMU kernel in seconds.   
   Deterministic replay: Seed the RNG, get identical execution every time.   
   Essential for debugging race conditions.   
      
   Tool precedent: This is how Chris Lattner developed LLVM (abstract IR   
   interpreter first), and how the seL4 verification team works   
   (Isabelle/HOL model before C implementation).   
   Phase 2: TTASM as Meta-Assembler   
   The key insight: TTASM is not a new assembler - it's a code generator   
   that emits GNU AS/NASM/LLVM-MCA input:   
      
   # TTASM pipeline:   
   source.ttasm → ttasm-compiler → output.s (GNU AS syntax)   
   → output.asm (NASM syntax)   
   → output.ll (LLVM IR)   
      
   # Example transformation:   
   # Input (TTASM):   
   MA R0, 0x1234   
   AA R0, R0, R1   
      
   # Output (GNU AS for x86-64):   
   movabs $0x1234, %rax   
   add %rbx, %rax   
      
   # Output (GNU AS for AArch64):   
   movz x0, #0x1234   
   add x0, x0, x1   
      
   Why this is the right choice:   
      
   Leverage existing tools: Don't reinvent instruction encoding,   
   relocation, linking. Let GNU binutils/LLVM do the hard work.   
   Cross-assembly validation: Compile same TTASM to x86/ARM/RISC-V, run all   
   three in simulators, verify identical semantic behavior (not identical   
   cycle counts, but identical outcomes).   
   Gradual refinement: Start with "dumb" translation (one TTASM op → one   
   native op), later optimize (pattern-match sequences, fuse instructions).   
      
   Implementation sketch:   
      
   # ttasm_compiler.py (simplified):   
   class TTASMCompiler:   
   def __init__(self, target_isa):   
   self.isa = target_isa # 'x86_64', 'aarch64', 'riscv64'   
   self.templates = load_templates(target_isa)   
      
   def compile_instruction(self, ttasm_instr):   
   opcode = ttasm_instr.opcode # e.g., 'MA'   
   operands = ttasm_instr.operands # e.g., ['R0', '0x1234']   
      
   template = self.templates[opcode] # ISA-specific   
   return template.format(*operands)   
      
   # templates/x86_64.json:   
   {   
   "MA": "movabs ${imm}, %{dst}",   
   "AA": "add %{src2}, %{dst}",   
   ...   
   }   
      
   Phase 3: Test-Driven Development Harness   
   The "test harness" becomes the primary development artifact:   
      
   // test_reroutine.c   
   void test_tcp_connect_success() {   
   AbstractMachine m = init_machine();   
      
   // Set up mock device (simulated NIC)   
   MockDevice* nic = mock_device_create(DEVICE_TYPE_NIC);   
   mock_device_program_response(nic, TCP_SYN_ACK, 100); // Respond after   
   100 cycles   
      
   // Submit re-routine   
   MICC micc = vend_micc(&m);   
   ReRoutine rr = {   
   .func = tcp_connect_reroutine,   
   .args = {.host = 0x7F000001, .port = 80},   
   .micc = micc,   
   .memo = alloc_memo(FSM_TCP_CONNECT)   
   };   
      
   // Execute until completion   
   int cycles = 0;   
   while (rr.state != RR_COMPLETE && cycles < MAX_CYCLES) {   
   execute_one_cycle(&m, &rr);   
   cycles++;   
   }   
      
   // Verify   
   assert(rr.state == RR_COMPLETE);   
   assert(memo_get(rr.memo, STEP_SOCKET) != NULL);   
   assert(cycles <= EXPECTED_LATENCY);   
      
   printf("✓ TCP connect succeeded in %d cycles\n", cycles);   
   }   
      
   Why TDD matters here:   
      
   Re-routines are state machines: Each test specifies initial state,   
   sequence of memo fills, expected final state. Easy to enumerate all paths.   
   Trace segments as test oracle: After each test, query trace database:   
   "Did we emit exactly N segments? Were states correct?"   
   Regression safety: As you add optimizations (vectorization, loop   
   unrolling), tests ensure semantic equivalence.   
      
   Test categories:   
      
   Unit tests: Individual re-routines in isolation   
   Integration tests: Chains of re-routines (http_get → tcp_connect → socket)   
   Property tests: Fuzz inputs, verify invariants (no memo leaks, M-ICC   
   monotonicity)   
   Performance tests: Cycle-accurate simulation, verify O(1) bounds   
      
   Phase 4: Concrete Adapter (Hardware Binding)   
   Only after the abstract model is solid do you write the hardware shims:   
      
   // abstract_nic.h (simulator interface)   
   typedef struct {   
   void (*send_packet)(Packet p);   
   Packet (*recv_packet)(void);   
   } NICOps;   
      
   // concrete_i225.c (Intel I225 driver)   
   NICOps i225_ops = {   
   .send_packet = i225_tx_submit,   
   .recv_packet = i225_rx_poll   
   };   
      
   void i225_tx_submit(Packet p) {   
   // Write to actual MMIO registers   
      
   [continued in next message]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca