get_device_chip_id

get_device_chip_id(device_id, backend_name='')

Retrieves the logical chip ID for a Houmo device.

The function returns:

  • For a backend with a card-level topology, such as Houmo M50 series devices:

    • The specified device is not connected to any other device through CTC:

      The function returns the logical chip ID associated with the specified device. Each chip within the same Houmo device has a distinct logical chip ID.

    • The specified device belongs to a CTC-connected device group:

      The function returns the chip index of the specified device within the group. The returned value corresponds to the low 16 bits of the raw chip ID. Devices in the same card have distinct logical chip IDs.

  • For a backend without a card-level topology, such as Houmo M30 series devices:

    This function returns the device ID. Each device is treated as a separate group.

  • If the device ID or backend name is invalid, or if the logical device group cannot be determined, the function returns a negative value.

Notes

  • The value is served from the topology cached by the backend and is intended for identification and comparison only. It must not be passed to DevManager as a chip ID.

  • When an inference requires devices to communicate through CTC, all chips used for inference must belong to the same logical device group, and the logical chip IDs must be consecutive, such as {0, 1}, {2, 3}, or {2, 3, 4}. Otherwise, a runtime error occurs.

Parameters:
  • device_id (int) -- The logical device ID.

  • backend_name (str) -- The backend name. An empty string uses the default backend.

Returns:

chip_id -- The logical chip ID, served from the topology cached by the backend. See the return value semantics above.

Return type:

int