conf: [feat] add instruction_allowlist option

This commit is contained in:
Oleksii Oleksenko 2024-01-11 15:35:25 +00:00
Родитель 1af6c2dc01
Коммит 3c13f10495
Не найден ключ, соответствующий данной подписи
4 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -49,10 +49,12 @@ For a complete list, see `src/config.py`.
* `program_size` [int]: Number of instructions per test case.
The actual size might be larger because of the instrumentation.
* `avg_mem_accesses` [int]: Average number of memory accesses per test case.
* `instruction_categories` [list(str)]: List of instruction categories to be used when generating a test case.
* `instruction_allowlist` [list(str)]: List of instructions to use for generating programs; combined with instruction_categories; has priority over instruction_blocklist.
Used to select instructions from the instruction set file passed via command line (`--instruction-set`).
* `instruction_categories` [list(str)]: List of instruction categories to be used when generating programs.
Used to filter out instructions from the instruction set file passed via command line (`--instruction-set`).
* `instruction_blocklist` [list(str)]: List of instructions to be excluded by the generator.
Used to filter out instructions from the instruction set file passed via command line (`--instruction-set`).
Filters out instructions from instruction_categories, but not from instruction_allowlist.
* `generator_faults_allowlist` [list(str)]: by default, generator will produce programs that never trigger exceptions. This option modifies this behavior by permitting the generator to produce 'unsafe' instruction sequences that could potentially trigger an exception. Model and executor will also be configured to handle these exceptions gracefully
# Input Generator Configuration

Просмотреть файл

@ -10,6 +10,7 @@ from typing import List, Dict
from collections import OrderedDict
from .x86 import x86_config
class ConfigException(SystemExit):
pass
@ -43,10 +44,14 @@ class Conf:
""" generator: type of the program generator """
instruction_set: str = "x86-64"
""" instruction_set: ISA under test """
instruction_allowlist: List[str] = []
""" instruction_allowlist: list of instructions to use for generating programs; combined with
instruction_categories; has priority over instruction_blocklist """
instruction_categories: List[str] = []
""" instruction_categories: list of instruction categories to use for generating programs """
instruction_blocklist: List[str] = []
""" instruction_blocklist: list of instruction that will NOT be used for generating programs """
""" instruction_blocklist: list of instruction that will NOT be used for generating programs;
filters out instructions from instruction_categories, but not from instruction_allowlist"""
program_generator_seed: int = 0
""" program_generator_seed: seed of the program generator """
program_size: int = 24

Просмотреть файл

@ -77,6 +77,10 @@ class InstructionSet(InstructionSetAbstract):
# if we use an existing test case, then instruction filtering is irrelevant
return True
# allowlist has priority over blocklists
if spec.name in CONF.instruction_allowlist:
return True
if include_categories and spec.category not in include_categories:
return False

Просмотреть файл

@ -115,7 +115,7 @@ _option_values = {
# "BASE-IOSTRINGOP", # Not supported: System instructions
# "BASE-SYSCALL", # Not supported: System instructions
# "BASE-SYSRET", # Not supported: System instructions
# "BASE-SYSTEM", # Not supported: System instructions
"BASE-SYSTEM",
"LONGMODE-SYSCALL",
"LONGMODE-SYSRET",
@ -144,6 +144,9 @@ _option_values = {
"CLFLUSHOPT-CLFLUSHOPT",
"CLFSH-MISC",
"MPX-MPX",
"SMX-SYSTEM",
"VTX-VTX",
"XSAVE-XSAVE",
]
}