To load a memory representation of a plain assembler program into a node, its instruction class set must contain instruction classes for all user and mixed-type instructions used in the assembler program, and the multinode model must have the look-ahead signal segment with zero length.
Warning: if the environment state identification engine is a small actor (the field
engine_desc[QSMM_ENGINE_ENV].large_desc_pofqsmm_desc_sstructure passed to the functionqsmm_createisNULL), and it uses a built-in function for computing the relative probability of an output signal, adaptive behavior of assembler programs specifying nondeterministic state transitions is generally ill-defined. Similarly, if the instruction emitting engine is a small actor (the fieldengine_desc[QSMM_ENGINE_IEE].large_desc_pofqsmm_desc_sisNULL), and it uses a built-in function for computing the relative probability of an output signal, adaptive behavior of assembler programs specifying nondeterministic instruction emissions is also generally ill-defined. It is so, because profile probabilities act as output signal weights, and the explanation in Number of Output Signals applies. Therefore, tend to using large actors for the environment state identification engine and instruction emitting engine in the general case.
The functions qsmm_node_asm and qsmm_get_prg_nstate_v2 described further on in this section take the argument flags specifying the modes of processing a memory representation of an assembler program.
That argument is a bitmask defined as a subset of macros described below merged by bitwise “or.”
Impose the following restriction on a probability profile for the state transition matrix: for every triple consisting of a source node state, an individual user or mixed-type instruction or a sequence of individual or mixed-type instructions emitted in the source node state, and an instruction outcome, the probability profile must specify a single target state, that is, the selection of a target node state must be deterministic.
Setting to a non-zero value the field engine_desc[QSMM_ENGINE_ENV].is_determ of qsmm_desc_s structure passed to the function qsmm_create turns on this mode for all nodes in a multinode model.
See Creating a Handle, for the description of is_determ field of qsmm_engine_desc_s structure for more information.
Impose the following restriction on a probability profile for the action emission matrix: for every node state, the probability profile must specify a single user or mixed-type instruction or a single sequence of user or mixed-type instructions emitted in the node state, that is, the selection of an individual instruction or instruction sequence must be deterministic.
Setting to a non-zero value the field engine_desc[QSMM_ENGINE_IEE].is_determ of qsmm_desc_s structure passed to the function qsmm_create turns on this mode for all nodes in a multinode model.
See Creating a Handle, for the description of is_determ field of qsmm_engine_desc_s structure for more information.
Store the memory representation of an assembler program in the node as a template.
The function qsmm_node_disasm automatically uses the template when disassembling the node: a disassembled program is a template program with profile probabilities in jprob and case instructions replaced with probabilities of a type specified by the field prob_type of qsmm_disasm_desc_s structure passed to qsmm_node_disasm or the type QSMM_PROB_AGGR when using default disassembling parameters.
The function qsmm_node_disasm removes prob instructions from the disassembled program.
The field prob_goto_min of qsmm_disasm_desc_s structure specifies a minimum probability in jprob and case instructions for the state transition matrix.
The field prob_action_min of qsmm_disasm_desc_s structure specifies a minimum probability in jprob and case instructions for the action emission matrix.
The disassembler removes jprob and case instructions containing lesser probabilities from a disassembled program, although the template program contained the instructions.
The disassembler can calculate additional probabilities with types specified by the field do_calc_prob of qsmm_disasm_desc_s structure for subsequent adding to comments for jprob and case instructions.
Collect information on output probability variables in an assembler program.
You use them to fetch the probabilities of jprob and individual case instructions learned while executing or training the node.
See Output Variables, for more information.
Collect information on output probabilities arrays in an assembler program.
You use them to fetch probabilities for choice instruction blocks learned while executing or training the node.
See Output Arrays, for more information.
Enable the use of auxiliary probability variables in an assembler program.
They act as constants and are neither controlled nor output variables.
The disassembler merely replaces occurrences of auxiliary probability variables in jprob and case instructions with values of the variables.
See Auxiliary Variables, for more information.
The functions qsmm_node_asm and qsmm_get_prg_nstate_v2 do not process compound assembler programs.
Use the functions qsmm_get_prg_nnested, qsmm_get_prg_nested, and qsmm_get_prg_name described in Inspecting an Assembler Program to fetch procedures from a memory representation of a compound assembler program, determine their names, and pass the procedures to qsmm_node_asm or qsmm_get_prg_nstate_v2 individually.
Use qsmm_node_asm to load an assembler procedure or plain assembler program into a node.
int qsmm_node_asm (qsmm_t model, qsmm_sig_t node, unsigned int flags, qsmm_prg_t prg, qsmm_msglist_t msglist) ¶This function assembles a node of a multinode model—loads a probability profile specified by a plain assembler program prg into the node.
The argument node passes its identifier.
The argument flags specifies assembling modes defined as a subset of QSMM_ASM_* macros merged by bitwise “or.”.
If msglist is not NULL, the function adds to a message list msglist error, warning, and note messages generated while assembling.
If the function encounters instruction class sequences while assembling the node, and its instruction class set does not contain them, the function registers the instruction class sequences in the instruction class set.
The function clears event history statistics collected for the node.
If the node already has a probability profile loaded, the function first unloads the profile.
To clear the event history statistics and unload the profile, this function calls the function qsmm_node_unload.
The function returns a non-negative value on success or a negative error code on failure. Currently, the function can return the following error codes.
QSMM_ERR_NOTFOUNDA node with identifier node does not exist.
QSMM_ERR_PRGA program prg has an error.
If msglist is not NULL, the function adds at least one error message along with possible warning and note messages to a message list msglist.
If model has an error handler assigned, it receives a message list with at least one error message along with possible warning and note messages.
QSMM_ERR_UNTIMELYOne of the following conditions is true:
See Number of Output Signals, for cases when a large actor creates a default output signal choice tree.
QSMM_ERR_PROFSRCPThe node is a probability profile source for other nodes. See Memory Efficient Cloning the Probability Profile, for more information on this mode.
QSMM_ERR_NOTSUPA program prg is compound one, or model has positive length of look-ahead signal segment.
QSMM_ERR_STORAGEA Storage API function reported storage failure.
QSMM_ERR_STATSInconsistent statistics on an action choice state or cycle type detected.
QSMM_ERR_ILSEQUnable to convert a multibyte string to a wide string or vice versa according to a current locale.
QSMM_ERR_NOMEMThere was not enough memory to perform the operation.
Errors QSMM_ERR_UNTIMELY, QSMM_ERR_STORAGE, QSMM_ERR_STATS, QSMM_ERR_ILSEQ, and QSMM_ERR_NOMEM can leave the probability profile of the node in inconsistent state or make the instruction class set of the node contain newly registered but unused instruction class sequences.
If after removing a reason of an error a repeated call to this function succeeds, the inconsistencies become fixed.
Use the function described below to count the number of states in an assembler program. The function is mainly for informational purposes, as QSMM 1.19 does not require to use that number before loading the assembler program into a node.
int qsmm_get_prg_nstate_v2 (qsmm_t model, const char *instr_class_set_name, int rez1, unsigned int flags, qsmm_prg_t prg, qsmm_msglist_t msglist, qsmm_sig_t *nstate_p) ¶This function calculates the number of states required for the nodes of a multinode model to hold a probability profile specified by a plain assembler program prg.
The argument instr_class_set_name specifies the name of instruction class set of the nodes.
The argument flags specifies assembling modes defined as a subset of QSMM_ASM_* macros merged by bitwise “or.”.
If msglist is not NULL, the function adds to a message list msglist error, warning, and note messages generated during the calculation.
The argument rez1 is for future use and must be equal to 0.
On success, the function returns a non-negative value and sets *nstate_p to a calculated number of states if nstate_p is not NULL.
On failure, the function returns a negative error code.
Currently, the function can return the following error codes.
QSMM_ERR_NOTFOUNDThe instruction class set instr_class_set_name does not exist.
QSMM_ERR_TYPEAn entity named instr_class_set_name is not an instruction class set. The entity is an instruction meta-class.
QSMM_ERR_PRGThe program prg has an error.
If msglist is not NULL, the function adds at least one error message along with possible warning and note messages to a message list msglist.
If model has an error handler assigned, it receives a message list with at least one error message along with possible warning and note messages.
QSMM_ERR_NOTSUPA program prg is compound one, or model has positive length of look-ahead signal segment.
QSMM_ERR_ILSEQUnable to convert a multibyte string to a wide string or vice versa according to a current locale.
QSMM_ERR_NOMEMThere was not enough memory to perform the operation.