Vector technology

Vector technology is a PowerPC® technology for accelerating the performance-driven, high-bandwidth communications and computing applications. You can use the vector technology to get dramatic performance improvement for your applications.

There are two ways of using the vector technology: hand coding and automatic vectorization. Automatic vectorization often brings the best performance when you write the code in the right way, but appropriate hand coding can provide additional performance improvement.

The following example shows the difference between a simple array element addition and a vectorized version of the same loop.

Array element addition without using the vector technology:

subroutine myadd(n)
  integer :: i, n
  real(4), dimension(n) :: a, b, c

  do i=1, n
    a(i) = b(i) + c(i)
  enddo
end subroutine

Modified array element addition utilizing the vector technology:

subroutine myadd_vector(n)
  integer :: j, n
! vector_size is a constant; for real(4) it must be 16/4 = 4
! n must be a multiple of vector_size
  vector(real(4)), dimension(n/vector_size) :: v_a, v_b, v_c

  do j=1, n/vector_size
    v_a(j) = vec_add(v_b(j), v_c(j))
  enddo
end subroutine

In the vectorized version of the code, the data type is replaced by the vector data type. The loop range is reduced from n to n/vector_size. With the vector technology, the operation, v_a(j)=vec_add(v_b(j), v_c(j)), is executed in a single machine instruction for each vector. Without the vector technology, the same operation requires multiple instructions costing several processor clock cycles. Therefore, the vector technology can improve the performance of an application.

This section provides general information about vector technology with the following three subsections:



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us