我要评分
获取效率
正确性
完整性
易理解

CpuFeature

  • Set the instruction set supported by the HMPP:

    HmppResult HMPP_SetCpuFeatures (uint64_t cpuFeatures);

  • Obtain the instruction set supported by the CPU:

    HmppResult HMPP_GetCpuFeatures (uint64_t* cpuFeatures);

  • Obtain the instruction set supported by the HMPP:

    uint64_t HMPP_GetEnabledCpuFeatures()

Parameters

Parameter

Description

Value Range

Input/Output

cpuFeatures

Instruction set supported by the HMPP to be set (SetCpuFeatures)

Macros with the suffix _FM in the hmpp_core.h header file

Input

cpuFeatures

Pointer to the address storing the IDs of instruction set features supported by the CPU (GetCpuFeatures)

The value cannot be NULL.

Output

Return Value

HMPP_SetCpuFeatures

  • Success: HMPP_STS_NO_ERR
  • Failure: HMPP_STS_UNKNOWN_FEATURE

HMPP_GetCpuFeatures

  • Success: HMPP_STS_NO_ERR
  • Failure: HMPP_STS_NULL_PTR_ERR

HMPP_GetEnabledCpuFeatures

  • Number of instruction set features supported by the HMPP

Error Codes

Error Code

Description

HMPP_STS_NULL_PTR_ERR

The cpuFeatures pointer is NULL.

HMPP_STS_UNKNOWN_FEATURE

The instruction set to be set is not supported.

Note

Only the NEON_FM mode (defined in hmppcore.h) is supported.

Example

void  CpuFeature()
{
    uint64_t cpuFeatures;
    HmppResult result = HMPP_GetCpuFeatures(&cpuFeatures);
    printf("%s\n", HMPP_GetStatusString(result));
    printf("cpuFeatures = %016x\n", cpuFeatures);

    result = HMPP_SetCpuFeatures(NEON_FM);
    printf("%s\n", HMPP_GetStatusString(result));

    printf("enabledCpuFeatures = %016x\n", HMPP_GetEnabledCpuFeatures());
}

Output:

No Error
cpuFeatures = 0000000000000001
No Error
enabledCpuFeatures = 0000000000000001