Skip to content

Type mismatch in p2p peer info enum #2079

Closed
@pbalcer

Description

@pbalcer

The p2p extension defines two query info enums as uint32_t values:

    - name: UR_PEER_ACCESS_SUPPORTED
      desc: "[uint32_t] 1 if P2P access is supported otherwise P2P access is not supported."
    - name: UR_PEER_ATOMICS_SUPPORTED
      desc: "[uint32_t] 1 if atomic operations are supported over the P2P link, otherwise such operations are not supported."

However, the CUDA implementation uses ints:

  int value;
  CUdevice_P2PAttribute cuAttr;
  ...
    switch (propName) {
    case UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED: {
      cuAttr = CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED;
      break;
    }
   ...

    UR_CHECK_ERROR(cuDeviceGetP2PAttribute(&value, cuAttr, commandDevice->get(),
                                           peerDevice->get()));

  return ReturnValue(value);

And the L0 implementation uses a bool:

  bool propertyValue = false;
  switch (propName) {
  case UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED: {
    ...
    ZE2UR_CALL(
        zeDeviceCanAccessPeer,
        (commandDevice->ZeDevice, peerDevice->ZeDevice, &p2pDeviceSupported));
    propertyValue = p2pAccessSupported && p2pDeviceSupported;
    break;


  return ReturnValue(propertyValue);

This causes the scripts to generate incorrect code, especially for print API:
---> urUsmP2PPeerAccessGetInfoExp(.commandDevice = 0x6885b80, .peerDevice = 0x6886180, .propName = UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED, .propSize = 1, .pPropValue = invalid size (is: 1, expected: >=4), .pPropSizeRet = nullptr) -> UR_RESULT_SUCCESS;
Notice the pPropValue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions