Skip to content

feat: SIMD-0321 provide instruction-data VM address in r2#208

Open
7layermagik wants to merge 1 commit intodevfrom
7layer/simd-0321-r2-offset
Open

feat: SIMD-0321 provide instruction-data VM address in r2#208
7layermagik wants to merge 1 commit intodevfrom
7layer/simd-0321-r2-offset

Conversation

@7layermagik
Copy link

Summary

Implements SIMD-0321, which provides the VM address of the instruction data buffer in register r2 at program entrypoint. This allows BPF programs to locate their instruction data within the serialized input region without scanning.

Changes

  • Feature gate: Added ProvideInstructionDataOffsetInVmR2 (5xXZc66h4UdB6Yq7FzdBxBiRAFMMScMLwHxk2QZDaNZL) to pkg/features/gates.go
  • Serialization: serializeParametersAligned and serializeParametersUnaligned now return the byte offset of the instruction data within the serialized input buffer (offset past the 8-byte length prefix). Both aligned and unaligned paths compute this identically.
  • VM plumbing: Added InputDataVaddr field to VMOpts and Interpreter structs. When the feature is active, InputDataVaddr is set to VaddrInput + instrDataOffset, giving the absolute VM address of the instruction data bytes.
  • Entrypoint: r2 is initialized to InputDataVaddr at interpreter startup (alongside the existing r1 = VaddrInput). When the feature is inactive, r2 remains 0 (no behavioral change for existing programs).

Agave reference

  • agave/programs/bpf_loader/src/lib.rscreate_vm sets r2 from instruction_data_offset
  • agave/programs/bpf_loader/src/serialization.rsserialize_parameters_aligned returns instruction_data_offset
  • Feature gate: provide_instruction_data_offset_in_vm_r2

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant