aoclsparse_enable_instructions() - aoclsparse_enable_instructions() - 5.3 English - 68552

AOCL API Guide (68552)

Document_ID
68552
Release_Date
2026-05-13
Version
5.3 English
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_INSTRUCTIONS environmental 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_preference contains an invalid string or that “ENV” was passed and the environmental variable AOCL_ENABLE_INSTRUCTIONS contained an invalid string.

Returns:

aoclsparse_status.