AddPlatformInfo

Function

Sets the hardware platform information for debugging the operator tiling function. The following two setting methods are supported:

  • Automatically obtaining the current hardware platform information: Pass a null pointer to automatically obtain the current hardware information and add it to the ContextBuilder class.
  • Specifying the hardware platform information: Pass a specific Ascend AI Processor model and add the corresponding hardware information to the ContextBuilder class.

If the setting fails, an error message is printed. For details about how to configure and view logs, see Logs.

Prototype

1
ContextBuilder &AddPlatformInfo(const char* customSocVersion)

Parameters

Parameter

Input/Output

Description

customSocVersion

Input

Ascend AI Processor model. The configuration method is as follows:

  • For the following products: Run the npu-smi info command on the server where Ascend AI Processor is installed to obtain the Name information. The actual value is AscendName. For example, if Name is xxxyy, the actual value is Ascendxxxyy.

    Atlas A2 training products / Atlas A2 inference products

    Atlas 200I/500 A2 inference products

    Atlas inference products

    Atlas training products

  • For the following products: Run the npu-smi info -t board -i id -c chip_id command on the server where Ascend AI Processor is installed to obtain the Chip Name and NPU Name information. The actual value is Chip Name_NPU Name. For example, if the value of Chip Name is Ascendxxx and the value of NPU Name is 1234, the actual value is Ascendxxx_1234. Note that:
    • id: device ID, which is the NPU ID obtained by running the npu-smi info -l command.
    • chip_id: chip ID, which is obtained by running the npu-smi info -m command.

    Atlas A3 training products / Atlas A3 inference products

Returns

Object of the current ContextBuilder.

Restrictions

After AddPlatformInfo is called, the tiling context needs to be constructed using BuildTilingContext and passed to the tiling function.

Example

1
2
3
4
5
6
7
8
9
void AddPlatformInfoDemo(......)
{
    auto holder = context_ascendc::ContextBuilder()
	// ... ... // Add the calling of the operator input and output APIs.
	.AddPlatformInfo("Ascendxxxyy")
	.BuildTilingContext();
    auto tilingContext = holder->GetContext<gert::TilingContext>();
    // ... ...
}