get_soc_spec

Description

Obtains hardware information, including SOC_VERSION, AICORE_TYPE, CORE_NUM, and the size of each storage unit.

Prototype

def get_soc_spec(key)

Parameters

Parameter

Type

Description

key

String

Hardware information type:

"SOC_VERSION"

"AICORE_TYPE"

"CORE_NUM"

"UB_SIZE"

"L2_SIZE"

"L1_SIZE"

"CUBE_SIZE"

"L0A_SIZE"

"L0B_SIZE"

"L0C_SIZE"

"SMASK_SIZE"

Returns

Input key's value, such as:
  • "SOC_VERSION": a string for the SoC version.
  • "AICORE_TYPE": the core type, either "AiCore" or "VectorCore".
  • "CORE_NUM": an int for the number of cores.
  • "UB_SIZE": an int for the Unified Buffer size. The unit is byte.
  • "L2_SIZE": an int for the L2 Buffer size. The unit is byte.
  • "L1_SIZE": an int for the L1 Buffer size. The unit is byte.
  • "CUBE_SIZE": a tuple for the Cube Unit size, for example, (16,16,16). The unit is byte.
  • "L0A_SIZE": an int for the L0A Buffer size. The unit is byte.
  • "L0B_SIZE": an int for the L0B Buffer size. The unit is byte.
  • "L0C_SIZE": an int for the L0C Buffer size. The unit is byte.
  • "SMASK_SIZE": an int for the Smask Buffer size. The unit is byte.

Restrictions

Before calling this API, you need to call set_current_compile_soc_info to set the Ascend AI Processor type. If the type is not set, Ascend310 is used by default.

Example

Before calling, replace soc_version with the actual Ascend AI Processor version.

import tbe
soc_version="xxx"
tbe.common.platform.set_current_compile_soc_info(soc_version)
tbe.common.platform.get_soc_spec("CORE_NUM")