ucx icon indicating copy to clipboard operation
ucx copied to clipboard

UCT/IB/DC: bugfix - dci_pool_index have only 3 bits in ep->flags (it's max value is 15)

Open roiedanino opened this issue 1 year ago • 5 comments

What

Adding dci_pool_index attribute to uct_dc_mlx5_ep_t instead of using the first 3 bits of ep->flags.

Why ?

UCT_DC_MLX5_IFACE_MAX_DCI_POOLS is defined to be 16, meaning 3 bits aren't enough, this patch fixes the issue by adding a separate field for dci_pool_index.

roiedanino avatar Feb 13 '24 13:02 roiedanino

@roiedanino given that we already mess with the flags enum there, maybe expand the dci pool index to 4 bits instead of adding a separate field?

gleon99 avatar Feb 14 '24 07:02 gleon99

@roiedanino given that we already mess with the flags enum there, maybe expand the dci pool index to 4 bits instead of adding a separate field?

The cons are:

  1. Encountering the same issue next time MAX_DCI_POOLS is increased.
  2. Extra opcode (bitwise AND) each time the pool index is being accessed.
  3. Index is not semantically a flag - less intuitive.

I guess the benefit is having a smaller ep struct.

roiedanino avatar Feb 14 '24 08:02 roiedanino

I guess the benefit is having a smaller ep struct.

Although now we can decrease flags to use uint8_t instead of uint16_t

roiedanino avatar Feb 14 '24 09:02 roiedanino

I guess the benefit is having a smaller ep struct.

Although now we can decrease flags to use uint8_t instead of uint16_t

imo, better to keep flags as uint16_t and use 4 (or 5) bits for dci pool index. We do not need 8 bits for dci pool index and this way we can keep the rest bits for flags.

brminich avatar Feb 14 '24 13:02 brminich

@roiedanino can you pls squash?

yosefe avatar Feb 20 '24 17:02 yosefe