The invention provides an RISC-V-oriented eBPF cycle vectorization compiling method and device, and the method comprises the steps: generating an RVV vector
machine code, executing the parallel operation when a condition is satisfied, achieving the
parallel processing of a single instruction and multiple data, carrying out the serial conversion of the time dimension of eBPF cycle into the parallel spatial dimension of an RVV vector, remarkably improving the
processing throughput, and improving the compiling efficiency. And the task
response time delay and the CPU
occupancy rate are reduced. According to the RVV vector execution mode, a large number of repeated
loop control instructions and memory read-write instructions can be reduced, the register overflow problem caused by eBPF scalar register resource shortage is relieved, the cache pressure and the
branch prediction
failure rate are reduced, and the energy efficiency ratio is increased. Meanwhile, an RVV vector
machine code and a scalar fallback code are generated, a parallel priority and scalar bottom double execution path is formed, and it is ensured that under the conditions that a hardware environment is not supported, the data size does not reach a threshold value, vectorization
verification fails or operation is abnormal, the scalar fallback code can be seamlessly switched to be executed.