Software Acceleration Classes

enum xf::data_analytics::text::re::ErrCode

Overview

Error code enumerations. More…

// enum values

SUCCESS = 0
PATTERN_ERR = 1
MEM_ERR = 2
DEV_ERR = 3
OPCODE_ERR = 4
INSTR_NM_ERR = 5
CCLASS_NM_ERR = 6
CPGP_NM_ERR = 7

Detailed Documentation

Error code enumerations.

Enum Values

SUCCESS

RE pre-compilation success

PATTERN_ERR

Invalid RE pattern

MEM_ERR

CL buffer allocation failed

DEV_ERR

Kernel creation failed

OPCODE_ERR

Wrong OP code

INSTR_NM_ERR

Wrong number of instructions

CCLASS_NM_ERR

Wrong number of character classes

CPGP_NM_ERR

Wrong number of capturing groups

class xf::data_analytics::text::re::RegexEngine

#include "xf_data_analytics/text/regex_engine.hpp"

Overview

Offload regex match with FPGA.


Methods

RegexEngine

RegexEngine (
    const std::string& xclbin,
    const int dev_index = 0,
    const int instr_depth = 4096,
    const int char_class_num = 128,
    const int capture_grp_num = 512,
    const int msg_size = 4096,
    const int max_slice_size = 5242880,
    const int max_slice_num = 256
    )

Default constructor for loading and programming binary.

Parameters:

xclbin Path to FPGA binary.
dev_index The index of Xilinx OpenCL device.
instr_depth Max number of instructions.
char_class_num Max number of character classes.
capture_grp_num Max number of capturing groups.
msg_size Max size for each message, in number of bytes. max_slice_size Max message slice size, in number of bytes.
max_slice_num Max message slice number.

~RegexEngine

~RegexEngine ()

Default de-constructor for releasing program/command-queue/contect.

compile

ErrCode compile (std::string pattern)

Pre-compiles pattern and gives error code correspondingly.

Parameters:

pattern Input regular expression

getCpgpNm

uint32_t getCpgpNm () const

Gets the number of capturing groups for current pattern.

match

ErrCode match (
    uint32_t total_lnm,
    const uint64_t* msg_buff,
    uint32_t* offt_buff,
    uint16_t* len_buff,
    uint32_t* out_buff
    )

Prepares configurations for RegexEngineKernel , and performs the actual matching process.

Parameters:

total_lnm Total number of lines in current message block
msg_buff Buffer for saving messages line-by-line, pads white-space if not hit the boundary of 64-bit
offt_buff Buffer for saving starting address of each line, aligned with 64-bit
len_buff Buffer for saving length of each message, in byte
out_buff Buffer for saving output results including match flag & corresponding start/end offset address for each capturing group

RegexEngine

RegexEngine (
    const int instr_depth = 4096,
    const int char_class_num = 128,
    const int capture_grp_num = 512,
    const int msg_size = 4096,
    const int max_slice_size = 5242880,
    const int max_slice_num = 256
    )

Default constructor for loading and programming binary.

Parameters:

instr_depth Max number of instructions.
char_class_num Max number of character classes.
capture_grp_num Max number of capturing groups.
msg_size Max size for each message, in number of bytes. max_slice_size Max message slice size, in number of bytes.
max_slice_num Max message slice number.