-
aoclsparse_status aoclsparse_enable_instructions(const char isa_preference[])#
Set ISA code-path preference.
Valid values (case-insensitive):
GENERIC — Use the generic (scalar) code path; runs on any supported x86 CPU.
AVX2 — Prefer AVX2 (256-bit SIMD) kernels. If the CPU does not support AVX2, the library falls back to GENERIC.
AVX512 — Prefer AVX-512 (512-bit SIMD) kernels. If the CPU does not support AVX-512, the library falls back to AVX2, then to GENERIC.
- AOCL_ENABLE_INSTRUCTIONS
Environment variable that sets the ISA code-path preference for kernels that have more than one implementation. Read at library initialization; can be re-applied at run time by calling aoclsparse_enable_instructions(ENV).
Any other value (including misspellings) is silently ignored and the library uses its default auto-detected ISA path.
The same preference can be set at runtime via aoclsparse_enable_instructions().
This auxiliary function sets the ISA code-path preference to run kernels that have more than a single path implementation. ISA code-path preference set using this API will influence the kernel selection logic.
- Parameters:
isa_preference – [in] pointer to a const char array specifying the ISA preference, valid values are: “AVX2”, “AVX512”, “GENERIC”, “ENV”. The first three values are also valid for the
AOCL_ENABLE_INSTRUCTIONSenvironmental variable. While “ENV” is a special value to request to read again the environmental variable and set the ISA path preference accordingly.- Return values:
aoclsparse_status_success – ISA preference set successfully.
aoclsparse_status_invalid_input – signals that either the
isa_preferencecontains an invalid string or that “ENV” was passed and the environmental variableAOCL_ENABLE_INSTRUCTIONScontained an invalid string.
- Returns: