scratchv_dag/: standalone LLVM-style SelectionDAG infrastructure packagesdnode.py: SDNode, SDValue, MVT, SelectionDAG containerselection_dag.py: DAGBuilder, DAGCombiner, DAGScheduler pipelinecache.py: 4 MB L1 cache simulator (set-associative, LRU, write-back)allocator.py: Buddy-system memory allocator with cache-line alignment and scratchpad
docs/developer_guide.md: guide for extending ScratchV with new ops and passesMakefile: standard dev targets (install, test, clean, lint, docs)CHANGELOG.md,CONTRIBUTING.md: project metadata filespyproject.toml: classifiers, readme field, license field
- Consolidated
scratchv/codegen/andscratchv/memory/into re-export shims overscratchv_dag/ - Python requirement lowered to 3.8 with full compatibility fixes
pyproject.tomlversion bumped to 0.3.0.gitignoreextended for.llfiles and.claude/
- LLVM IR backend (
llvm_codegen.py) - Advanced optimizations: peephole, muladd fusion, LICM
- Verification framework: ONNX Runtime comparison, numpy reference, DSL interpreter
- TinyFive adapter for assembly verification and profiling
- CLI options:
--backend,--optimize,--verify,--reg-alloc - Documentation: optimization guide, verification guide
- Instruction selector supports all major ops (add, sub, mul, div, neg, exp, relu, gelu, softmax, maxpool, matmul, dot)
- Register allocator: greedy mode (LRU-based) added alongside naive
- Initial IR: types (Value, Instruction, BasicBlock, Function, Program)
- ONNX parser: Add, Mul, Sub, Div, MatMul, ReLU, GELU, Softmax, MaxPool
- DSL parser for fast iteration without ONNX dependency
- IR builder with chainable API
- IR printer for debugging
- Instruction selector: IR → RISC-V pseudo-instructions
- Register allocator: naive (spill-all) mode
- Assembly emitter: GAS-syntax output
- Constant folding and dead code elimination passes
- CLI entry point with
-o,--dump-irflags